OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/tab_contents/interstitial_page.h" | 5 #include "chrome/browser/tab_contents/interstitial_page.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
11 #include "chrome/browser/browser_list.h" | 11 #include "chrome/browser/browser_list.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chrome_thread.h" |
13 #include "chrome/browser/dom_operation_notification_details.h" | 14 #include "chrome/browser/dom_operation_notification_details.h" |
14 #include "chrome/browser/renderer_host/render_process_host.h" | 15 #include "chrome/browser/renderer_host/render_process_host.h" |
15 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 16 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
16 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 17 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
17 #include "chrome/browser/renderer_host/site_instance.h" | 18 #include "chrome/browser/renderer_host/site_instance.h" |
18 #include "chrome/browser/tab_contents/navigation_controller.h" | 19 #include "chrome/browser/tab_contents/navigation_controller.h" |
19 #include "chrome/browser/tab_contents/navigation_entry.h" | 20 #include "chrome/browser/tab_contents/navigation_entry.h" |
20 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
21 #include "chrome/browser/tab_contents/tab_contents_view.h" | 22 #include "chrome/browser/tab_contents/tab_contents_view.h" |
22 #include "chrome/common/bindings_policy.h" | 23 #include "chrome/common/bindings_policy.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 489 |
489 if (action == CANCEL || action == RESUME) { | 490 if (action == CANCEL || action == RESUME) { |
490 if (resource_dispatcher_host_notified_) | 491 if (resource_dispatcher_host_notified_) |
491 return; | 492 return; |
492 resource_dispatcher_host_notified_ = true; | 493 resource_dispatcher_host_notified_ = true; |
493 } | 494 } |
494 | 495 |
495 // The tab might not have a render_view_host if it was closed (in which case, | 496 // The tab might not have a render_view_host if it was closed (in which case, |
496 // we have taken care of the blocked requests when processing | 497 // we have taken care of the blocked requests when processing |
497 // NOTIFY_RENDER_WIDGET_HOST_DESTROYED. | 498 // NOTIFY_RENDER_WIDGET_HOST_DESTROYED. |
498 // Also we need to test there is an IO thread, as when unit-tests we don't | 499 // Also we need to test there is a ResourceDispatcherHost, as when unit-tests |
499 // have one. | 500 // we don't have one. |
500 RenderViewHost* rvh = RenderViewHost::FromID(original_child_id_, | 501 RenderViewHost* rvh = RenderViewHost::FromID(original_child_id_, |
501 original_rvh_id_); | 502 original_rvh_id_); |
502 if (rvh && g_browser_process->io_thread()) { | 503 if (!rvh || !g_browser_process->resource_dispatcher_host()) |
503 g_browser_process->io_thread()->message_loop()->PostTask( | 504 return; |
504 FROM_HERE, new ResourceRequestTask(original_child_id_, | 505 |
505 original_rvh_id_, | 506 ChromeThread::PostTask( |
506 action)); | 507 ChromeThread::IO, FROM_HERE, |
507 } | 508 new ResourceRequestTask(original_child_id_, original_rvh_id_, action)); |
508 } | 509 } |
509 | 510 |
510 // static | 511 // static |
511 void InterstitialPage::InitInterstitialPageMap() { | 512 void InterstitialPage::InitInterstitialPageMap() { |
512 if (!tab_to_interstitial_page_) | 513 if (!tab_to_interstitial_page_) |
513 tab_to_interstitial_page_ = new InterstitialPageMap; | 514 tab_to_interstitial_page_ = new InterstitialPageMap; |
514 } | 515 } |
515 | 516 |
516 // static | 517 // static |
517 InterstitialPage* InterstitialPage::GetInterstitialPage( | 518 InterstitialPage* InterstitialPage::GetInterstitialPage( |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 } | 604 } |
604 | 605 |
605 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 606 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
606 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 607 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
607 int active_match_ordinal, bool final_update) { | 608 int active_match_ordinal, bool final_update) { |
608 } | 609 } |
609 | 610 |
610 int InterstitialPage::GetBrowserWindowID() const { | 611 int InterstitialPage::GetBrowserWindowID() const { |
611 return tab_->GetBrowserWindowID(); | 612 return tab_->GetBrowserWindowID(); |
612 } | 613 } |
OLD | NEW |