| 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 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/ui/alternate_error_tab_observer.h" | 33 #include "chrome/browser/ui/alternate_error_tab_observer.h" |
| 34 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 34 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 35 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 35 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 36 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 36 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 37 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 37 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 38 #include "chrome/browser/ui/hung_plugin_tab_helper.h" | 38 #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
| 39 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 39 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 40 #include "chrome/browser/ui/pdf/pdf_tab_observer.h" | 40 #include "chrome/browser/ui/pdf/pdf_tab_observer.h" |
| 41 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 41 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| 42 #include "chrome/browser/ui/sad_tab_helper.h" | 42 #include "chrome/browser/ui/sad_tab_helper.h" |
| 43 #include "chrome/browser/ui/search/search.h" |
| 44 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 43 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 45 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 44 #include "chrome/browser/ui/snapshot_tab_helper.h" | 46 #include "chrome/browser/ui/snapshot_tab_helper.h" |
| 45 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 47 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 46 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" | 48 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h" |
| 47 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 49 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 48 #include "chrome/browser/ui/zoom/zoom_controller.h" | 50 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 49 #include "chrome/browser/view_type_utils.h" | 51 #include "chrome/browser/view_type_utils.h" |
| 50 #include "chrome/common/chrome_notification_types.h" | 52 #include "chrome/common/chrome_notification_types.h" |
| 51 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
| 52 #include "chrome/common/thumbnail_support.h" | 54 #include "chrome/common/thumbnail_support.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 history_tab_helper_.reset(new HistoryTabHelper(contents)); | 112 history_tab_helper_.reset(new HistoryTabHelper(contents)); |
| 111 hung_plugin_tab_helper_.reset(new HungPluginTabHelper(contents)); | 113 hung_plugin_tab_helper_.reset(new HungPluginTabHelper(contents)); |
| 112 infobar_tab_helper_.reset(new InfoBarTabHelper(contents)); | 114 infobar_tab_helper_.reset(new InfoBarTabHelper(contents)); |
| 113 password_manager_delegate_.reset(new PasswordManagerDelegateImpl(this)); | 115 password_manager_delegate_.reset(new PasswordManagerDelegateImpl(this)); |
| 114 password_manager_.reset( | 116 password_manager_.reset( |
| 115 new PasswordManager(contents, password_manager_delegate_.get())); | 117 new PasswordManager(contents, password_manager_delegate_.get())); |
| 116 prefs_tab_helper_.reset(new PrefsTabHelper(contents)); | 118 prefs_tab_helper_.reset(new PrefsTabHelper(contents)); |
| 117 prerender_tab_helper_.reset(new prerender::PrerenderTabHelper(this)); | 119 prerender_tab_helper_.reset(new prerender::PrerenderTabHelper(this)); |
| 118 restore_tab_helper_.reset(new RestoreTabHelper(contents)); | 120 restore_tab_helper_.reset(new RestoreTabHelper(contents)); |
| 119 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); | 121 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); |
| 122 bool is_search_enabled = |
| 123 chrome::search::IsInstantExtendedAPIEnabled(profile()); |
| 124 search_tab_helper_.reset( |
| 125 new chrome::search::SearchTabHelper(this, is_search_enabled)); |
| 120 snapshot_tab_helper_.reset(new SnapshotTabHelper(contents)); | 126 snapshot_tab_helper_.reset(new SnapshotTabHelper(contents)); |
| 121 ssl_helper_.reset(new TabContentsSSLHelper(this)); | 127 ssl_helper_.reset(new TabContentsSSLHelper(this)); |
| 122 synced_tab_delegate_.reset(new TabContentsSyncedTabDelegate(this)); | 128 synced_tab_delegate_.reset(new TabContentsSyncedTabDelegate(this)); |
| 123 content_settings_.reset(new TabSpecificContentSettings(contents)); | 129 content_settings_.reset(new TabSpecificContentSettings(contents)); |
| 124 translate_tab_helper_.reset(new TranslateTabHelper(contents)); | 130 translate_tab_helper_.reset(new TranslateTabHelper(contents)); |
| 125 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); | 131 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); |
| 126 zoom_controller_.reset(new ZoomController(this)); | 132 zoom_controller_.reset(new ZoomController(this)); |
| 127 | 133 |
| 128 #if !defined(OS_ANDROID) | 134 #if !defined(OS_ANDROID) |
| 129 sad_tab_helper_.reset(new SadTabHelper(contents)); | 135 sad_tab_helper_.reset(new SadTabHelper(contents)); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 245 |
| 240 //////////////////////////////////////////////////////////////////////////////// | 246 //////////////////////////////////////////////////////////////////////////////// |
| 241 // WebContentsObserver overrides | 247 // WebContentsObserver overrides |
| 242 | 248 |
| 243 void TabContents::WebContentsDestroyed(WebContents* tab) { | 249 void TabContents::WebContentsDestroyed(WebContents* tab) { |
| 244 // Destruction of the WebContents should only be done by us from our | 250 // 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) | 251 // 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. | 252 // will attempt to access the WebContents and we'll crash. |
| 247 DCHECK(in_destructor_); | 253 DCHECK(in_destructor_); |
| 248 } | 254 } |
| OLD | NEW |