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

Allow the topview in WebLayer to hide for non-committed navigations.

This matches Chrome in that the url bar is shown at the start of every navigation if it was hidden. It will stay visible for non committed navigations (again matching Chrome), but allows the user to scroll up to hide it.

Also fix this for the failed-load case.

Bug: 1127937
Change-Id: I6b91a1ae17a02f5340c5160f048b77d190e4b28d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2415673Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807996}
parent 7854f257
...@@ -61,8 +61,10 @@ void BrowserControlsNavigationStateHandler::DidStartNavigation( ...@@ -61,8 +61,10 @@ void BrowserControlsNavigationStateHandler::DidStartNavigation(
void BrowserControlsNavigationStateHandler::DidFinishNavigation( void BrowserControlsNavigationStateHandler::DidFinishNavigation(
content::NavigationHandle* navigation_handle) { content::NavigationHandle* navigation_handle) {
if (navigation_handle->IsInMainFrame()) { if (navigation_handle->IsInMainFrame()) {
if (navigation_handle->HasCommitted()) if (!navigation_handle->HasCommitted()) {
is_showing_error_page_ = navigation_handle->IsErrorPage(); // There will be no DidFinishLoad or DidFailLoad, so hide the topview
ScheduleStopDelayedForceShow();
}
delegate_->OnUpdateBrowserControlsStateBecauseOfProcessSwitch( delegate_->OnUpdateBrowserControlsStateBecauseOfProcessSwitch(
navigation_handle->HasCommitted()); navigation_handle->HasCommitted());
} }
...@@ -81,6 +83,10 @@ void BrowserControlsNavigationStateHandler::DidFailLoad( ...@@ -81,6 +83,10 @@ void BrowserControlsNavigationStateHandler::DidFailLoad(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
const GURL& validated_url, const GURL& validated_url,
int error_code) { int error_code) {
const bool is_main_frame =
render_frame_host->GetMainFrame() == render_frame_host;
if (is_main_frame)
ScheduleStopDelayedForceShow();
if (render_frame_host->IsCurrent() && if (render_frame_host->IsCurrent() &&
(render_frame_host == web_contents()->GetMainFrame())) { (render_frame_host == web_contents()->GetMainFrame())) {
UpdateState(); UpdateState();
......
...@@ -82,9 +82,6 @@ class BrowserControlsNavigationStateHandler ...@@ -82,9 +82,6 @@ class BrowserControlsNavigationStateHandler
// Last value supplied to the delegate. // Last value supplied to the delegate.
base::Optional<content::BrowserControlsState> last_state_; base::Optional<content::BrowserControlsState> last_state_;
// True if an error page is showing.
bool is_showing_error_page_ = false;
// This is cached as WebContents::IsCrashed() does not always return the // This is cached as WebContents::IsCrashed() does not always return the
// right thing. // right thing.
bool is_crashed_ = false; bool is_crashed_ = false;
......
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