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

Side by Side Diff: content/browser/frame_host/interstitial_page_impl.cc

Issue 1545973002: Remove the is_loading_ field from WebContentsImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed issue with tests Created 4 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/interstitial_page_impl.h" 5 #include "content/browser/frame_host/interstitial_page_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // the WebContents one, so we can enforce no navigation policy here. 179 // the WebContents one, so we can enforce no navigation policy here.
180 // While we get the code to a point to do this, pass NULL for it. 180 // While we get the code to a point to do this, pass NULL for it.
181 // TODO(creis): We will also need to pass delegates for the RVHM as we 181 // TODO(creis): We will also need to pass delegates for the RVHM as we
182 // start to use it. 182 // start to use it.
183 frame_tree_(new InterstitialPageNavigatorImpl(this, controller_), 183 frame_tree_(new InterstitialPageNavigatorImpl(this, controller_),
184 this, this, this, 184 this, this, this,
185 static_cast<WebContentsImpl*>(web_contents)), 185 static_cast<WebContentsImpl*>(web_contents)),
186 original_child_id_(web_contents->GetRenderProcessHost()->GetID()), 186 original_child_id_(web_contents->GetRenderProcessHost()->GetID()),
187 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()), 187 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()),
188 should_revert_web_contents_title_(false), 188 should_revert_web_contents_title_(false),
189 web_contents_was_loading_(false),
190 resource_dispatcher_host_notified_(false), 189 resource_dispatcher_host_notified_(false),
191 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)), 190 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)),
192 create_view_(true), 191 create_view_(true),
193 delegate_(delegate), 192 delegate_(delegate),
194 weak_ptr_factory_(this) { 193 weak_ptr_factory_(this) {
195 InitInterstitialPageMap(); 194 InitInterstitialPageMap();
196 } 195 }
197 196
198 InterstitialPageImpl::~InterstitialPageImpl() { 197 InterstitialPageImpl::~InterstitialPageImpl() {
199 } 198 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 532
534 // The RenderViewHost may already have crashed before we even get here. 533 // The RenderViewHost may already have crashed before we even get here.
535 if (rwh_view) { 534 if (rwh_view) {
536 // If the page has focus, focus the interstitial. 535 // If the page has focus, focus the interstitial.
537 if (rwh_view->HasFocus()) 536 if (rwh_view->HasFocus())
538 Focus(); 537 Focus();
539 538
540 // Hide the original RVH since we're showing the interstitial instead. 539 // Hide the original RVH since we're showing the interstitial instead.
541 rwh_view->Hide(); 540 rwh_view->Hide();
542 } 541 }
543
544 // Notify the tab we are not loading so the throbber is stopped. It also
545 // causes a WebContentsObserver::DidStopLoading callback that the
546 // AutomationProvider (used by the UI tests) expects to consider a navigation
547 // as complete. Without this, navigating in a UI test to a URL that triggers
548 // an interstitial would hang.
549 web_contents_was_loading_ = controller_->delegate()->IsLoading();
550 controller_->delegate()->SetIsLoading(false, true, NULL);
551 } 542 }
552 543
553 RendererPreferences InterstitialPageImpl::GetRendererPrefs( 544 RendererPreferences InterstitialPageImpl::GetRendererPrefs(
554 BrowserContext* browser_context) const { 545 BrowserContext* browser_context) const {
555 delegate_->OverrideRendererPrefs(&renderer_preferences_); 546 delegate_->OverrideRendererPrefs(&renderer_preferences_);
556 return renderer_preferences_; 547 return renderer_preferences_;
557 } 548 }
558 549
559 void InterstitialPageImpl::RenderWidgetDeleted( 550 void InterstitialPageImpl::RenderWidgetDeleted(
560 RenderWidgetHostImpl* render_widget_host) { 551 RenderWidgetHostImpl* render_widget_host) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 if (!render_view_host_) 640 if (!render_view_host_)
650 return; 641 return;
651 642
652 if (action_taken_ != NO_ACTION) { 643 if (action_taken_ != NO_ACTION) {
653 NOTREACHED(); 644 NOTREACHED();
654 return; 645 return;
655 } 646 }
656 Disable(); 647 Disable();
657 action_taken_ = PROCEED_ACTION; 648 action_taken_ = PROCEED_ACTION;
658 649
659 // Resumes the throbber, if applicable. 650 controller_->delegate()->DidProceedOnInterstitial();
660 if (web_contents_was_loading_)
661 controller_->delegate()->SetIsLoading(true, true, NULL);
662 651
663 // If this is a new navigation, the old page is going away, so we cancel any 652 // If this is a new navigation, the old page is going away, so we cancel any
664 // blocked requests for it. If it is not a new navigation, then it means the 653 // blocked requests for it. If it is not a new navigation, then it means the
665 // interstitial was shown as a result of a resource loading in the page. 654 // interstitial was shown as a result of a resource loading in the page.
666 // Since the user wants to proceed, we'll let any blocked request go through. 655 // Since the user wants to proceed, we'll let any blocked request go through.
667 if (new_navigation_) 656 if (new_navigation_)
668 TakeActionOnResourceDispatcher(CANCEL); 657 TakeActionOnResourceDispatcher(CANCEL);
669 else 658 else
670 TakeActionOnResourceDispatcher(RESUME); 659 TakeActionOnResourceDispatcher(RESUME);
671 660
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( 946 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted(
958 const LoadCommittedDetails& load_details) { 947 const LoadCommittedDetails& load_details) {
959 interstitial_->OnNavigatingAwayOrTabClosing(); 948 interstitial_->OnNavigatingAwayOrTabClosing();
960 } 949 }
961 950
962 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { 951 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() {
963 interstitial_->OnNavigatingAwayOrTabClosing(); 952 interstitial_->OnNavigatingAwayOrTabClosing();
964 } 953 }
965 954
966 } // namespace content 955 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698