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/tab_contents/interstitial_page.h" | 5 #include "content/browser/tab_contents/interstitial_page.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.h" | 11 #include "base/message_loop.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "content/browser/renderer_host/render_process_host_impl.h" | 15 #include "content/browser/renderer_host/render_process_host_impl.h" |
16 #include "content/browser/renderer_host/render_view_host.h" | 16 #include "content/browser/renderer_host/render_view_host.h" |
17 #include "content/browser/renderer_host/render_widget_host_view.h" | 17 #include "content/browser/renderer_host/render_widget_host_view.h" |
18 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 18 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
19 #include "content/browser/site_instance_impl.h" | 19 #include "content/browser/site_instance_impl.h" |
20 #include "content/browser/tab_contents/navigation_controller_impl.h" | 20 #include "content/browser/tab_contents/navigation_controller_impl.h" |
21 #include "content/browser/tab_contents/navigation_entry_impl.h" | 21 #include "content/browser/tab_contents/navigation_entry_impl.h" |
22 #include "content/browser/tab_contents/tab_contents.h" | 22 #include "content/browser/tab_contents/tab_contents.h" |
23 #include "content/common/dom_storage_common.h" | 23 #include "content/common/dom_storage_common.h" |
24 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/dom_operation_notification_details.h" | 26 #include "content/public/browser/dom_operation_notification_details.h" |
| 27 #include "content/public/browser/interstitial_page_delegate.h" |
27 #include "content/public/browser/invalidate_type.h" | 28 #include "content/public/browser/invalidate_type.h" |
28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_source.h" | 30 #include "content/public/browser/notification_source.h" |
30 #include "content/public/browser/web_contents_view.h" | 31 #include "content/public/browser/web_contents_view.h" |
31 #include "content/public/common/bindings_policy.h" | 32 #include "content/public/common/bindings_policy.h" |
32 #include "content/public/common/page_transition_types.h" | 33 #include "content/public/common/page_transition_types.h" |
33 #include "content/public/common/view_type.h" | 34 #include "content/public/common/view_type.h" |
34 #include "net/base/escape.h" | 35 #include "net/base/escape.h" |
35 #include "net/url_request/url_request_context_getter.h" | 36 #include "net/url_request/url_request_context_getter.h" |
36 | 37 |
37 using content::BrowserThread; | 38 using content::BrowserThread; |
38 using content::DomOperationNotificationDetails; | 39 using content::DomOperationNotificationDetails; |
| 40 using content::InterstitialPageDelegate; |
39 using content::NavigationController; | 41 using content::NavigationController; |
40 using content::NavigationEntry; | 42 using content::NavigationEntry; |
41 using content::NavigationEntryImpl; | 43 using content::NavigationEntryImpl; |
42 using content::RenderViewHostDelegate; | 44 using content::RenderViewHostDelegate; |
43 using content::SiteInstance; | 45 using content::SiteInstance; |
44 using content::WebContents; | 46 using content::WebContents; |
45 using content::WebContentsView; | 47 using content::WebContentsView; |
46 using WebKit::WebDragOperation; | 48 using WebKit::WebDragOperation; |
47 using WebKit::WebDragOperationsMask; | 49 using WebKit::WebDragOperationsMask; |
48 | 50 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 const gfx::Rect& selection_rect, | 112 const gfx::Rect& selection_rect, |
111 int active_match_ordinal, | 113 int active_match_ordinal, |
112 bool final_update); | 114 bool final_update); |
113 | 115 |
114 private: | 116 private: |
115 InterstitialPage* interstitial_page_; | 117 InterstitialPage* interstitial_page_; |
116 | 118 |
117 DISALLOW_COPY_AND_ASSIGN(InterstitialPageRVHViewDelegate); | 119 DISALLOW_COPY_AND_ASSIGN(InterstitialPageRVHViewDelegate); |
118 }; | 120 }; |
119 | 121 |
| 122 InterstitialPage* InterstitialPage::Create(WebContents* tab, |
| 123 bool new_navigation, |
| 124 const GURL& url, |
| 125 InterstitialPageDelegate* delegate) { |
| 126 return new InterstitialPage(tab, new_navigation, url, delegate); |
| 127 } |
| 128 |
120 // static | 129 // static |
121 InterstitialPage::InterstitialPageMap* | 130 InterstitialPage::InterstitialPageMap* |
122 InterstitialPage::tab_to_interstitial_page_ = NULL; | 131 InterstitialPage::tab_to_interstitial_page_ = NULL; |
123 | 132 |
124 InterstitialPage::InterstitialPage(WebContents* tab, | 133 InterstitialPage::InterstitialPage(WebContents* tab, |
125 bool new_navigation, | 134 bool new_navigation, |
126 const GURL& url) | 135 const GURL& url, |
| 136 InterstitialPageDelegate* delegate) |
127 : tab_(static_cast<TabContents*>(tab)), | 137 : tab_(static_cast<TabContents*>(tab)), |
128 url_(url), | 138 url_(url), |
129 new_navigation_(new_navigation), | 139 new_navigation_(new_navigation), |
130 should_discard_pending_nav_entry_(new_navigation), | 140 should_discard_pending_nav_entry_(new_navigation), |
131 reload_on_dont_proceed_(false), | 141 reload_on_dont_proceed_(false), |
132 enabled_(true), | 142 enabled_(true), |
133 action_taken_(NO_ACTION), | 143 action_taken_(NO_ACTION), |
134 render_view_host_(NULL), | 144 render_view_host_(NULL), |
135 original_child_id_(tab->GetRenderProcessHost()->GetID()), | 145 original_child_id_(tab->GetRenderProcessHost()->GetID()), |
136 original_rvh_id_(tab->GetRenderViewHost()->routing_id()), | 146 original_rvh_id_(tab->GetRenderViewHost()->routing_id()), |
137 should_revert_tab_title_(false), | 147 should_revert_tab_title_(false), |
138 tab_was_loading_(false), | 148 tab_was_loading_(false), |
139 resource_dispatcher_host_notified_(false), | 149 resource_dispatcher_host_notified_(false), |
140 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( | 150 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( |
141 new InterstitialPageRVHViewDelegate(this))) { | 151 new InterstitialPageRVHViewDelegate(this))), |
| 152 create_view_(true), |
| 153 delegate_(delegate) { |
142 InitInterstitialPageMap(); | 154 InitInterstitialPageMap(); |
143 // It would be inconsistent to create an interstitial with no new navigation | 155 // It would be inconsistent to create an interstitial with no new navigation |
144 // (which is the case when the interstitial was triggered by a sub-resource on | 156 // (which is the case when the interstitial was triggered by a sub-resource on |
145 // a page) when we have a pending entry (in the process of loading a new top | 157 // a page) when we have a pending entry (in the process of loading a new top |
146 // frame). | 158 // frame). |
147 DCHECK(new_navigation || !tab->GetController().GetPendingEntry()); | 159 DCHECK(new_navigation || !tab->GetController().GetPendingEntry()); |
148 } | 160 } |
149 | 161 |
150 InterstitialPage::~InterstitialPage() { | 162 InterstitialPage::~InterstitialPage() { |
151 InterstitialPageMap::iterator iter = tab_to_interstitial_page_->find(tab_); | |
152 DCHECK(iter != tab_to_interstitial_page_->end()); | |
153 if (iter != tab_to_interstitial_page_->end()) | |
154 tab_to_interstitial_page_->erase(iter); | |
155 DCHECK(!render_view_host_); | |
156 } | 163 } |
157 | 164 |
158 void InterstitialPage::Show() { | 165 void InterstitialPage::Show() { |
159 // If an interstitial is already showing or about to be shown, close it before | 166 // If an interstitial is already showing or about to be shown, close it before |
160 // showing the new one. | 167 // showing the new one. |
161 // Be careful not to take an action on the old interstitial more than once. | 168 // Be careful not to take an action on the old interstitial more than once. |
162 InterstitialPageMap::const_iterator iter = | 169 InterstitialPageMap::const_iterator iter = |
163 tab_to_interstitial_page_->find(tab_); | 170 tab_to_interstitial_page_->find(tab_); |
164 if (iter != tab_to_interstitial_page_->end()) { | 171 if (iter != tab_to_interstitial_page_->end()) { |
165 InterstitialPage* interstitial = iter->second; | 172 InterstitialPage* interstitial = iter->second; |
(...skipping 26 matching lines...) Expand all Loading... |
192 iter = tab_to_interstitial_page_->find(tab_); | 199 iter = tab_to_interstitial_page_->find(tab_); |
193 DCHECK(iter == tab_to_interstitial_page_->end()); | 200 DCHECK(iter == tab_to_interstitial_page_->end()); |
194 (*tab_to_interstitial_page_)[tab_] = this; | 201 (*tab_to_interstitial_page_)[tab_] = this; |
195 | 202 |
196 if (new_navigation_) { | 203 if (new_navigation_) { |
197 NavigationEntryImpl* entry = new NavigationEntryImpl; | 204 NavigationEntryImpl* entry = new NavigationEntryImpl; |
198 entry->SetURL(url_); | 205 entry->SetURL(url_); |
199 entry->SetVirtualURL(url_); | 206 entry->SetVirtualURL(url_); |
200 entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL); | 207 entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL); |
201 | 208 |
202 // Give sub-classes a chance to set some states on the navigation entry. | 209 // Give delegates a chance to set some states on the navigation entry. |
203 UpdateEntry(entry); | 210 delegate_->OverrideEntry(entry); |
204 | 211 |
205 tab_->GetControllerImpl().AddTransientEntry(entry); | 212 tab_->GetControllerImpl().AddTransientEntry(entry); |
206 } | 213 } |
207 | 214 |
208 DCHECK(!render_view_host_); | 215 DCHECK(!render_view_host_); |
209 render_view_host_ = CreateRenderViewHost(); | 216 render_view_host_ = CreateRenderViewHost(); |
210 CreateWebContentsView(); | 217 CreateWebContentsView(); |
211 | 218 |
212 std::string data_url = "data:text/html;charset=utf-8," + | 219 std::string data_url = "data:text/html;charset=utf-8," + |
213 net::EscapePath(GetHTMLContents()); | 220 net::EscapePath(delegate_->GetHTMLContents()); |
214 render_view_host_->NavigateToURL(GURL(data_url)); | 221 render_view_host_->NavigateToURL(GURL(data_url)); |
215 | 222 |
216 notification_registrar_.Add(this, | 223 notification_registrar_.Add(this, |
217 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 224 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
218 content::Source<WebContents>(tab_)); | 225 content::Source<WebContents>(tab_)); |
219 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 226 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
220 content::Source<NavigationController>(&tab_->GetController())); | 227 content::Source<NavigationController>(&tab_->GetController())); |
221 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 228 notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
222 content::Source<NavigationController>(&tab_->GetController())); | 229 content::Source<NavigationController>(&tab_->GetController())); |
223 notification_registrar_.Add( | 230 notification_registrar_.Add( |
(...skipping 29 matching lines...) Expand all Loading... |
253 if (!new_navigation_ && should_revert_tab_title_) { | 260 if (!new_navigation_ && should_revert_tab_title_) { |
254 entry->SetTitle(original_tab_title_); | 261 entry->SetTitle(original_tab_title_); |
255 tab_->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); | 262 tab_->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); |
256 } | 263 } |
257 | 264 |
258 content::NotificationService::current()->Notify( | 265 content::NotificationService::current()->Notify( |
259 content::NOTIFICATION_INTERSTITIAL_DETACHED, | 266 content::NOTIFICATION_INTERSTITIAL_DETACHED, |
260 content::Source<WebContents>(tab_), | 267 content::Source<WebContents>(tab_), |
261 content::NotificationService::NoDetails()); | 268 content::NotificationService::NoDetails()); |
262 | 269 |
263 delete this; | 270 InterstitialPageMap::iterator iter = tab_to_interstitial_page_->find(tab_); |
| 271 DCHECK(iter != tab_to_interstitial_page_->end()); |
| 272 if (iter != tab_to_interstitial_page_->end()) |
| 273 tab_to_interstitial_page_->erase(iter); |
264 } | 274 } |
265 | 275 |
266 void InterstitialPage::Observe(int type, | 276 void InterstitialPage::Observe(int type, |
267 const content::NotificationSource& source, | 277 const content::NotificationSource& source, |
268 const content::NotificationDetails& details) { | 278 const content::NotificationDetails& details) { |
269 switch (type) { | 279 switch (type) { |
270 case content::NOTIFICATION_NAV_ENTRY_PENDING: | 280 case content::NOTIFICATION_NAV_ENTRY_PENDING: |
271 // We are navigating away from the interstitial (the user has typed a URL | 281 // We are navigating away from the interstitial (the user has typed a URL |
272 // in the location bar or clicked a bookmark). Make sure clicking on the | 282 // in the location bar or clicked a bookmark). Make sure clicking on the |
273 // interstitial will have no effect. Also cancel any blocked requests | 283 // interstitial will have no effect. Also cancel any blocked requests |
(...skipping 22 matching lines...) Expand all Loading... |
296 if (action_taken_ == NO_ACTION) { | 306 if (action_taken_ == NO_ACTION) { |
297 // We are navigating away from the interstitial or closing a tab with an | 307 // We are navigating away from the interstitial or closing a tab with an |
298 // interstitial. Default to DontProceed(). We don't just call Hide as | 308 // interstitial. Default to DontProceed(). We don't just call Hide as |
299 // subclasses will almost certainly override DontProceed to do some work | 309 // subclasses will almost certainly override DontProceed to do some work |
300 // (ex: close pending connections). | 310 // (ex: close pending connections). |
301 DontProceed(); | 311 DontProceed(); |
302 } else { | 312 } else { |
303 // User decided to proceed and either the navigation was committed or | 313 // User decided to proceed and either the navigation was committed or |
304 // the tab was closed before that. | 314 // the tab was closed before that. |
305 Hide(); | 315 Hide(); |
306 // WARNING: we are now deleted! | 316 delete this; |
307 } | 317 } |
308 break; | 318 break; |
309 case content::NOTIFICATION_DOM_OPERATION_RESPONSE: | 319 case content::NOTIFICATION_DOM_OPERATION_RESPONSE: |
310 if (enabled()) { | 320 if (enabled()) { |
311 content::Details<DomOperationNotificationDetails> dom_op_details( | 321 content::Details<DomOperationNotificationDetails> dom_op_details( |
312 details); | 322 details); |
313 CommandReceived(dom_op_details->json); | 323 delegate_->CommandReceived(dom_op_details->json); |
314 } | 324 } |
315 break; | 325 break; |
316 default: | 326 default: |
317 NOTREACHED(); | 327 NOTREACHED(); |
318 } | 328 } |
319 } | 329 } |
320 | 330 |
321 RenderViewHostDelegate::View* InterstitialPage::GetViewDelegate() { | 331 RenderViewHostDelegate::View* InterstitialPage::GetViewDelegate() { |
322 return rvh_view_delegate_.get(); | 332 return rvh_view_delegate_.get(); |
323 } | 333 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 should_revert_tab_title_ = true; | 419 should_revert_tab_title_ = true; |
410 } | 420 } |
411 // TODO(evan): make use of title_direction. | 421 // TODO(evan): make use of title_direction. |
412 // http://code.google.com/p/chromium/issues/detail?id=27094 | 422 // http://code.google.com/p/chromium/issues/detail?id=27094 |
413 entry->SetTitle(title); | 423 entry->SetTitle(title); |
414 tab_->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); | 424 tab_->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); |
415 } | 425 } |
416 | 426 |
417 content::RendererPreferences InterstitialPage::GetRendererPrefs( | 427 content::RendererPreferences InterstitialPage::GetRendererPrefs( |
418 content::BrowserContext* browser_context) const { | 428 content::BrowserContext* browser_context) const { |
| 429 delegate_->OverrideRendererPrefs(&renderer_preferences_); |
419 return renderer_preferences_; | 430 return renderer_preferences_; |
420 } | 431 } |
421 | 432 |
422 WebPreferences InterstitialPage::GetWebkitPrefs() { | 433 WebPreferences InterstitialPage::GetWebkitPrefs() { |
423 return tab_->GetWebkitPrefs(render_view_host(), url_); | 434 return tab_->GetWebkitPrefs(render_view_host(), url_); |
424 } | 435 } |
425 | 436 |
426 bool InterstitialPage::PreHandleKeyboardEvent( | 437 bool InterstitialPage::PreHandleKeyboardEvent( |
427 const NativeWebKeyboardEvent& event, | 438 const NativeWebKeyboardEvent& event, |
428 bool* is_keyboard_shortcut) { | 439 bool* is_keyboard_shortcut) { |
(...skipping 10 matching lines...) Expand all Loading... |
439 } | 450 } |
440 | 451 |
441 RenderViewHost* InterstitialPage::CreateRenderViewHost() { | 452 RenderViewHost* InterstitialPage::CreateRenderViewHost() { |
442 RenderViewHost* render_view_host = new RenderViewHost( | 453 RenderViewHost* render_view_host = new RenderViewHost( |
443 SiteInstance::Create(tab()->GetBrowserContext()), | 454 SiteInstance::Create(tab()->GetBrowserContext()), |
444 this, MSG_ROUTING_NONE, kInvalidSessionStorageNamespaceId); | 455 this, MSG_ROUTING_NONE, kInvalidSessionStorageNamespaceId); |
445 return render_view_host; | 456 return render_view_host; |
446 } | 457 } |
447 | 458 |
448 WebContentsView* InterstitialPage::CreateWebContentsView() { | 459 WebContentsView* InterstitialPage::CreateWebContentsView() { |
| 460 if (!create_view_) |
| 461 return NULL; |
449 WebContentsView* web_contents_view = tab()->GetView(); | 462 WebContentsView* web_contents_view = tab()->GetView(); |
450 RenderWidgetHostView* view = | 463 RenderWidgetHostView* view = |
451 web_contents_view->CreateViewForWidget(render_view_host_); | 464 web_contents_view->CreateViewForWidget(render_view_host_); |
452 render_view_host_->SetView(view); | 465 render_view_host_->SetView(view); |
453 render_view_host_->AllowBindings(content::BINDINGS_POLICY_DOM_AUTOMATION); | 466 render_view_host_->AllowBindings(content::BINDINGS_POLICY_DOM_AUTOMATION); |
454 | 467 |
455 int32 max_page_id = | 468 int32 max_page_id = |
456 tab()->GetMaxPageIDForSiteInstance(render_view_host_->site_instance()); | 469 tab()->GetMaxPageIDForSiteInstance(render_view_host_->site_instance()); |
457 render_view_host_->CreateRenderView(string16(), max_page_id); | 470 render_view_host_->CreateRenderView(string16(), max_page_id); |
458 view->SetSize(web_contents_view->GetContainerSize()); | 471 view->SetSize(web_contents_view->GetContainerSize()); |
(...skipping 20 matching lines...) Expand all Loading... |
479 // Since the user wants to proceed, we'll let any blocked request go through. | 492 // Since the user wants to proceed, we'll let any blocked request go through. |
480 if (new_navigation_) | 493 if (new_navigation_) |
481 TakeActionOnResourceDispatcher(CANCEL); | 494 TakeActionOnResourceDispatcher(CANCEL); |
482 else | 495 else |
483 TakeActionOnResourceDispatcher(RESUME); | 496 TakeActionOnResourceDispatcher(RESUME); |
484 | 497 |
485 // No need to hide if we are a new navigation, we'll get hidden when the | 498 // No need to hide if we are a new navigation, we'll get hidden when the |
486 // navigation is committed. | 499 // navigation is committed. |
487 if (!new_navigation_) { | 500 if (!new_navigation_) { |
488 Hide(); | 501 Hide(); |
489 // WARNING: we are now deleted! | 502 delegate_->OnProceed(); |
| 503 delete this; |
| 504 return; |
490 } | 505 } |
491 } | |
492 | 506 |
493 std::string InterstitialPage::GetHTMLContents() { | 507 delegate_->OnProceed(); |
494 return std::string(); | |
495 } | 508 } |
496 | 509 |
497 void InterstitialPage::DontProceed() { | 510 void InterstitialPage::DontProceed() { |
498 DCHECK(action_taken_ != DONT_PROCEED_ACTION); | 511 DCHECK(action_taken_ != DONT_PROCEED_ACTION); |
499 | 512 |
500 Disable(); | 513 Disable(); |
501 action_taken_ = DONT_PROCEED_ACTION; | 514 action_taken_ = DONT_PROCEED_ACTION; |
502 | 515 |
503 // If this is a new navigation, we are returning to the original page, so we | 516 // If this is a new navigation, we are returning to the original page, so we |
504 // resume blocked requests for it. If it is not a new navigation, then it | 517 // resume blocked requests for it. If it is not a new navigation, then it |
(...skipping 10 matching lines...) Expand all Loading... |
515 // explicitely. Note that by calling DiscardNonCommittedEntries() we also | 528 // explicitely. Note that by calling DiscardNonCommittedEntries() we also |
516 // discard the pending entry, which is what we want, since the navigation is | 529 // discard the pending entry, which is what we want, since the navigation is |
517 // cancelled. | 530 // cancelled. |
518 tab_->GetController().DiscardNonCommittedEntries(); | 531 tab_->GetController().DiscardNonCommittedEntries(); |
519 } | 532 } |
520 | 533 |
521 if (reload_on_dont_proceed_) | 534 if (reload_on_dont_proceed_) |
522 tab_->GetController().Reload(true); | 535 tab_->GetController().Reload(true); |
523 | 536 |
524 Hide(); | 537 Hide(); |
525 // WARNING: we are now deleted! | 538 delegate_->OnDontProceed(); |
| 539 delete this; |
526 } | 540 } |
527 | 541 |
528 void InterstitialPage::CancelForNavigation() { | 542 void InterstitialPage::CancelForNavigation() { |
529 // The user is trying to navigate away. We should unblock the renderer and | 543 // The user is trying to navigate away. We should unblock the renderer and |
530 // disable the interstitial, but keep it visible until the navigation | 544 // disable the interstitial, but keep it visible until the navigation |
531 // completes. | 545 // completes. |
532 Disable(); | 546 Disable(); |
533 // If this interstitial was shown for a new navigation, allow any navigations | 547 // If this interstitial was shown for a new navigation, allow any navigations |
534 // on the original page to resume (e.g., subresource requests, XHRs, etc). | 548 // on the original page to resume (e.g., subresource requests, XHRs, etc). |
535 // Otherwise, cancel the pending, possibly dangerous navigations. | 549 // Otherwise, cancel the pending, possibly dangerous navigations. |
(...skipping 17 matching lines...) Expand all Loading... |
553 | 567 |
554 void InterstitialPage::Focus() { | 568 void InterstitialPage::Focus() { |
555 // Focus the native window. | 569 // Focus the native window. |
556 render_view_host_->view()->Focus(); | 570 render_view_host_->view()->Focus(); |
557 } | 571 } |
558 | 572 |
559 void InterstitialPage::FocusThroughTabTraversal(bool reverse) { | 573 void InterstitialPage::FocusThroughTabTraversal(bool reverse) { |
560 render_view_host_->SetInitialFocus(reverse); | 574 render_view_host_->SetInitialFocus(reverse); |
561 } | 575 } |
562 | 576 |
| 577 content::InterstitialPageDelegate* InterstitialPage::GetDelegateForTesting() { |
| 578 return delegate_.get(); |
| 579 } |
| 580 |
| 581 void InterstitialPage::DontCreateViewForTesting() { |
| 582 create_view_ = false; |
| 583 } |
| 584 |
563 content::ViewType InterstitialPage::GetRenderViewType() const { | 585 content::ViewType InterstitialPage::GetRenderViewType() const { |
564 return content::VIEW_TYPE_INTERSTITIAL_PAGE; | 586 return content::VIEW_TYPE_INTERSTITIAL_PAGE; |
565 } | 587 } |
566 | 588 |
567 gfx::Rect InterstitialPage::GetRootWindowResizerRect() const { | 589 gfx::Rect InterstitialPage::GetRootWindowResizerRect() const { |
568 return gfx::Rect(); | 590 return gfx::Rect(); |
569 } | 591 } |
570 | 592 |
571 void InterstitialPage::Disable() { | 593 void InterstitialPage::Disable() { |
572 enabled_ = false; | 594 enabled_ = false; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 if (!tab->GetViewDelegate()) | 723 if (!tab->GetViewDelegate()) |
702 return; | 724 return; |
703 | 725 |
704 tab->GetViewDelegate()->TakeFocus(reverse); | 726 tab->GetViewDelegate()->TakeFocus(reverse); |
705 } | 727 } |
706 | 728 |
707 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 729 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
708 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 730 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
709 int active_match_ordinal, bool final_update) { | 731 int active_match_ordinal, bool final_update) { |
710 } | 732 } |
OLD | NEW |