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" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 restore_tab_helper_.reset(new RestoreTabHelper(contents)); | 113 restore_tab_helper_.reset(new RestoreTabHelper(contents)); |
114 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); | 114 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); |
115 snapshot_tab_helper_.reset(new SnapshotTabHelper(contents)); | 115 snapshot_tab_helper_.reset(new SnapshotTabHelper(contents)); |
116 ssl_helper_.reset(new TabContentsSSLHelper(this)); | 116 ssl_helper_.reset(new TabContentsSSLHelper(this)); |
117 synced_tab_delegate_.reset(new TabContentsWrapperSyncedTabDelegate(this)); | 117 synced_tab_delegate_.reset(new TabContentsWrapperSyncedTabDelegate(this)); |
118 content_settings_.reset(new TabSpecificContentSettings(contents)); | 118 content_settings_.reset(new TabSpecificContentSettings(contents)); |
119 translate_tab_helper_.reset(new TranslateTabHelper(contents)); | 119 translate_tab_helper_.reset(new TranslateTabHelper(contents)); |
120 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); | 120 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); |
121 zoom_controller_.reset(new ZoomController(this)); | 121 zoom_controller_.reset(new ZoomController(this)); |
122 | 122 |
123 #if defined(ENABLE_PRINTING) | |
124 print_view_manager_.reset(new printing::PrintViewManager(this)); | |
Lei Zhang
2012/06/08 23:24:52
I believe you can combine this with the other #if
Xianzhu
2012/06/09 00:51:30
Done.
| |
125 #endif | |
126 | |
123 #if !defined(OS_ANDROID) | 127 #if !defined(OS_ANDROID) |
124 print_view_manager_.reset(new printing::PrintViewManager(this)); | |
125 sad_tab_helper_.reset(new SadTabHelper(contents)); | 128 sad_tab_helper_.reset(new SadTabHelper(contents)); |
126 #endif | 129 #endif |
127 | 130 |
128 // Create the per-tab observers. | 131 // Create the per-tab observers. |
129 alternate_error_page_tab_observer_.reset( | 132 alternate_error_page_tab_observer_.reset( |
130 new AlternateErrorPageTabObserver(contents, profile())); | 133 new AlternateErrorPageTabObserver(contents, profile())); |
131 webnavigation_observer_.reset( | 134 webnavigation_observer_.reset( |
132 new extensions::WebNavigationTabObserver(contents)); | 135 new extensions::WebNavigationTabObserver(contents)); |
133 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); | 136 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); |
134 pdf_tab_observer_.reset(new PDFTabObserver(this)); | 137 pdf_tab_observer_.reset(new PDFTabObserver(this)); |
135 safe_browsing_tab_observer_.reset( | 138 safe_browsing_tab_observer_.reset( |
136 new safe_browsing::SafeBrowsingTabObserver(this)); | 139 new safe_browsing::SafeBrowsingTabObserver(this)); |
137 | 140 |
138 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
139 // Metro mode Chrome on Windows does not support plugins. Avoid registering | 142 // Metro mode Chrome on Windows does not support plugins. Avoid registering |
140 // the PluginObserver so we don't popup plugin-related infobars. | 143 // the PluginObserver so we don't popup plugin-related infobars. |
141 if (!base::win::GetMetroModule()) | 144 if (!base::win::GetMetroModule()) |
142 plugin_observer_.reset(new PluginObserver(this)); | 145 plugin_observer_.reset(new PluginObserver(this)); |
143 #else | 146 #else |
144 plugin_observer_.reset(new PluginObserver(this)); | 147 plugin_observer_.reset(new PluginObserver(this)); |
145 #endif | 148 #endif |
146 | 149 |
147 #if !defined(OS_ANDROID) | 150 #if !defined(OS_ANDROID) |
148 if (OmniboxSearchHint::IsEnabled(profile())) | 151 if (OmniboxSearchHint::IsEnabled(profile())) |
149 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 152 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
153 #endif | |
154 | |
155 #if defined(ENABLE_PRINTING) | |
150 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); | 156 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); |
151 #endif | 157 #endif |
152 | 158 |
153 // Start the in-browser thumbnailing if the feature is enabled. | 159 // Start the in-browser thumbnailing if the feature is enabled. |
154 if (ShouldEnableInBrowserThumbnailing()) { | 160 if (ShouldEnableInBrowserThumbnailing()) { |
155 thumbnail_generator_.reset(new ThumbnailGenerator); | 161 thumbnail_generator_.reset(new ThumbnailGenerator); |
156 thumbnail_generator_->StartThumbnailing(web_contents_.get()); | 162 thumbnail_generator_->StartThumbnailing(web_contents_.get()); |
157 } | 163 } |
158 | 164 |
159 // If this is not an incognito window, setup to handle one-click login. | 165 // If this is not an incognito window, setup to handle one-click login. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 | 261 |
256 //////////////////////////////////////////////////////////////////////////////// | 262 //////////////////////////////////////////////////////////////////////////////// |
257 // WebContentsObserver overrides | 263 // WebContentsObserver overrides |
258 | 264 |
259 void TabContents::WebContentsDestroyed(WebContents* tab) { | 265 void TabContents::WebContentsDestroyed(WebContents* tab) { |
260 // Destruction of the WebContents should only be done by us from our | 266 // Destruction of the WebContents should only be done by us from our |
261 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 267 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
262 // will attempt to access the WebContents and we'll crash. | 268 // will attempt to access the WebContents and we'll crash. |
263 DCHECK(in_destructor_); | 269 DCHECK(in_destructor_); |
264 } | 270 } |
OLD | NEW |