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

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

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser_context Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_wrapper.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.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_manager.h" 10 #include "chrome/browser/autofill/autofill_manager.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, 163 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED,
164 NotificationService::AllSources()); 164 NotificationService::AllSources());
165 registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED, 165 registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED,
166 NotificationService::AllSources()); 166 NotificationService::AllSources());
167 #if defined(OS_POSIX) && !defined(OS_MACOSX) 167 #if defined(OS_POSIX) && !defined(OS_MACOSX)
168 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 168 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
169 NotificationService::AllSources()); 169 NotificationService::AllSources());
170 #endif 170 #endif
171 171
172 // Register for notifications about all interested prefs change. 172 // Register for notifications about all interested prefs changes.
173 PrefService* prefs = profile()->GetPrefs(); 173 PrefService* prefs = profile()->GetPrefs();
174 pref_change_registrar_.Init(prefs); 174 pref_change_registrar_.Init(prefs);
175 if (prefs) { 175 if (prefs) {
176 for (int i = 0; i < kPrefsToObserveLength; ++i) 176 for (int i = 0; i < kPrefsToObserveLength; ++i)
177 pref_change_registrar_.Add(kPrefsToObserve[i], this); 177 pref_change_registrar_.Add(kPrefsToObserve[i], this);
178 } 178 }
179 179
180 renderer_preferences_util::UpdateFromSystemSettings( 180 renderer_preferences_util::UpdateFromSystemSettings(
181 tab_contents()->GetMutableRendererPrefs(), profile()); 181 tab_contents()->GetMutableRendererPrefs(), profile());
182 } 182 }
183 183
184 TabContentsWrapper::~TabContentsWrapper() { 184 TabContentsWrapper::~TabContentsWrapper() {
185 in_destructor_ = true; 185 in_destructor_ = true;
186 186
187 // Destroy all remaining InfoBars. It's important to not animate here so that 187 // Destroy all remaining InfoBars. It's important to not animate here so that
188 // we guarantee that we'll delete all delegates before we do anything else. 188 // we guarantee that we'll delete all delegates before we do anything else.
189 // 189 //
190 // TODO(pkasting): If there is no InfoBarContainer, this leaks all the 190 // TODO(pkasting): If there is no InfoBarContainer, this leaks all the
191 // InfoBarDelegates. This will be fixed once we call CloseSoon() directly on 191 // InfoBarDelegates. This will be fixed once we call CloseSoon() directly on
192 // Infobars. 192 // Infobars.
193 RemoveAllInfoBars(false); 193 RemoveAllInfoBars(false);
194 } 194 }
195 195
196 Profile* TabContentsWrapper::profile() const {
197 return static_cast<Profile*>(tab_contents_->browser_context());
198 }
199
196 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() { 200 PropertyAccessor<TabContentsWrapper*>* TabContentsWrapper::property_accessor() {
197 return g_tab_contents_wrapper_property_accessor.Pointer(); 201 return g_tab_contents_wrapper_property_accessor.Pointer();
198 } 202 }
199 203
200 void TabContentsWrapper::RegisterUserPrefs(PrefService* prefs) { 204 void TabContentsWrapper::RegisterUserPrefs(PrefService* prefs) {
201 prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled, 205 prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled,
202 true, 206 true,
203 PrefService::SYNCABLE_PREF); 207 PrefService::SYNCABLE_PREF);
204 208
205 WebPreferences pref_defaults; 209 WebPreferences pref_defaults;
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 if (infobars_.empty()) { 686 if (infobars_.empty()) {
683 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 687 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
684 Source<NavigationController>(&tab_contents_->controller())); 688 Source<NavigationController>(&tab_contents_->controller()));
685 } 689 }
686 } 690 }
687 691
688 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { 692 void TabContentsWrapper::RemoveAllInfoBars(bool animate) {
689 while (!infobars_.empty()) 693 while (!infobars_.empty())
690 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); 694 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate);
691 } 695 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698