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/autocomplete_history_manager.h" | 9 #include "chrome/browser/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/omnibox_search_hint.h" | 21 #include "chrome/browser/omnibox_search_hint.h" |
22 #include "chrome/browser/password_manager/password_manager.h" | 22 #include "chrome/browser/password_manager/password_manager.h" |
23 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" | 23 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
24 #include "chrome/browser/plugin_observer.h" | 24 #include "chrome/browser/plugin_observer.h" |
25 #include "chrome/browser/prerender/prerender_tab_helper.h" | 25 #include "chrome/browser/prerender/prerender_tab_helper.h" |
26 #include "chrome/browser/printing/print_preview_message_handler.h" | 26 #include "chrome/browser/printing/print_preview_message_handler.h" |
27 #include "chrome/browser/printing/print_view_manager.h" | 27 #include "chrome/browser/printing/print_view_manager.h" |
28 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 28 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
29 #include "chrome/browser/sessions/restore_tab_helper.h" | 29 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 30 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" |
30 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 31 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
31 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 32 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
32 #include "chrome/browser/translate/translate_tab_helper.h" | 33 #include "chrome/browser/translate/translate_tab_helper.h" |
33 #include "chrome/browser/ui/alternate_error_tab_observer.h" | 34 #include "chrome/browser/ui/alternate_error_tab_observer.h" |
34 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 35 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
35 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 36 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
36 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 37 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
37 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 38 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
38 #include "chrome/browser/ui/hung_plugin_tab_helper.h" | 39 #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
39 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 40 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); | 136 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); |
136 sad_tab_helper_.reset(new SadTabHelper(contents)); | 137 sad_tab_helper_.reset(new SadTabHelper(contents)); |
137 #endif | 138 #endif |
138 | 139 |
139 // Create the per-tab observers. | 140 // Create the per-tab observers. |
140 alternate_error_page_tab_observer_.reset( | 141 alternate_error_page_tab_observer_.reset( |
141 new AlternateErrorPageTabObserver(contents, profile())); | 142 new AlternateErrorPageTabObserver(contents, profile())); |
142 webnavigation_observer_.reset( | 143 webnavigation_observer_.reset( |
143 new extensions::WebNavigationTabObserver(contents)); | 144 new extensions::WebNavigationTabObserver(contents)); |
144 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); | 145 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); |
| 146 navigation_metrics_recorder_.reset(new NavigationMetricsRecorder(contents)); |
145 pdf_tab_observer_.reset(new PDFTabObserver(this)); | 147 pdf_tab_observer_.reset(new PDFTabObserver(this)); |
146 safe_browsing_tab_observer_.reset( | 148 safe_browsing_tab_observer_.reset( |
147 new safe_browsing::SafeBrowsingTabObserver(this)); | 149 new safe_browsing::SafeBrowsingTabObserver(this)); |
148 | 150 |
149 plugin_observer_.reset(new PluginObserver(this)); | 151 plugin_observer_.reset(new PluginObserver(this)); |
150 | 152 |
151 #if !defined(OS_ANDROID) | 153 #if !defined(OS_ANDROID) |
152 if (OmniboxSearchHint::IsEnabled(profile())) | 154 if (OmniboxSearchHint::IsEnabled(profile())) |
153 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 155 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
154 #endif | 156 #endif |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 241 |
240 //////////////////////////////////////////////////////////////////////////////// | 242 //////////////////////////////////////////////////////////////////////////////// |
241 // WebContentsObserver overrides | 243 // WebContentsObserver overrides |
242 | 244 |
243 void TabContents::WebContentsDestroyed(WebContents* tab) { | 245 void TabContents::WebContentsDestroyed(WebContents* tab) { |
244 // Destruction of the WebContents should only be done by us from our | 246 // Destruction of the WebContents should only be done by us from our |
245 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 247 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
246 // will attempt to access the WebContents and we'll crash. | 248 // will attempt to access the WebContents and we'll crash. |
247 DCHECK(in_destructor_); | 249 DCHECK(in_destructor_); |
248 } | 250 } |
OLD | NEW |