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" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 #if defined(ENABLE_AUTOMATION) | 159 #if defined(ENABLE_AUTOMATION) |
160 automation_tab_helper_.reset(new AutomationTabHelper(contents)); | 160 automation_tab_helper_.reset(new AutomationTabHelper(contents)); |
161 #endif | 161 #endif |
162 | 162 |
163 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 163 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
164 captive_portal_tab_helper_.reset( | 164 captive_portal_tab_helper_.reset( |
165 new captive_portal::CaptivePortalTabHelper(profile(), web_contents())); | 165 new captive_portal::CaptivePortalTabHelper(profile(), web_contents())); |
166 #endif | 166 #endif |
167 | 167 |
168 #if !defined(OS_ANDROID) | 168 #if !defined(OS_ANDROID) |
| 169 if (OmniboxSearchHint::IsEnabled(profile())) |
| 170 OmniboxSearchHint::CreateForWebContents(contents); |
169 PDFTabHelper::CreateForWebContents(contents); | 171 PDFTabHelper::CreateForWebContents(contents); |
170 sad_tab_helper_.reset(new SadTabHelper(contents)); | 172 sad_tab_helper_.reset(new SadTabHelper(contents)); |
171 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); | 173 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); |
172 #endif | 174 #endif |
173 | 175 |
174 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); | 176 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); |
175 navigation_metrics_recorder_.reset(new NavigationMetricsRecorder(contents)); | 177 navigation_metrics_recorder_.reset(new NavigationMetricsRecorder(contents)); |
176 pepper_broker_observer_.reset(new PepperBrokerObserver(contents)); | 178 pepper_broker_observer_.reset(new PepperBrokerObserver(contents)); |
177 plugin_observer_.reset(new PluginObserver(this)); | 179 plugin_observer_.reset(new PluginObserver(this)); |
178 safe_browsing_tab_observer_.reset( | 180 safe_browsing_tab_observer_.reset( |
179 new safe_browsing::SafeBrowsingTabObserver(this)); | 181 new safe_browsing::SafeBrowsingTabObserver(this)); |
180 webnavigation_observer_.reset( | 182 webnavigation_observer_.reset( |
181 new extensions::WebNavigationTabObserver(contents)); | 183 new extensions::WebNavigationTabObserver(contents)); |
182 | 184 |
183 #if !defined(OS_ANDROID) | |
184 if (OmniboxSearchHint::IsEnabled(profile())) | |
185 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | |
186 #endif | |
187 | |
188 #if defined(ENABLE_PRINTING) | 185 #if defined(ENABLE_PRINTING) |
189 print_view_manager_.reset(new printing::PrintViewManager(this)); | 186 print_view_manager_.reset(new printing::PrintViewManager(this)); |
190 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); | 187 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); |
191 #endif | 188 #endif |
192 | 189 |
193 // Start the in-browser thumbnailing if the feature is enabled. | 190 // Start the in-browser thumbnailing if the feature is enabled. |
194 if (ShouldEnableInBrowserThumbnailing()) { | 191 if (ShouldEnableInBrowserThumbnailing()) { |
195 thumbnail_generator_.reset(new ThumbnailGenerator); | 192 thumbnail_generator_.reset(new ThumbnailGenerator); |
196 thumbnail_generator_->StartThumbnailing(web_contents_.get()); | 193 thumbnail_generator_->StartThumbnailing(web_contents_.get()); |
197 } | 194 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 248 |
252 //////////////////////////////////////////////////////////////////////////////// | 249 //////////////////////////////////////////////////////////////////////////////// |
253 // WebContentsObserver overrides | 250 // WebContentsObserver overrides |
254 | 251 |
255 void TabContents::WebContentsDestroyed(WebContents* tab) { | 252 void TabContents::WebContentsDestroyed(WebContents* tab) { |
256 // Destruction of the WebContents should only be done by us from our | 253 // Destruction of the WebContents should only be done by us from our |
257 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 254 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
258 // will attempt to access the WebContents and we'll crash. | 255 // will attempt to access the WebContents and we'll crash. |
259 DCHECK(in_destructor_); | 256 DCHECK(in_destructor_); |
260 } | 257 } |
OLD | NEW |