| OLD | NEW |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 WebContents* web_contents) { | 141 WebContents* web_contents) { |
| 142 InitInterstitialPageMap(); | 142 InitInterstitialPageMap(); |
| 143 InterstitialPageMap::const_iterator iter = | 143 InterstitialPageMap::const_iterator iter = |
| 144 g_web_contents_to_interstitial_page->find(web_contents); | 144 g_web_contents_to_interstitial_page->find(web_contents); |
| 145 if (iter == g_web_contents_to_interstitial_page->end()) | 145 if (iter == g_web_contents_to_interstitial_page->end()) |
| 146 return NULL; | 146 return NULL; |
| 147 | 147 |
| 148 return iter->second; | 148 return iter->second; |
| 149 } | 149 } |
| 150 | 150 |
| 151 InterstitialPage* InterstitialPage::FromRenderFrameHost(RenderFrameHost* rfh) { |
| 152 if (!rfh) |
| 153 return nullptr; |
| 154 return static_cast<RenderFrameHostImpl*>(rfh) |
| 155 ->delegate() |
| 156 ->GetAsInterstitialPage(); |
| 157 } |
| 158 |
| 151 InterstitialPageImpl::InterstitialPageImpl( | 159 InterstitialPageImpl::InterstitialPageImpl( |
| 152 WebContents* web_contents, | 160 WebContents* web_contents, |
| 153 RenderWidgetHostDelegate* render_widget_host_delegate, | 161 RenderWidgetHostDelegate* render_widget_host_delegate, |
| 154 bool new_navigation, | 162 bool new_navigation, |
| 155 const GURL& url, | 163 const GURL& url, |
| 156 InterstitialPageDelegate* delegate) | 164 InterstitialPageDelegate* delegate) |
| 157 : underlying_content_observer_(web_contents, this), | 165 : underlying_content_observer_(web_contents, this), |
| 158 web_contents_(web_contents), | 166 web_contents_(web_contents), |
| 159 controller_(static_cast<NavigationControllerImpl*>( | 167 controller_(static_cast<NavigationControllerImpl*>( |
| 160 &web_contents->GetController())), | 168 &web_contents->GetController())), |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 if (!new_navigation_ && !should_revert_web_contents_title_) { | 425 if (!new_navigation_ && !should_revert_web_contents_title_) { |
| 418 original_web_contents_title_ = entry->GetTitle(); | 426 original_web_contents_title_ = entry->GetTitle(); |
| 419 should_revert_web_contents_title_ = true; | 427 should_revert_web_contents_title_ = true; |
| 420 } | 428 } |
| 421 // TODO(evan): make use of title_direction. | 429 // TODO(evan): make use of title_direction. |
| 422 // http://code.google.com/p/chromium/issues/detail?id=27094 | 430 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 423 entry->SetTitle(title); | 431 entry->SetTitle(title); |
| 424 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); | 432 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); |
| 425 } | 433 } |
| 426 | 434 |
| 435 InterstitialPage* InterstitialPageImpl::GetAsInterstitialPage() { |
| 436 return this; |
| 437 } |
| 438 |
| 427 AccessibilityMode InterstitialPageImpl::GetAccessibilityMode() const { | 439 AccessibilityMode InterstitialPageImpl::GetAccessibilityMode() const { |
| 428 if (web_contents_) | 440 if (web_contents_) |
| 429 return static_cast<WebContentsImpl*>(web_contents_)->GetAccessibilityMode(); | 441 return static_cast<WebContentsImpl*>(web_contents_)->GetAccessibilityMode(); |
| 430 else | 442 else |
| 431 return AccessibilityModeOff; | 443 return AccessibilityModeOff; |
| 432 } | 444 } |
| 433 | 445 |
| 434 void InterstitialPageImpl::Cut() { | 446 void InterstitialPageImpl::Cut() { |
| 435 FrameTreeNode* focused_node = frame_tree_.GetFocusedFrame(); | 447 FrameTreeNode* focused_node = frame_tree_.GetFocusedFrame(); |
| 436 if (!focused_node) | 448 if (!focused_node) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 480 |
| 469 focused_node->current_frame_host()->Send(new InputMsg_SelectAll( | 481 focused_node->current_frame_host()->Send(new InputMsg_SelectAll( |
| 470 focused_node->current_frame_host()->GetRoutingID())); | 482 focused_node->current_frame_host()->GetRoutingID())); |
| 471 RecordAction(base::UserMetricsAction("SelectAll")); | 483 RecordAction(base::UserMetricsAction("SelectAll")); |
| 472 } | 484 } |
| 473 | 485 |
| 474 RenderViewHostDelegateView* InterstitialPageImpl::GetDelegateView() { | 486 RenderViewHostDelegateView* InterstitialPageImpl::GetDelegateView() { |
| 475 return rvh_delegate_view_.get(); | 487 return rvh_delegate_view_.get(); |
| 476 } | 488 } |
| 477 | 489 |
| 490 WebContents* InterstitialPageImpl::GetWebContents() const { |
| 491 return web_contents(); |
| 492 } |
| 493 |
| 478 const GURL& InterstitialPageImpl::GetMainFrameLastCommittedURL() const { | 494 const GURL& InterstitialPageImpl::GetMainFrameLastCommittedURL() const { |
| 479 return url_; | 495 return url_; |
| 480 } | 496 } |
| 481 | 497 |
| 482 void InterstitialPageImpl::RenderViewTerminated( | 498 void InterstitialPageImpl::RenderViewTerminated( |
| 483 RenderViewHost* render_view_host, | 499 RenderViewHost* render_view_host, |
| 484 base::TerminationStatus status, | 500 base::TerminationStatus status, |
| 485 int error_code) { | 501 int error_code) { |
| 486 // Our renderer died. This should not happen in normal cases. | 502 // Our renderer died. This should not happen in normal cases. |
| 487 // If we haven't already started shutdown, just dismiss the interstitial. | 503 // If we haven't already started shutdown, just dismiss the interstitial. |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( | 957 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( |
| 942 const LoadCommittedDetails& load_details) { | 958 const LoadCommittedDetails& load_details) { |
| 943 interstitial_->OnNavigatingAwayOrTabClosing(); | 959 interstitial_->OnNavigatingAwayOrTabClosing(); |
| 944 } | 960 } |
| 945 | 961 |
| 946 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { | 962 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { |
| 947 interstitial_->OnNavigatingAwayOrTabClosing(); | 963 interstitial_->OnNavigatingAwayOrTabClosing(); |
| 948 } | 964 } |
| 949 | 965 |
| 950 } // namespace content | 966 } // namespace content |
| OLD | NEW |