Commit 795fbeae authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Add headers for navigation API and observer for WebLayer.

Change-Id: I965bbb46ff7dcdacad89fc1584cf1fa20f7056b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768867
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarDarin Fisher <darin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690091}
parent 1f1c3458
......@@ -50,6 +50,8 @@ jumbo_static_library("weblayer_lib") {
"browser/web_profile_impl.h",
"common/web_content_client.cc",
"common/web_content_client.h",
"public/navigation.h",
"public/navigation_observer.h",
"public/web_browser_controller.h",
"public/web_main.h",
"public/web_navigation_controller.h",
......
// Copyright 2019 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.
#ifndef WEBLAYER_PUBLIC_NAVIGATION_H_
#define WEBLAYER_PUBLIC_NAVIGATION_H_
class GURL;
namespace weblayer {
class Navigation {
public:
virtual ~Navigation() {}
// The URL the frame is navigating to. This may change during the navigation
// when encountering a server redirect.
virtual GURL GetURL() = 0;
// Returns the redirects that occurred on the way to the current page. The
// current page is the last one in the list (so even when there's no redirect,
// there will be one entry in the list).
virtual const std::vector<GURL>& GetRedirectChain() = 0;
enum State {
kWaitingResponse,
kReceivingBytes,
kComplete,
kFailed,
};
virtual State GetState() = 0;
};
} // namespace weblayer
#endif // WEBLAYER_PUBLIC_NAVIGATION_H_
// Copyright 2019 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.
#ifndef WEBLAYER_PUBLIC_NAVIGATION_OBSERVER_H_
#define WEBLAYER_PUBLIC_NAVIGATION_OBSERVER_H_
#include <algorithm>
namespace weblayer {
class Navigation;
// The lifecycle of a navigation:
// 1) NavigationStarted
// 2) 0 or more NavigationRedirected
// 3) 0 or 1 NavigationCommitted
// 3) 0 or 1 NavigationHadFirstContentfulPaint
// 4) NavigationCompleted or NavigationFailed
class NavigationObserver {
public:
virtual ~NavigationObserver() {}
virtual void NavigationStarted(Navigation* navigation) = 0;
virtual void NavigationRedirected(Navigation* navigation) = 0;
virtual void NavigationCommitted(Navigation* navigation) = 0;
virtual void NavigationHadFirstContentfulPaint(Navigation* navigation) = 0;
virtual void NavigationCompleted(Navigation* navigation) = 0;
virtual void NavigationFailed(Navigation* navigation) = 0;
};
} // namespace weblayer
#endif // WEBLAYER_PUBLIC_NAVIGATION_OBSERVER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment