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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/macros.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "build/build_config.h" |
17 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 19 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
18 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 20 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
19 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" | 21 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" |
20 #include "content/browser/frame_host/navigation_controller_impl.h" | 22 #include "content/browser/frame_host/navigation_controller_impl.h" |
21 #include "content/browser/frame_host/navigation_entry_impl.h" | 23 #include "content/browser/frame_host/navigation_entry_impl.h" |
22 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 24 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
23 #include "content/browser/renderer_host/render_process_host_impl.h" | 25 #include "content/browser/renderer_host/render_process_host_impl.h" |
24 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 26 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
25 #include "content/browser/renderer_host/render_view_host_factory.h" | 27 #include "content/browser/renderer_host/render_view_host_factory.h" |
26 #include "content/browser/renderer_host/render_view_host_impl.h" | 28 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 void InterstitialPageImpl::RenderFrameCreated( | 385 void InterstitialPageImpl::RenderFrameCreated( |
384 RenderFrameHost* render_frame_host) { | 386 RenderFrameHost* render_frame_host) { |
385 // Note this is only for subframes in the interstitial, the notification for | 387 // Note this is only for subframes in the interstitial, the notification for |
386 // the main frame happens in RenderViewCreated. | 388 // the main frame happens in RenderViewCreated. |
387 controller_->delegate()->RenderFrameForInterstitialPageCreated( | 389 controller_->delegate()->RenderFrameForInterstitialPageCreated( |
388 render_frame_host); | 390 render_frame_host); |
389 } | 391 } |
390 | 392 |
391 void InterstitialPageImpl::UpdateTitle( | 393 void InterstitialPageImpl::UpdateTitle( |
392 RenderFrameHost* render_frame_host, | 394 RenderFrameHost* render_frame_host, |
393 int32 page_id, | 395 int32_t page_id, |
394 const base::string16& title, | 396 const base::string16& title, |
395 base::i18n::TextDirection title_direction) { | 397 base::i18n::TextDirection title_direction) { |
396 if (!enabled()) | 398 if (!enabled()) |
397 return; | 399 return; |
398 | 400 |
399 RenderViewHost* render_view_host = render_frame_host->GetRenderViewHost(); | 401 RenderViewHost* render_view_host = render_frame_host->GetRenderViewHost(); |
400 DCHECK(render_view_host == render_view_host_); | 402 DCHECK(render_view_host == render_view_host_); |
401 NavigationEntry* entry = controller_->GetVisibleEntry(); | 403 NavigationEntry* entry = controller_->GetVisibleEntry(); |
402 if (!entry) { | 404 if (!entry) { |
403 // There may be no visible entry if no URL has committed (e.g., after | 405 // There may be no visible entry if no URL has committed (e.g., after |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 WebContentsView* InterstitialPageImpl::CreateWebContentsView() { | 604 WebContentsView* InterstitialPageImpl::CreateWebContentsView() { |
603 if (!enabled() || !create_view_) | 605 if (!enabled() || !create_view_) |
604 return NULL; | 606 return NULL; |
605 WebContentsView* wcv = | 607 WebContentsView* wcv = |
606 static_cast<WebContentsImpl*>(web_contents())->GetView(); | 608 static_cast<WebContentsImpl*>(web_contents())->GetView(); |
607 RenderWidgetHostViewBase* view = | 609 RenderWidgetHostViewBase* view = |
608 wcv->CreateViewForWidget(render_view_host_->GetWidget(), false); | 610 wcv->CreateViewForWidget(render_view_host_->GetWidget(), false); |
609 RenderWidgetHostImpl::From(render_view_host_->GetWidget())->SetView(view); | 611 RenderWidgetHostImpl::From(render_view_host_->GetWidget())->SetView(view); |
610 render_view_host_->AllowBindings(BINDINGS_POLICY_DOM_AUTOMATION); | 612 render_view_host_->AllowBindings(BINDINGS_POLICY_DOM_AUTOMATION); |
611 | 613 |
612 int32 max_page_id = web_contents()-> | 614 int32_t max_page_id = web_contents()->GetMaxPageIDForSiteInstance( |
613 GetMaxPageIDForSiteInstance(render_view_host_->GetSiteInstance()); | 615 render_view_host_->GetSiteInstance()); |
614 render_view_host_->CreateRenderView(MSG_ROUTING_NONE, | 616 render_view_host_->CreateRenderView(MSG_ROUTING_NONE, |
615 MSG_ROUTING_NONE, | 617 MSG_ROUTING_NONE, |
616 max_page_id, | 618 max_page_id, |
617 FrameReplicationState(), | 619 FrameReplicationState(), |
618 false); | 620 false); |
619 controller_->delegate()->RenderFrameForInterstitialPageCreated( | 621 controller_->delegate()->RenderFrameForInterstitialPageCreated( |
620 frame_tree_.root()->current_frame_host()); | 622 frame_tree_.root()->current_frame_host()); |
621 view->SetSize(web_contents()->GetContainerBounds().size()); | 623 view->SetSize(web_contents()->GetContainerBounds().size()); |
622 // Don't show the interstitial until we have navigated to it. | 624 // Don't show the interstitial until we have navigated to it. |
623 view->Hide(); | 625 view->Hide(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 void InterstitialPageImpl::CreateNewWindow( | 758 void InterstitialPageImpl::CreateNewWindow( |
757 SiteInstance* source_site_instance, | 759 SiteInstance* source_site_instance, |
758 int32_t route_id, | 760 int32_t route_id, |
759 int32_t main_frame_route_id, | 761 int32_t main_frame_route_id, |
760 int32_t main_frame_widget_route_id, | 762 int32_t main_frame_widget_route_id, |
761 const ViewHostMsg_CreateWindow_Params& params, | 763 const ViewHostMsg_CreateWindow_Params& params, |
762 SessionStorageNamespace* session_storage_namespace) { | 764 SessionStorageNamespace* session_storage_namespace) { |
763 NOTREACHED() << "InterstitialPage does not support showing popups yet."; | 765 NOTREACHED() << "InterstitialPage does not support showing popups yet."; |
764 } | 766 } |
765 | 767 |
766 void InterstitialPageImpl::CreateNewWidget(int32 render_process_id, | 768 void InterstitialPageImpl::CreateNewWidget(int32_t render_process_id, |
767 int32 route_id, | 769 int32_t route_id, |
768 blink::WebPopupType popup_type) { | 770 blink::WebPopupType popup_type) { |
769 NOTREACHED() << "InterstitialPage does not support showing drop-downs yet."; | 771 NOTREACHED() << "InterstitialPage does not support showing drop-downs yet."; |
770 } | 772 } |
771 | 773 |
772 void InterstitialPageImpl::CreateNewFullscreenWidget(int32 render_process_id, | 774 void InterstitialPageImpl::CreateNewFullscreenWidget(int32_t render_process_id, |
773 int32 route_id) { | 775 int32_t route_id) { |
774 NOTREACHED() | 776 NOTREACHED() |
775 << "InterstitialPage does not support showing full screen popups."; | 777 << "InterstitialPage does not support showing full screen popups."; |
776 } | 778 } |
777 | 779 |
778 void InterstitialPageImpl::ShowCreatedWindow(int route_id, | 780 void InterstitialPageImpl::ShowCreatedWindow(int route_id, |
779 WindowOpenDisposition disposition, | 781 WindowOpenDisposition disposition, |
780 const gfx::Rect& initial_rect, | 782 const gfx::Rect& initial_rect, |
781 bool user_gesture) { | 783 bool user_gesture) { |
782 NOTREACHED() << "InterstitialPage does not support showing popups yet."; | 784 NOTREACHED() << "InterstitialPage does not support showing popups yet."; |
783 } | 785 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( | 940 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( |
939 const LoadCommittedDetails& load_details) { | 941 const LoadCommittedDetails& load_details) { |
940 interstitial_->OnNavigatingAwayOrTabClosing(); | 942 interstitial_->OnNavigatingAwayOrTabClosing(); |
941 } | 943 } |
942 | 944 |
943 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { | 945 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { |
944 interstitial_->OnNavigatingAwayOrTabClosing(); | 946 interstitial_->OnNavigatingAwayOrTabClosing(); |
945 } | 947 } |
946 | 948 |
947 } // namespace content | 949 } // namespace content |
OLD | NEW |