Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2952483002: Revert of Always update the omnibox URL when cancelling via onbeforeunload (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 4795 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 return GetContentClient()->browser()->CreateThrottlesForNavigation( 4806 return GetContentClient()->browser()->CreateThrottlesForNavigation(
4807 navigation_handle); 4807 navigation_handle);
4808 } 4808 }
4809 4809
4810 std::unique_ptr<NavigationUIData> WebContentsImpl::GetNavigationUIData( 4810 std::unique_ptr<NavigationUIData> WebContentsImpl::GetNavigationUIData(
4811 NavigationHandle* navigation_handle) { 4811 NavigationHandle* navigation_handle) {
4812 DCHECK(IsBrowserSideNavigationEnabled()); 4812 DCHECK(IsBrowserSideNavigationEnabled());
4813 return GetContentClient()->browser()->GetNavigationUIData(navigation_handle); 4813 return GetContentClient()->browser()->GetNavigationUIData(navigation_handle);
4814 } 4814 }
4815 4815
4816 void WebContentsImpl::DidCancelLoading() {
4817 controller_.DiscardNonCommittedEntries();
4818
4819 // Update the URL display.
4820 NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
4821 }
4822
4816 void WebContentsImpl::DidAccessInitialDocument() { 4823 void WebContentsImpl::DidAccessInitialDocument() {
4817 has_accessed_initial_document_ = true; 4824 has_accessed_initial_document_ = true;
4818 4825
4819 // We may have left a failed browser-initiated navigation in the address bar 4826 // We may have left a failed browser-initiated navigation in the address bar
4820 // to let the user edit it and try again. Clear it now that content might 4827 // to let the user edit it and try again. Clear it now that content might
4821 // show up underneath it. 4828 // show up underneath it.
4822 if (!IsLoading() && controller_.GetPendingEntry()) 4829 if (!IsLoading() && controller_.GetPendingEntry())
4823 controller_.DiscardPendingEntry(false); 4830 controller_.DiscardPendingEntry(false);
4824 4831
4825 // Update the URL display. 4832 // Update the URL display.
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
5356 const base::string16& user_input) { 5363 const base::string16& user_input) {
5357 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id, 5364 RenderFrameHostImpl* rfh = RenderFrameHostImpl::FromID(render_process_id,
5358 render_frame_id); 5365 render_frame_id);
5359 last_dialog_suppressed_ = dialog_was_suppressed; 5366 last_dialog_suppressed_ = dialog_was_suppressed;
5360 5367
5361 if (is_showing_before_unload_dialog_ && !success) { 5368 if (is_showing_before_unload_dialog_ && !success) {
5362 // It is possible for the current RenderFrameHost to have changed in the 5369 // It is possible for the current RenderFrameHost to have changed in the
5363 // meantime. Do not reset the navigation state in that case. 5370 // meantime. Do not reset the navigation state in that case.
5364 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) { 5371 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) {
5365 rfh->frame_tree_node()->BeforeUnloadCanceled(); 5372 rfh->frame_tree_node()->BeforeUnloadCanceled();
5366
5367 // Remove the entry for the navigation that's being cancelled, and notify
5368 // the WebContentsDelegate that the visible URL has changed.
5369 controller_.DiscardNonCommittedEntries(); 5373 controller_.DiscardNonCommittedEntries();
5370 } 5374 }
5371 5375
5372 for (auto& observer : observers_) 5376 for (auto& observer : observers_)
5373 observer.BeforeUnloadDialogCancelled(); 5377 observer.BeforeUnloadDialogCancelled();
5374 } 5378 }
5375 5379
5376 if (rfh) { 5380 if (rfh) {
5377 rfh->JavaScriptDialogClosed(reply_msg, success, user_input); 5381 rfh->JavaScriptDialogClosed(reply_msg, success, user_input);
5378 } else { 5382 } else {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
5744 } 5748 }
5745 5749
5746 void WebContentsImpl::MediaMutedStatusChanged( 5750 void WebContentsImpl::MediaMutedStatusChanged(
5747 const WebContentsObserver::MediaPlayerId& id, 5751 const WebContentsObserver::MediaPlayerId& id,
5748 bool muted) { 5752 bool muted) {
5749 for (auto& observer : observers_) 5753 for (auto& observer : observers_)
5750 observer.MediaMutedStatusChanged(id, muted); 5754 observer.MediaMutedStatusChanged(id, muted);
5751 } 5755 }
5752 5756
5753 } // namespace content 5757 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/browser/web_contents/web_contents_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698