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 16 matching lines...) Expand all Loading... |
27 #include "content/browser/renderer_host/render_process_host_impl.h" | 27 #include "content/browser/renderer_host/render_process_host_impl.h" |
28 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 28 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
29 #include "content/browser/renderer_host/render_view_host_factory.h" | 29 #include "content/browser/renderer_host/render_view_host_factory.h" |
30 #include "content/browser/renderer_host/render_view_host_impl.h" | 30 #include "content/browser/renderer_host/render_view_host_impl.h" |
31 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 31 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
32 #include "content/browser/site_instance_impl.h" | 32 #include "content/browser/site_instance_impl.h" |
33 #include "content/browser/web_contents/web_contents_impl.h" | 33 #include "content/browser/web_contents/web_contents_impl.h" |
34 #include "content/browser/web_contents/web_contents_view.h" | 34 #include "content/browser/web_contents/web_contents_view.h" |
35 #include "content/common/frame_messages.h" | 35 #include "content/common/frame_messages.h" |
36 #include "content/common/input_messages.h" | 36 #include "content/common/input_messages.h" |
37 #include "content/common/text_input_state.h" | |
38 #include "content/common/view_messages.h" | 37 #include "content/common/view_messages.h" |
39 #include "content/public/browser/browser_context.h" | 38 #include "content/public/browser/browser_context.h" |
40 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
41 #include "content/public/browser/content_browser_client.h" | 40 #include "content/public/browser/content_browser_client.h" |
42 #include "content/public/browser/interstitial_page_delegate.h" | 41 #include "content/public/browser/interstitial_page_delegate.h" |
43 #include "content/public/browser/invalidate_type.h" | 42 #include "content/public/browser/invalidate_type.h" |
44 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
45 #include "content/public/browser/notification_source.h" | 44 #include "content/public/browser/notification_source.h" |
46 #include "content/public/browser/storage_partition.h" | 45 #include "content/public/browser/storage_partition.h" |
47 #include "content/public/browser/user_metrics.h" | 46 #include "content/public/browser/user_metrics.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 this, | 165 this, |
167 static_cast<WebContentsImpl*>(web_contents)), | 166 static_cast<WebContentsImpl*>(web_contents)), |
168 original_child_id_(web_contents->GetRenderProcessHost()->GetID()), | 167 original_child_id_(web_contents->GetRenderProcessHost()->GetID()), |
169 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()), | 168 original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()), |
170 should_revert_web_contents_title_(false), | 169 should_revert_web_contents_title_(false), |
171 resource_dispatcher_host_notified_(false), | 170 resource_dispatcher_host_notified_(false), |
172 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)), | 171 rvh_delegate_view_(new InterstitialPageRVHDelegateView(this)), |
173 create_view_(true), | 172 create_view_(true), |
174 pause_throbber_(false), | 173 pause_throbber_(false), |
175 delegate_(delegate), | 174 delegate_(delegate), |
176 text_input_state_(new TextInputState()), | |
177 weak_ptr_factory_(this) { | 175 weak_ptr_factory_(this) { |
178 InitInterstitialPageMap(); | 176 InitInterstitialPageMap(); |
179 } | 177 } |
180 | 178 |
181 InterstitialPageImpl::~InterstitialPageImpl() { | 179 InterstitialPageImpl::~InterstitialPageImpl() { |
182 } | 180 } |
183 | 181 |
184 void InterstitialPageImpl::Show() { | 182 void InterstitialPageImpl::Show() { |
185 if (!enabled()) | 183 if (!enabled()) |
186 return; | 184 return; |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 delegate_->OverrideRendererPrefs(&renderer_preferences_); | 531 delegate_->OverrideRendererPrefs(&renderer_preferences_); |
534 return renderer_preferences_; | 532 return renderer_preferences_; |
535 } | 533 } |
536 | 534 |
537 void InterstitialPageImpl::RenderWidgetDeleted( | 535 void InterstitialPageImpl::RenderWidgetDeleted( |
538 RenderWidgetHostImpl* render_widget_host) { | 536 RenderWidgetHostImpl* render_widget_host) { |
539 // TODO(creis): Remove this method once we verify the shutdown path is sane. | 537 // TODO(creis): Remove this method once we verify the shutdown path is sane. |
540 CHECK(!web_contents_); | 538 CHECK(!web_contents_); |
541 } | 539 } |
542 | 540 |
543 const TextInputState* InterstitialPageImpl::GetTextInputState() { | |
544 return text_input_state_.get(); | |
545 } | |
546 | |
547 void InterstitialPageImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, | |
548 bool text_input_state_changed) { | |
549 if (web_contents_) { | |
550 WebContentsImpl* contents = static_cast<WebContentsImpl*>(web_contents_); | |
551 contents->UpdateTextInputState(rwhv, text_input_state_changed); | |
552 *text_input_state_ = *contents->GetTextInputState(); | |
553 } | |
554 } | |
555 | |
556 bool InterstitialPageImpl::PreHandleKeyboardEvent( | 541 bool InterstitialPageImpl::PreHandleKeyboardEvent( |
557 const NativeWebKeyboardEvent& event, | 542 const NativeWebKeyboardEvent& event, |
558 bool* is_keyboard_shortcut) { | 543 bool* is_keyboard_shortcut) { |
559 if (!enabled()) | 544 if (!enabled()) |
560 return false; | 545 return false; |
561 return render_widget_host_delegate_->PreHandleKeyboardEvent( | 546 return render_widget_host_delegate_->PreHandleKeyboardEvent( |
562 event, is_keyboard_shortcut); | 547 event, is_keyboard_shortcut); |
563 } | 548 } |
564 | 549 |
565 void InterstitialPageImpl::HandleKeyboardEvent( | 550 void InterstitialPageImpl::HandleKeyboardEvent( |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( | 925 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( |
941 const LoadCommittedDetails& load_details) { | 926 const LoadCommittedDetails& load_details) { |
942 interstitial_->OnNavigatingAwayOrTabClosing(); | 927 interstitial_->OnNavigatingAwayOrTabClosing(); |
943 } | 928 } |
944 | 929 |
945 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { | 930 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { |
946 interstitial_->OnNavigatingAwayOrTabClosing(); | 931 interstitial_->OnNavigatingAwayOrTabClosing(); |
947 } | 932 } |
948 | 933 |
949 } // namespace content | 934 } // namespace content |
OLD | NEW |