| OLD | NEW |
| 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/interstitial_page_impl.h" | 5 #include "content/browser/web_contents/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/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 17 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 17 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 18 #include "content/browser/renderer_host/render_process_host_impl.h" | 18 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_view_host_factory.h" | 19 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 20 #include "content/browser/renderer_host/render_view_host_impl.h" | 20 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 21 #include "content/browser/site_instance_impl.h" | 21 #include "content/browser/site_instance_impl.h" |
| 22 #include "content/browser/web_contents/navigation_controller_impl.h" | 22 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 23 #include "content/browser/web_contents/navigation_entry_impl.h" | 23 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 24 #include "content/browser/web_contents/web_contents_impl.h" | |
| 25 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
| 26 #include "content/port/browser/render_view_host_delegate_view.h" | 25 #include "content/port/browser/render_view_host_delegate_view.h" |
| 27 #include "content/port/browser/render_widget_host_view_port.h" | 26 #include "content/port/browser/render_widget_host_view_port.h" |
| 28 #include "content/port/browser/web_contents_view_port.h" | 27 #include "content/port/browser/web_contents_view_port.h" |
| 29 #include "content/public/browser/browser_context.h" | 28 #include "content/public/browser/browser_context.h" |
| 30 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/content_browser_client.h" | 30 #include "content/public/browser/content_browser_client.h" |
| 32 #include "content/public/browser/dom_operation_notification_details.h" | 31 #include "content/public/browser/dom_operation_notification_details.h" |
| 33 #include "content/public/browser/interstitial_page_delegate.h" | 32 #include "content/public/browser/interstitial_page_delegate.h" |
| 34 #include "content/public/browser/invalidate_type.h" | 33 #include "content/public/browser/invalidate_type.h" |
| 35 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 36 #include "content/public/browser/notification_source.h" | 35 #include "content/public/browser/notification_source.h" |
| 37 #include "content/public/browser/storage_partition.h" | 36 #include "content/public/browser/storage_partition.h" |
| 37 #include "content/public/browser/web_contents.h" |
| 38 #include "content/public/browser/web_contents_delegate.h" | 38 #include "content/public/browser/web_contents_delegate.h" |
| 39 #include "content/public/common/bindings_policy.h" | 39 #include "content/public/common/bindings_policy.h" |
| 40 #include "content/public/common/page_transition_types.h" | 40 #include "content/public/common/page_transition_types.h" |
| 41 #include "net/base/escape.h" | 41 #include "net/base/escape.h" |
| 42 #include "net/url_request/url_request_context_getter.h" | 42 #include "net/url_request/url_request_context_getter.h" |
| 43 | 43 |
| 44 using WebKit::WebDragOperation; | 44 using WebKit::WebDragOperation; |
| 45 using WebKit::WebDragOperationsMask; | 45 using WebKit::WebDragOperationsMask; |
| 46 | 46 |
| 47 namespace content { | 47 namespace content { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 typedef std::map<WebContents*, InterstitialPageImpl*> InterstitialPageMap; | 107 typedef std::map<WebContents*, InterstitialPageImpl*> InterstitialPageMap; |
| 108 static InterstitialPageMap* g_web_contents_to_interstitial_page; | 108 static InterstitialPageMap* g_web_contents_to_interstitial_page; |
| 109 | 109 |
| 110 // Initializes g_web_contents_to_interstitial_page in a thread-safe manner. | 110 // Initializes g_web_contents_to_interstitial_page in a thread-safe manner. |
| 111 // Should be called before accessing g_web_contents_to_interstitial_page. | 111 // Should be called before accessing g_web_contents_to_interstitial_page. |
| 112 static void InitInterstitialPageMap() { | 112 static void InitInterstitialPageMap() { |
| 113 if (!g_web_contents_to_interstitial_page) | 113 if (!g_web_contents_to_interstitial_page) |
| 114 g_web_contents_to_interstitial_page = new InterstitialPageMap; | 114 g_web_contents_to_interstitial_page = new InterstitialPageMap; |
| 115 } | 115 } |
| 116 | 116 |
| 117 InterstitialPage* InterstitialPage::Create(WebContents* web_contents, | |
| 118 bool new_navigation, | |
| 119 const GURL& url, | |
| 120 InterstitialPageDelegate* delegate) { | |
| 121 return new InterstitialPageImpl( | |
| 122 web_contents, | |
| 123 static_cast<RenderWidgetHostDelegate*>( | |
| 124 static_cast<WebContentsImpl*>(web_contents)), | |
| 125 new_navigation, url, delegate); | |
| 126 } | |
| 127 | |
| 128 InterstitialPage* InterstitialPage::GetInterstitialPage( | 117 InterstitialPage* InterstitialPage::GetInterstitialPage( |
| 129 WebContents* web_contents) { | 118 WebContents* web_contents) { |
| 130 InitInterstitialPageMap(); | 119 InitInterstitialPageMap(); |
| 131 InterstitialPageMap::const_iterator iter = | 120 InterstitialPageMap::const_iterator iter = |
| 132 g_web_contents_to_interstitial_page->find(web_contents); | 121 g_web_contents_to_interstitial_page->find(web_contents); |
| 133 if (iter == g_web_contents_to_interstitial_page->end()) | 122 if (iter == g_web_contents_to_interstitial_page->end()) |
| 134 return NULL; | 123 return NULL; |
| 135 | 124 |
| 136 return iter->second; | 125 return iter->second; |
| 137 } | 126 } |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 void InterstitialPageImpl::InterstitialPageRVHDelegateView::GotFocus() { | 809 void InterstitialPageImpl::InterstitialPageRVHDelegateView::GotFocus() { |
| 821 WebContents* web_contents = interstitial_page_->web_contents(); | 810 WebContents* web_contents = interstitial_page_->web_contents(); |
| 822 if (web_contents && web_contents->GetDelegate()) | 811 if (web_contents && web_contents->GetDelegate()) |
| 823 web_contents->GetDelegate()->WebContentsFocused(web_contents); | 812 web_contents->GetDelegate()->WebContentsFocused(web_contents); |
| 824 } | 813 } |
| 825 | 814 |
| 826 void InterstitialPageImpl::InterstitialPageRVHDelegateView::TakeFocus( | 815 void InterstitialPageImpl::InterstitialPageRVHDelegateView::TakeFocus( |
| 827 bool reverse) { | 816 bool reverse) { |
| 828 if (!interstitial_page_->web_contents()) | 817 if (!interstitial_page_->web_contents()) |
| 829 return; | 818 return; |
| 830 WebContentsImpl* web_contents = | |
| 831 static_cast<WebContentsImpl*>(interstitial_page_->web_contents()); | |
| 832 if (!web_contents->GetDelegateView()) | |
| 833 return; | |
| 834 | 819 |
| 835 web_contents->GetDelegateView()->TakeFocus(reverse); | 820 RenderViewHostDelegateView* view = |
| 821 interstitial_page_->GetDelegateView(); |
| 822 |
| 823 if (view) |
| 824 view->TakeFocus(reverse); |
| 836 } | 825 } |
| 837 | 826 |
| 838 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( | 827 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( |
| 839 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 828 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 840 int active_match_ordinal, bool final_update) { | 829 int active_match_ordinal, bool final_update) { |
| 841 } | 830 } |
| 842 | 831 |
| 843 } // namespace content | 832 } // namespace content |
| OLD | NEW |