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

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: Addressed Nasko's comments Created 4 years, 11 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // the WebContents one, so we can enforce no navigation policy here. 171 // the WebContents one, so we can enforce no navigation policy here.
172 // While we get the code to a point to do this, pass NULL for it. 172 // While we get the code to a point to do this, pass NULL for it.
173 // TODO(creis): We will also need to pass delegates for the RVHM as we 173 // TODO(creis): We will also need to pass delegates for the RVHM as we
174 // start to use it. 174 // start to use it.
175 frame_tree_(new InterstitialPageNavigatorImpl(this, controller_), 175 frame_tree_(new InterstitialPageNavigatorImpl(this, controller_),
176 this, this, this, 176 this, this, this,
177 static_cast<WebContentsImpl*>(web_contents)), 177 static_cast<WebContentsImpl*>(web_contents)),
178 original_child_id_(web_contents->GetRenderProcessHost()->GetID()), 178 original_child_id_(web_contents->GetRenderProcessHost()->GetID()),
179 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()), 179 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()),
180 should_revert_web_contents_title_(false), 180 should_revert_web_contents_title_(false),
181 web_contents_was_loading_(false),
182 resource_dispatcher_host_notified_(false), 181 resource_dispatcher_host_notified_(false),
183 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)), 182 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)),
184 create_view_(true), 183 create_view_(true),
185 delegate_(delegate), 184 delegate_(delegate),
186 weak_ptr_factory_(this) { 185 weak_ptr_factory_(this) {
187 InitInterstitialPageMap(); 186 InitInterstitialPageMap();
188 } 187 }
189 188
190 InterstitialPageImpl::~InterstitialPageImpl() { 189 InterstitialPageImpl::~InterstitialPageImpl() {
191 } 190 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 516
518 // The RenderViewHost may already have crashed before we even get here. 517 // The RenderViewHost may already have crashed before we even get here.
519 if (rwh_view) { 518 if (rwh_view) {
520 // If the page has focus, focus the interstitial. 519 // If the page has focus, focus the interstitial.
521 if (rwh_view->HasFocus()) 520 if (rwh_view->HasFocus())
522 Focus(); 521 Focus();
523 522
524 // Hide the original RVH since we're showing the interstitial instead. 523 // Hide the original RVH since we're showing the interstitial instead.
525 rwh_view->Hide(); 524 rwh_view->Hide();
526 } 525 }
527
528 // Notify the tab we are not loading so the throbber is stopped. It also
529 // causes a WebContentsObserver::DidStopLoading callback that the
530 // AutomationProvider (used by the UI tests) expects to consider a navigation
531 // as complete. Without this, navigating in a UI test to a URL that triggers
532 // an interstitial would hang.
533 web_contents_was_loading_ = controller_->delegate()->IsLoading();
534 controller_->delegate()->SetIsLoading(false, true, NULL);
535 } 526 }
536 527
537 RendererPreferences InterstitialPageImpl::GetRendererPrefs( 528 RendererPreferences InterstitialPageImpl::GetRendererPrefs(
538 BrowserContext* browser_context) const { 529 BrowserContext* browser_context) const {
539 delegate_->OverrideRendererPrefs(&renderer_preferences_); 530 delegate_->OverrideRendererPrefs(&renderer_preferences_);
540 return renderer_preferences_; 531 return renderer_preferences_;
541 } 532 }
542 533
543 void InterstitialPageImpl::RenderWidgetDeleted( 534 void InterstitialPageImpl::RenderWidgetDeleted(
544 RenderWidgetHostImpl* render_widget_host) { 535 RenderWidgetHostImpl* render_widget_host) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 if (!render_view_host_) 624 if (!render_view_host_)
634 return; 625 return;
635 626
636 if (action_taken_ != NO_ACTION) { 627 if (action_taken_ != NO_ACTION) {
637 NOTREACHED(); 628 NOTREACHED();
638 return; 629 return;
639 } 630 }
640 Disable(); 631 Disable();
641 action_taken_ = PROCEED_ACTION; 632 action_taken_ = PROCEED_ACTION;
642 633
643 // Resumes the throbber, if applicable. 634 controller_->delegate()->DidProceedOnInterstitial();
644 if (web_contents_was_loading_)
645 controller_->delegate()->SetIsLoading(true, true, NULL);
646 635
647 // If this is a new navigation, the old page is going away, so we cancel any 636 // If this is a new navigation, the old page is going away, so we cancel any
648 // blocked requests for it. If it is not a new navigation, then it means the 637 // blocked requests for it. If it is not a new navigation, then it means the
649 // interstitial was shown as a result of a resource loading in the page. 638 // interstitial was shown as a result of a resource loading in the page.
650 // Since the user wants to proceed, we'll let any blocked request go through. 639 // Since the user wants to proceed, we'll let any blocked request go through.
651 if (new_navigation_) 640 if (new_navigation_)
652 TakeActionOnResourceDispatcher(CANCEL); 641 TakeActionOnResourceDispatcher(CANCEL);
653 else 642 else
654 TakeActionOnResourceDispatcher(RESUME); 643 TakeActionOnResourceDispatcher(RESUME);
655 644
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( 930 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted(
942 const LoadCommittedDetails& load_details) { 931 const LoadCommittedDetails& load_details) {
943 interstitial_->OnNavigatingAwayOrTabClosing(); 932 interstitial_->OnNavigatingAwayOrTabClosing();
944 } 933 }
945 934
946 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { 935 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() {
947 interstitial_->OnNavigatingAwayOrTabClosing(); 936 interstitial_->OnNavigatingAwayOrTabClosing();
948 } 937 }
949 938
950 } // namespace content 939 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698