| 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" | |
| 10 #include "chrome/browser/autofill/autofill_external_delegate.h" | 9 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 11 #include "chrome/browser/autofill/autofill_manager.h" | 10 #include "chrome/browser/autofill/autofill_manager.h" |
| 12 #include "chrome/browser/automation/automation_tab_helper.h" | 11 #include "chrome/browser/automation/automation_tab_helper.h" |
| 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 12 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 14 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 13 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 15 #include "chrome/browser/extensions/tab_helper.h" | 14 #include "chrome/browser/extensions/tab_helper.h" |
| 16 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 15 #include "chrome/browser/external_protocol/external_protocol_observer.h" |
| 17 #include "chrome/browser/favicon/favicon_tab_helper.h" | 16 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 18 #include "chrome/browser/history/history_tab_helper.h" | 17 #include "chrome/browser/history/history_tab_helper.h" |
| 19 #include "chrome/browser/infobars/infobar_tab_helper.h" | 18 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 contents->SetUserData(&kTabContentsUserDataKey, | 105 contents->SetUserData(&kTabContentsUserDataKey, |
| 107 new TabContentsUserData(this)); | 106 new TabContentsUserData(this)); |
| 108 | 107 |
| 109 // Create the tab helpers. | 108 // Create the tab helpers. |
| 110 | 109 |
| 111 // SessionTabHelper comes first because it sets up the tab ID, and other | 110 // SessionTabHelper comes first because it sets up the tab ID, and other |
| 112 // helpers may rely on that. | 111 // helpers may rely on that. |
| 113 SessionTabHelper::CreateForWebContents(contents); | 112 SessionTabHelper::CreateForWebContents(contents); |
| 114 | 113 |
| 115 AlternateErrorPageTabObserver::CreateForWebContents(contents); | 114 AlternateErrorPageTabObserver::CreateForWebContents(contents); |
| 116 AutocompleteHistoryManager::CreateForWebContents(contents); | |
| 117 TabAutofillManagerDelegate::CreateForWebContents(contents); | 115 TabAutofillManagerDelegate::CreateForWebContents(contents); |
| 118 AutofillManager::CreateForWebContentsAndDelegate( | 116 AutofillManager::CreateForWebContentsAndDelegate( |
| 119 contents, TabAutofillManagerDelegate::FromWebContents(contents)); | 117 contents, TabAutofillManagerDelegate::FromWebContents(contents)); |
| 120 if (CommandLine::ForCurrentProcess()->HasSwitch( | 118 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 121 switches::kExternalAutofillPopup)) { | 119 switches::kExternalAutofillPopup)) { |
| 122 AutofillExternalDelegate::CreateForWebContentsAndManager( | 120 AutofillExternalDelegate::CreateForWebContentsAndManager( |
| 123 contents, AutofillManager::FromWebContents(contents)); | 121 contents, AutofillManager::FromWebContents(contents)); |
| 124 AutofillManager::FromWebContents(contents)->SetExternalDelegate( | 122 AutofillManager::FromWebContents(contents)->SetExternalDelegate( |
| 125 AutofillExternalDelegate::FromWebContents(contents)); | 123 AutofillExternalDelegate::FromWebContents(contents)); |
| 126 AutocompleteHistoryManager::FromWebContents(contents)->SetExternalDelegate( | |
| 127 AutofillExternalDelegate::FromWebContents(contents)); | |
| 128 } | 124 } |
| 129 BlockedContentTabHelper::CreateForWebContents(contents); | 125 BlockedContentTabHelper::CreateForWebContents(contents); |
| 130 BookmarkTabHelper::CreateForWebContents(contents); | 126 BookmarkTabHelper::CreateForWebContents(contents); |
| 131 chrome_browser_net::LoadTimeStatsTabHelper::CreateForWebContents(contents); | 127 chrome_browser_net::LoadTimeStatsTabHelper::CreateForWebContents(contents); |
| 132 ConstrainedWindowTabHelper::CreateForWebContents(contents); | 128 ConstrainedWindowTabHelper::CreateForWebContents(contents); |
| 133 CoreTabHelper::CreateForWebContents(contents); | 129 CoreTabHelper::CreateForWebContents(contents); |
| 134 extensions::TabHelper::CreateForWebContents(contents); | 130 extensions::TabHelper::CreateForWebContents(contents); |
| 135 extensions::WebNavigationTabObserver::CreateForWebContents(contents); | 131 extensions::WebNavigationTabObserver::CreateForWebContents(contents); |
| 136 ExternalProtocolObserver::CreateForWebContents(contents); | 132 ExternalProtocolObserver::CreateForWebContents(contents); |
| 137 FaviconTabHelper::CreateForWebContents(contents); | 133 FaviconTabHelper::CreateForWebContents(contents); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 222 |
| 227 //////////////////////////////////////////////////////////////////////////////// | 223 //////////////////////////////////////////////////////////////////////////////// |
| 228 // WebContentsObserver overrides | 224 // WebContentsObserver overrides |
| 229 | 225 |
| 230 void TabContents::WebContentsDestroyed(WebContents* tab) { | 226 void TabContents::WebContentsDestroyed(WebContents* tab) { |
| 231 // Destruction of the WebContents should only be done by us from our | 227 // Destruction of the WebContents should only be done by us from our |
| 232 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 228 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
| 233 // will attempt to access the WebContents and we'll crash. | 229 // will attempt to access the WebContents and we'll crash. |
| 234 DCHECK(in_destructor_); | 230 DCHECK(in_destructor_); |
| 235 } | 231 } |
| OLD | NEW |