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