OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
8 // For GdkScreen | 8 // For GdkScreen |
9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
10 #endif // defined(OS_CHROMEOS) | 10 #endif // defined(OS_CHROMEOS) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "chrome/browser/message_box_handler.h" | 46 #include "chrome/browser/message_box_handler.h" |
47 #include "chrome/browser/load_from_memory_cache_details.h" | 47 #include "chrome/browser/load_from_memory_cache_details.h" |
48 #include "chrome/browser/load_notification_details.h" | 48 #include "chrome/browser/load_notification_details.h" |
49 #include "chrome/browser/metrics/metric_event_duration_details.h" | 49 #include "chrome/browser/metrics/metric_event_duration_details.h" |
50 #include "chrome/browser/modal_html_dialog_delegate.h" | 50 #include "chrome/browser/modal_html_dialog_delegate.h" |
51 #include "chrome/browser/omnibox_search_hint.h" | 51 #include "chrome/browser/omnibox_search_hint.h" |
52 #include "chrome/browser/password_manager/password_manager.h" | 52 #include "chrome/browser/password_manager/password_manager.h" |
53 #include "chrome/browser/platform_util.h" | 53 #include "chrome/browser/platform_util.h" |
54 #include "chrome/browser/plugin_installer.h" | 54 #include "chrome/browser/plugin_installer.h" |
55 #include "chrome/browser/pref_service.h" | 55 #include "chrome/browser/pref_service.h" |
| 56 #include "chrome/browser/printing/print_view_manager.h" |
56 #include "chrome/browser/profile.h" | 57 #include "chrome/browser/profile.h" |
57 #include "chrome/browser/renderer_host/render_process_host.h" | 58 #include "chrome/browser/renderer_host/render_process_host.h" |
58 #include "chrome/browser/renderer_host/render_view_host.h" | 59 #include "chrome/browser/renderer_host/render_view_host.h" |
59 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 60 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
60 #include "chrome/browser/renderer_host/resource_request_details.h" | 61 #include "chrome/browser/renderer_host/resource_request_details.h" |
61 #include "chrome/browser/renderer_host/site_instance.h" | 62 #include "chrome/browser/renderer_host/site_instance.h" |
62 #include "chrome/browser/renderer_host/web_cache_manager.h" | 63 #include "chrome/browser/renderer_host/web_cache_manager.h" |
63 #include "chrome/browser/renderer_preferences_util.h" | 64 #include "chrome/browser/renderer_preferences_util.h" |
64 #include "chrome/browser/search_engines/template_url_fetcher.h" | 65 #include "chrome/browser/search_engines/template_url_fetcher.h" |
65 #include "chrome/browser/search_engines/template_url_model.h" | 66 #include "chrome/browser/search_engines/template_url_model.h" |
66 #include "chrome/browser/sessions/session_types.h" | 67 #include "chrome/browser/sessions/session_types.h" |
67 #include "chrome/browser/tab_contents/infobar_delegate.h" | 68 #include "chrome/browser/tab_contents/infobar_delegate.h" |
68 #include "chrome/browser/tab_contents/interstitial_page.h" | 69 #include "chrome/browser/tab_contents/interstitial_page.h" |
69 #include "chrome/browser/tab_contents/navigation_entry.h" | 70 #include "chrome/browser/tab_contents/navigation_entry.h" |
70 #include "chrome/browser/tab_contents/provisional_load_details.h" | 71 #include "chrome/browser/tab_contents/provisional_load_details.h" |
71 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 72 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
72 #include "chrome/browser/tab_contents/tab_contents_view.h" | 73 #include "chrome/browser/tab_contents/tab_contents_view.h" |
73 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 74 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
74 #include "chrome/browser/translate/page_translated_details.h" | 75 #include "chrome/browser/translate/page_translated_details.h" |
75 #include "chrome/common/bindings_policy.h" | 76 #include "chrome/common/bindings_policy.h" |
76 #include "chrome/common/chrome_switches.h" | 77 #include "chrome/common/chrome_switches.h" |
77 #include "chrome/common/extensions/extension.h" | 78 #include "chrome/common/extensions/extension.h" |
78 #include "chrome/common/extensions/extension_action.h" | 79 #include "chrome/common/extensions/extension_action.h" |
79 #include "chrome/common/extensions/extension_resource.h" | 80 #include "chrome/common/extensions/extension_resource.h" |
| 81 #include "chrome/common/extensions/url_pattern.h" |
| 82 #include "chrome/common/navigation_types.h" |
| 83 #include "chrome/common/net/url_request_context_getter.h" |
80 #include "chrome/common/notification_service.h" | 84 #include "chrome/common/notification_service.h" |
81 #include "chrome/common/pref_names.h" | 85 #include "chrome/common/pref_names.h" |
82 #include "chrome/common/render_messages.h" | 86 #include "chrome/common/render_messages.h" |
83 #include "chrome/common/renderer_preferences.h" | 87 #include "chrome/common/renderer_preferences.h" |
84 #include "chrome/common/url_constants.h" | 88 #include "chrome/common/url_constants.h" |
85 #include "grit/chromium_strings.h" | 89 #include "grit/chromium_strings.h" |
86 #include "grit/generated_resources.h" | 90 #include "grit/generated_resources.h" |
87 #include "grit/locale_settings.h" | 91 #include "grit/locale_settings.h" |
88 #include "grit/platform_locale_settings.h" | 92 #include "grit/platform_locale_settings.h" |
89 #include "grit/theme_resources.h" | 93 #include "grit/theme_resources.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 SiteInstance* site_instance, | 245 SiteInstance* site_instance, |
242 int routing_id, | 246 int routing_id, |
243 const TabContents* base_tab_contents) | 247 const TabContents* base_tab_contents) |
244 : delegate_(NULL), | 248 : delegate_(NULL), |
245 ALLOW_THIS_IN_INITIALIZER_LIST(controller_(this, profile)), | 249 ALLOW_THIS_IN_INITIALIZER_LIST(controller_(this, profile)), |
246 ALLOW_THIS_IN_INITIALIZER_LIST(view_( | 250 ALLOW_THIS_IN_INITIALIZER_LIST(view_( |
247 TabContentsView::Create(this))), | 251 TabContentsView::Create(this))), |
248 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), | 252 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), |
249 property_bag_(), | 253 property_bag_(), |
250 registrar_(), | 254 registrar_(), |
251 ALLOW_THIS_IN_INITIALIZER_LIST(printing_(*this)), | 255 ALLOW_THIS_IN_INITIALIZER_LIST(printing_( |
| 256 new printing::PrintViewManager(*this))), |
252 save_package_(), | 257 save_package_(), |
253 autocomplete_history_manager_(), | 258 autocomplete_history_manager_(), |
254 autofill_manager_(), | 259 autofill_manager_(), |
255 password_manager_(), | 260 password_manager_(), |
256 plugin_installer_(), | 261 plugin_installer_(), |
257 bookmark_drag_(NULL), | 262 bookmark_drag_(NULL), |
258 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), | 263 ALLOW_THIS_IN_INITIALIZER_LIST(fav_icon_helper_(this)), |
259 select_file_dialog_(), | 264 select_file_dialog_(), |
260 is_loading_(false), | 265 is_loading_(false), |
261 is_crashed_(false), | 266 is_crashed_(false), |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 profile()->GetFaviconService(Profile::IMPLICIT_ACCESS); | 825 profile()->GetFaviconService(Profile::IMPLICIT_ACCESS); |
821 if (favicon_service) | 826 if (favicon_service) |
822 favicon_service->SetFaviconOutOfDateForPage(entry.url()); | 827 favicon_service->SetFaviconOutOfDateForPage(entry.url()); |
823 } | 828 } |
824 | 829 |
825 return true; | 830 return true; |
826 } | 831 } |
827 | 832 |
828 void TabContents::Stop() { | 833 void TabContents::Stop() { |
829 render_manager_.Stop(); | 834 render_manager_.Stop(); |
830 printing_.Stop(); | 835 printing_->Stop(); |
831 } | 836 } |
832 | 837 |
833 void TabContents::DisassociateFromPopupCount() { | 838 void TabContents::DisassociateFromPopupCount() { |
834 render_view_host()->DisassociateFromPopupCount(); | 839 render_view_host()->DisassociateFromPopupCount(); |
835 } | 840 } |
836 | 841 |
837 TabContents* TabContents::Clone() { | 842 TabContents* TabContents::Clone() { |
838 // We create a new SiteInstance so that the new tab won't share processes | 843 // We create a new SiteInstance so that the new tab won't share processes |
839 // with the old one. This can be changed in the future if we need it to share | 844 // with the old one. This can be changed in the future if we need it to share |
840 // processes for some reason. | 845 // processes for some reason. |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 RenderViewHostDelegate::ContentSettings* | 2141 RenderViewHostDelegate::ContentSettings* |
2137 TabContents::GetContentSettingsDelegate() { | 2142 TabContents::GetContentSettingsDelegate() { |
2138 return content_settings_delegate_.get(); | 2143 return content_settings_delegate_.get(); |
2139 } | 2144 } |
2140 | 2145 |
2141 RenderViewHostDelegate::Save* TabContents::GetSaveDelegate() { | 2146 RenderViewHostDelegate::Save* TabContents::GetSaveDelegate() { |
2142 return save_package_.get(); // May be NULL, but we can return NULL. | 2147 return save_package_.get(); // May be NULL, but we can return NULL. |
2143 } | 2148 } |
2144 | 2149 |
2145 RenderViewHostDelegate::Printing* TabContents::GetPrintingDelegate() { | 2150 RenderViewHostDelegate::Printing* TabContents::GetPrintingDelegate() { |
2146 return &printing_; | 2151 return printing_.get(); |
2147 } | 2152 } |
2148 | 2153 |
2149 RenderViewHostDelegate::FavIcon* TabContents::GetFavIconDelegate() { | 2154 RenderViewHostDelegate::FavIcon* TabContents::GetFavIconDelegate() { |
2150 return &fav_icon_helper_; | 2155 return &fav_icon_helper_; |
2151 } | 2156 } |
2152 | 2157 |
2153 RenderViewHostDelegate::Autocomplete* TabContents::GetAutocompleteDelegate() { | 2158 RenderViewHostDelegate::Autocomplete* TabContents::GetAutocompleteDelegate() { |
2154 if (autocomplete_history_manager_.get() == NULL) | 2159 if (autocomplete_history_manager_.get() == NULL) |
2155 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); | 2160 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); |
2156 return autocomplete_history_manager_.get(); | 2161 return autocomplete_history_manager_.get(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 SetIsCrashed(false); | 2235 SetIsCrashed(false); |
2231 | 2236 |
2232 // Restore the focus to the tab (otherwise the focus will be on the top | 2237 // Restore the focus to the tab (otherwise the focus will be on the top |
2233 // window). | 2238 // window). |
2234 if (was_crashed && !FocusLocationBarByDefault()) | 2239 if (was_crashed && !FocusLocationBarByDefault()) |
2235 Focus(); | 2240 Focus(); |
2236 } | 2241 } |
2237 | 2242 |
2238 void TabContents::RenderViewGone(RenderViewHost* rvh) { | 2243 void TabContents::RenderViewGone(RenderViewHost* rvh) { |
2239 // Ask the print preview if this renderer was valuable. | 2244 // Ask the print preview if this renderer was valuable. |
2240 if (!printing_.OnRenderViewGone(rvh)) | 2245 if (!printing_->OnRenderViewGone(rvh)) |
2241 return; | 2246 return; |
2242 if (rvh != render_view_host()) { | 2247 if (rvh != render_view_host()) { |
2243 // The pending page's RenderViewHost is gone. | 2248 // The pending page's RenderViewHost is gone. |
2244 return; | 2249 return; |
2245 } | 2250 } |
2246 | 2251 |
2247 SetIsLoading(false, NULL); | 2252 SetIsLoading(false, NULL); |
2248 NotifyDisconnected(); | 2253 NotifyDisconnected(); |
2249 SetIsCrashed(true); | 2254 SetIsCrashed(true); |
2250 | 2255 |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3151 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
3147 } | 3152 } |
3148 | 3153 |
3149 Profile* TabContents::GetProfileForPasswordManager() { | 3154 Profile* TabContents::GetProfileForPasswordManager() { |
3150 return profile(); | 3155 return profile(); |
3151 } | 3156 } |
3152 | 3157 |
3153 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3158 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
3154 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3159 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
3155 } | 3160 } |
OLD | NEW |