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