| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 // Create the tab helpers. | 109 // Create the tab helpers. |
| 110 | 110 |
| 111 // SessionTabHelper comes first because it sets up the tab ID, and other | 111 // SessionTabHelper comes first because it sets up the tab ID, and other |
| 112 // helpers may rely on that. | 112 // helpers may rely on that. |
| 113 SessionTabHelper::CreateForWebContents(contents); | 113 SessionTabHelper::CreateForWebContents(contents); |
| 114 | 114 |
| 115 AlternateErrorPageTabObserver::CreateForWebContents(contents); | 115 AlternateErrorPageTabObserver::CreateForWebContents(contents); |
| 116 AutocompleteHistoryManager::CreateForWebContents(contents); | 116 AutocompleteHistoryManager::CreateForWebContents(contents); |
| 117 TabAutofillManagerDelegate::CreateForWebContents(contents); | 117 TabAutofillManagerDelegate::CreateForWebContents(contents); |
| 118 autofill_manager_ = | 118 AutofillManager::CreateForWebContentsAndDelegate( |
| 119 new AutofillManager(TabAutofillManagerDelegate::FromWebContents(contents), | 119 contents, |
| 120 this); | 120 TabAutofillManagerDelegate::FromWebContents(contents)); |
| 121 if (CommandLine::ForCurrentProcess()->HasSwitch( | 121 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 122 switches::kExternalAutofillPopup)) { | 122 switches::kExternalAutofillPopup)) { |
| 123 autofill_external_delegate_.reset( | 123 autofill_external_delegate_.reset(AutofillExternalDelegate::Create( |
| 124 AutofillExternalDelegate::Create(this, autofill_manager_.get())); | 124 this, AutofillManager::FromWebContents(contents))); |
| 125 autofill_manager_->SetExternalDelegate(autofill_external_delegate_.get()); | 125 AutofillManager::FromWebContents(contents)->SetExternalDelegate( |
| 126 autofill_external_delegate_.get()); |
| 126 AutocompleteHistoryManager::FromWebContents(contents)->SetExternalDelegate( | 127 AutocompleteHistoryManager::FromWebContents(contents)->SetExternalDelegate( |
| 127 autofill_external_delegate_.get()); | 128 autofill_external_delegate_.get()); |
| 128 } | 129 } |
| 129 BlockedContentTabHelper::CreateForWebContents(contents); | 130 BlockedContentTabHelper::CreateForWebContents(contents); |
| 130 BookmarkTabHelper::CreateForWebContents(contents); | 131 BookmarkTabHelper::CreateForWebContents(contents); |
| 131 chrome_browser_net::LoadTimeStatsTabHelper::CreateForWebContents(contents); | 132 chrome_browser_net::LoadTimeStatsTabHelper::CreateForWebContents(contents); |
| 132 ConstrainedWindowTabHelper::CreateForWebContents(contents); | 133 ConstrainedWindowTabHelper::CreateForWebContents(contents); |
| 133 CoreTabHelper::CreateForWebContents(contents); | 134 CoreTabHelper::CreateForWebContents(contents); |
| 134 extensions::TabHelper::CreateForWebContents(contents); | 135 extensions::TabHelper::CreateForWebContents(contents); |
| 135 extensions::WebNavigationTabObserver::CreateForWebContents(contents); | 136 extensions::WebNavigationTabObserver::CreateForWebContents(contents); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 238 |
| 238 //////////////////////////////////////////////////////////////////////////////// | 239 //////////////////////////////////////////////////////////////////////////////// |
| 239 // WebContentsObserver overrides | 240 // WebContentsObserver overrides |
| 240 | 241 |
| 241 void TabContents::WebContentsDestroyed(WebContents* tab) { | 242 void TabContents::WebContentsDestroyed(WebContents* tab) { |
| 242 // Destruction of the WebContents should only be done by us from our | 243 // Destruction of the WebContents should only be done by us from our |
| 243 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 244 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
| 244 // will attempt to access the WebContents and we'll crash. | 245 // will attempt to access the WebContents and we'll crash. |
| 245 DCHECK(in_destructor_); | 246 DCHECK(in_destructor_); |
| 246 } | 247 } |
| OLD | NEW |