Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/ui/tab_contents/tab_contents.cc

Issue 10907268: Switch AlternateErrorPageTabObserver to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // Stash this in the WebContents. 107 // Stash this in the WebContents.
108 contents->SetUserData(&kTabContentsUserDataKey, 108 contents->SetUserData(&kTabContentsUserDataKey,
109 new TabContentsUserData(this)); 109 new TabContentsUserData(this));
110 110
111 // Create the tab helpers. 111 // Create the tab helpers.
112 112
113 // SessionTabHelper comes first because it sets up the tab ID, and other 113 // SessionTabHelper comes first because it sets up the tab ID, and other
114 // helpers may rely on that. 114 // helpers may rely on that.
115 SessionTabHelper::CreateForWebContents(contents); 115 SessionTabHelper::CreateForWebContents(contents);
116 116
117 AlternateErrorPageTabObserver::CreateForWebContents(contents);
117 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents)); 118 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(contents));
118 autofill_delegate_.reset(new TabAutofillManagerDelegate(this)); 119 autofill_delegate_.reset(new TabAutofillManagerDelegate(this));
119 autofill_manager_ = new AutofillManager(autofill_delegate_.get(), this); 120 autofill_manager_ = new AutofillManager(autofill_delegate_.get(), this);
120 if (CommandLine::ForCurrentProcess()->HasSwitch( 121 if (CommandLine::ForCurrentProcess()->HasSwitch(
121 switches::kExternalAutofillPopup)) { 122 switches::kExternalAutofillPopup)) {
122 autofill_external_delegate_.reset( 123 autofill_external_delegate_.reset(
123 AutofillExternalDelegate::Create(this, autofill_manager_.get())); 124 AutofillExternalDelegate::Create(this, autofill_manager_.get()));
124 autofill_manager_->SetExternalDelegate(autofill_external_delegate_.get()); 125 autofill_manager_->SetExternalDelegate(autofill_external_delegate_.get());
125 autocomplete_history_manager_->SetExternalDelegate( 126 autocomplete_history_manager_->SetExternalDelegate(
126 autofill_external_delegate_.get()); 127 autofill_external_delegate_.get());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 synced_tab_delegate_.reset(new TabContentsSyncedTabDelegate(this)); 161 synced_tab_delegate_.reset(new TabContentsSyncedTabDelegate(this));
161 content_settings_.reset(new TabSpecificContentSettings(contents)); 162 content_settings_.reset(new TabSpecificContentSettings(contents));
162 translate_tab_helper_.reset(new TranslateTabHelper(contents)); 163 translate_tab_helper_.reset(new TranslateTabHelper(contents));
163 zoom_controller_.reset(new ZoomController(this)); 164 zoom_controller_.reset(new ZoomController(this));
164 165
165 #if !defined(OS_ANDROID) 166 #if !defined(OS_ANDROID)
166 web_intent_picker_controller_.reset(new WebIntentPickerController(this)); 167 web_intent_picker_controller_.reset(new WebIntentPickerController(this));
167 sad_tab_helper_.reset(new SadTabHelper(contents)); 168 sad_tab_helper_.reset(new SadTabHelper(contents));
168 #endif 169 #endif
169 170
170 // Create the per-tab observers.
171 alternate_error_page_tab_observer_.reset(
172 new AlternateErrorPageTabObserver(contents, profile()));
173 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); 171 external_protocol_observer_.reset(new ExternalProtocolObserver(contents));
174 navigation_metrics_recorder_.reset(new NavigationMetricsRecorder(contents)); 172 navigation_metrics_recorder_.reset(new NavigationMetricsRecorder(contents));
175 pdf_tab_observer_.reset(new PDFTabObserver(this)); 173 pdf_tab_observer_.reset(new PDFTabObserver(this));
176 pepper_broker_observer_.reset(new PepperBrokerObserver(contents)); 174 pepper_broker_observer_.reset(new PepperBrokerObserver(contents));
177 plugin_observer_.reset(new PluginObserver(this)); 175 plugin_observer_.reset(new PluginObserver(this));
178 safe_browsing_tab_observer_.reset( 176 safe_browsing_tab_observer_.reset(
179 new safe_browsing::SafeBrowsingTabObserver(this)); 177 new safe_browsing::SafeBrowsingTabObserver(this));
180 webnavigation_observer_.reset( 178 webnavigation_observer_.reset(
181 new extensions::WebNavigationTabObserver(contents)); 179 new extensions::WebNavigationTabObserver(contents));
182 180
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 249
252 //////////////////////////////////////////////////////////////////////////////// 250 ////////////////////////////////////////////////////////////////////////////////
253 // WebContentsObserver overrides 251 // WebContentsObserver overrides
254 252
255 void TabContents::WebContentsDestroyed(WebContents* tab) { 253 void TabContents::WebContentsDestroyed(WebContents* tab) {
256 // Destruction of the WebContents should only be done by us from our 254 // 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) 255 // 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. 256 // will attempt to access the WebContents and we'll crash.
259 DCHECK(in_destructor_); 257 DCHECK(in_destructor_);
260 } 258 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698