blob: be0498b6285a07bfa5eece105190b3acfad44890 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "content/public/browser/navigation_throttle.h"
namespace content {
class NavigationHandle;
} // namespace content
// A NavigationThrottle that opens the local New Tab Page when there is any
// issue opening the remote New Tab Page.
class NewTabPageNavigationThrottle : public content::NavigationThrottle {
// Returns a NavigationThrottle when:
// - we are navigating to the new tab page, and
// - the main frame is pointed at the new tab URL.
static std::unique_ptr<content::NavigationThrottle> MaybeCreateThrottleFor(
content::NavigationHandle* handle);
explicit NewTabPageNavigationThrottle(content::NavigationHandle* handle);
~NewTabPageNavigationThrottle() override;
// content::NavigationThrottle:
ThrottleCheckResult WillFailRequest() override;
ThrottleCheckResult WillProcessResponse() override;
const char* GetNameForLogging() override;
ThrottleCheckResult OpenLocalNewTabPage();