| 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 "chrome/browser/ui/tab_contents/tab_contents.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 9 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
| 10 #include "chrome/browser/autofill/autofill_external_delegate.h" | 10 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 11 #include "chrome/browser/autofill/autofill_manager.h" | 11 #include "chrome/browser/autofill/autofill_manager.h" |
| 12 #include "chrome/browser/automation/automation_tab_helper.h" | 12 #include "chrome/browser/automation/automation_tab_helper.h" |
| 13 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 13 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
| 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 15 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 15 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 16 #include "chrome/browser/extensions/tab_helper.h" | 16 #include "chrome/browser/extensions/tab_helper.h" |
| 17 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 17 #include "chrome/browser/external_protocol/external_protocol_observer.h" |
| 18 #include "chrome/browser/favicon/favicon_tab_helper.h" | 18 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 19 #include "chrome/browser/history/history_tab_helper.h" | 19 #include "chrome/browser/history/history_tab_helper.h" |
| 20 #include "chrome/browser/infobars/infobar_tab_helper.h" | 20 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 21 #include "chrome/browser/net/load_time_stats.h" | 21 #include "chrome/browser/net/load_time_stats.h" |
| 22 #include "chrome/browser/omnibox_search_hint.h" | 22 #include "chrome/browser/omnibox_search_hint.h" |
| 23 #include "chrome/browser/password_manager/password_manager.h" | 23 #include "chrome/browser/password_manager/password_manager.h" |
| 24 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" | 24 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
| 25 #include "chrome/browser/pepper_broker_observer.h" |
| 25 #include "chrome/browser/plugin_observer.h" | 26 #include "chrome/browser/plugin_observer.h" |
| 26 #include "chrome/browser/prerender/prerender_tab_helper.h" | 27 #include "chrome/browser/prerender/prerender_tab_helper.h" |
| 27 #include "chrome/browser/printing/print_preview_message_handler.h" | 28 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 28 #include "chrome/browser/printing/print_view_manager.h" | 29 #include "chrome/browser/printing/print_view_manager.h" |
| 29 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 30 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
| 30 #include "chrome/browser/sessions/session_tab_helper.h" | 31 #include "chrome/browser/sessions/session_tab_helper.h" |
| 31 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" | 32 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" |
| 32 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 33 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
| 33 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 34 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 34 #include "chrome/browser/translate/translate_tab_helper.h" | 35 #include "chrome/browser/translate/translate_tab_helper.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 zoom_controller_.reset(new ZoomController(this)); | 159 zoom_controller_.reset(new ZoomController(this)); |
| 159 | 160 |
| 160 #if !defined(OS_ANDROID) | 161 #if !defined(OS_ANDROID) |
| 161 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); | 162 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); |
| 162 sad_tab_helper_.reset(new SadTabHelper(contents)); | 163 sad_tab_helper_.reset(new SadTabHelper(contents)); |
| 163 #endif | 164 #endif |
| 164 | 165 |
| 165 // Create the per-tab observers. | 166 // Create the per-tab observers. |
| 166 alternate_error_page_tab_observer_.reset( | 167 alternate_error_page_tab_observer_.reset( |
| 167 new AlternateErrorPageTabObserver(contents, profile())); | 168 new AlternateErrorPageTabObserver(contents, profile())); |
| 168 webnavigation_observer_.reset( | |
| 169 new extensions::WebNavigationTabObserver(contents)); | |
| 170 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); | 169 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); |
| 171 navigation_metrics_recorder_.reset(new NavigationMetricsRecorder(contents)); | 170 navigation_metrics_recorder_.reset(new NavigationMetricsRecorder(contents)); |
| 172 pdf_tab_observer_.reset(new PDFTabObserver(this)); | 171 pdf_tab_observer_.reset(new PDFTabObserver(this)); |
| 172 pepper_broker_observer_.reset(new PepperBrokerObserver(contents)); |
| 173 plugin_observer_.reset(new PluginObserver(this)); |
| 173 safe_browsing_tab_observer_.reset( | 174 safe_browsing_tab_observer_.reset( |
| 174 new safe_browsing::SafeBrowsingTabObserver(this)); | 175 new safe_browsing::SafeBrowsingTabObserver(this)); |
| 175 | 176 webnavigation_observer_.reset( |
| 176 plugin_observer_.reset(new PluginObserver(this)); | 177 new extensions::WebNavigationTabObserver(contents)); |
| 177 | 178 |
| 178 #if !defined(OS_ANDROID) | 179 #if !defined(OS_ANDROID) |
| 179 if (OmniboxSearchHint::IsEnabled(profile())) | 180 if (OmniboxSearchHint::IsEnabled(profile())) |
| 180 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 181 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
| 181 #endif | 182 #endif |
| 182 | 183 |
| 183 #if defined(ENABLE_PRINTING) | 184 #if defined(ENABLE_PRINTING) |
| 184 print_view_manager_.reset(new printing::PrintViewManager(this)); | 185 print_view_manager_.reset(new printing::PrintViewManager(this)); |
| 185 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); | 186 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); |
| 186 #endif | 187 #endif |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 253 |
| 253 //////////////////////////////////////////////////////////////////////////////// | 254 //////////////////////////////////////////////////////////////////////////////// |
| 254 // WebContentsObserver overrides | 255 // WebContentsObserver overrides |
| 255 | 256 |
| 256 void TabContents::WebContentsDestroyed(WebContents* tab) { | 257 void TabContents::WebContentsDestroyed(WebContents* tab) { |
| 257 // Destruction of the WebContents should only be done by us from our | 258 // Destruction of the WebContents should only be done by us from our |
| 258 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 259 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
| 259 // will attempt to access the WebContents and we'll crash. | 260 // will attempt to access the WebContents and we'll crash. |
| 260 DCHECK(in_destructor_); | 261 DCHECK(in_destructor_); |
| 261 } | 262 } |
| OLD | NEW |