| 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/chrome_thread.h" |
| 14 #include "chrome/browser/dom_operation_notification_details.h" | 14 #include "chrome/browser/dom_operation_notification_details.h" |
| 15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 16 #include "chrome/browser/renderer_host/render_process_host.h" | 16 #include "chrome/browser/renderer_host/render_process_host.h" |
| 17 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 17 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 18 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 18 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 19 #include "chrome/browser/renderer_host/site_instance.h" | 19 #include "chrome/browser/renderer_host/site_instance.h" |
| 20 #include "chrome/browser/renderer_preferences_util.h" |
| 20 #include "chrome/browser/tab_contents/navigation_controller.h" | 21 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 21 #include "chrome/browser/tab_contents/navigation_entry.h" | 22 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 22 #include "chrome/browser/tab_contents/tab_contents.h" | 23 #include "chrome/browser/tab_contents/tab_contents.h" |
| 23 #include "chrome/browser/tab_contents/tab_contents_view.h" | 24 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 24 #include "chrome/common/bindings_policy.h" | 25 #include "chrome/common/bindings_policy.h" |
| 25 #if defined(TOOLKIT_GTK) | 26 #if defined(TOOLKIT_GTK) |
| 26 #include "chrome/browser/gtk/gtk_theme_provider.h" | 27 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 27 #include "chrome/common/gtk_util.h" | |
| 28 #endif | 28 #endif |
| 29 #include "chrome/common/notification_service.h" | 29 #include "chrome/common/notification_service.h" |
| 30 #include "grit/browser_resources.h" | 30 #include "grit/browser_resources.h" |
| 31 #include "net/base/escape.h" | 31 #include "net/base/escape.h" |
| 32 #include "views/window/window_delegate.h" | 32 #include "views/window/window_delegate.h" |
| 33 | 33 |
| 34 using WebKit::WebDragOperation; | 34 using WebKit::WebDragOperation; |
| 35 using WebKit::WebDragOperationsMask; | 35 using WebKit::WebDragOperationsMask; |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 should_discard_pending_nav_entry_(new_navigation), | 130 should_discard_pending_nav_entry_(new_navigation), |
| 131 enabled_(true), | 131 enabled_(true), |
| 132 action_taken_(false), | 132 action_taken_(false), |
| 133 render_view_host_(NULL), | 133 render_view_host_(NULL), |
| 134 original_child_id_(tab->render_view_host()->process()->id()), | 134 original_child_id_(tab->render_view_host()->process()->id()), |
| 135 original_rvh_id_(tab->render_view_host()->routing_id()), | 135 original_rvh_id_(tab->render_view_host()->routing_id()), |
| 136 should_revert_tab_title_(false), | 136 should_revert_tab_title_(false), |
| 137 resource_dispatcher_host_notified_(false), | 137 resource_dispatcher_host_notified_(false), |
| 138 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( | 138 ALLOW_THIS_IN_INITIALIZER_LIST(rvh_view_delegate_( |
| 139 new InterstitialPageRVHViewDelegate(this))) { | 139 new InterstitialPageRVHViewDelegate(this))) { |
| 140 renderer_preferences_util::UpdateFromSystemSettings( |
| 141 &renderer_preferences_, tab_->profile()); |
| 142 |
| 140 InitInterstitialPageMap(); | 143 InitInterstitialPageMap(); |
| 141 // It would be inconsistent to create an interstitial with no new navigation | 144 // It would be inconsistent to create an interstitial with no new navigation |
| 142 // (which is the case when the interstitial was triggered by a sub-resource on | 145 // (which is the case when the interstitial was triggered by a sub-resource on |
| 143 // a page) when we have a pending entry (in the process of loading a new top | 146 // a page) when we have a pending entry (in the process of loading a new top |
| 144 // frame). | 147 // frame). |
| 145 DCHECK(new_navigation || !tab->controller().pending_entry()); | 148 DCHECK(new_navigation || !tab->controller().pending_entry()); |
| 146 | |
| 147 #if defined(TOOLKIT_GTK) | |
| 148 gtk_util::InitRendererPrefsFromGtkSettings(&renderer_preferences_, | |
| 149 GtkThemeProvider::GetFrom(tab->profile())->UseGtkTheme()); | |
| 150 #endif | |
| 151 } | 149 } |
| 152 | 150 |
| 153 InterstitialPage::~InterstitialPage() { | 151 InterstitialPage::~InterstitialPage() { |
| 154 InterstitialPageMap::iterator iter = tab_to_interstitial_page_->find(tab_); | 152 InterstitialPageMap::iterator iter = tab_to_interstitial_page_->find(tab_); |
| 155 DCHECK(iter != tab_to_interstitial_page_->end()) << | 153 DCHECK(iter != tab_to_interstitial_page_->end()) << |
| 156 "InterstitialPage missing from map. Please add a comment to the bug " | 154 "InterstitialPage missing from map. Please add a comment to the bug " |
| 157 "http://crbug.com/9442 with the URL you were visiting"; | 155 "http://crbug.com/9442 with the URL you were visiting"; |
| 158 if (iter != tab_to_interstitial_page_->end()) | 156 if (iter != tab_to_interstitial_page_->end()) |
| 159 tab_to_interstitial_page_->erase(iter); | 157 tab_to_interstitial_page_->erase(iter); |
| 160 DCHECK(!render_view_host_); | 158 DCHECK(!render_view_host_); |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 } | 612 } |
| 615 | 613 |
| 616 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 614 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 617 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 615 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 618 int active_match_ordinal, bool final_update) { | 616 int active_match_ordinal, bool final_update) { |
| 619 } | 617 } |
| 620 | 618 |
| 621 int InterstitialPage::GetBrowserWindowID() const { | 619 int InterstitialPage::GetBrowserWindowID() const { |
| 622 return tab_->GetBrowserWindowID(); | 620 return tab_->GetBrowserWindowID(); |
| 623 } | 621 } |
| OLD | NEW |