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

Side by Side Diff: chrome/browser/profiles/profile.cc

Issue 7346024: Get rid of the ProfileId. It was added for ceee. I reverted the original change, since it led to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
« no previous file with comments | « chrome/browser/profiles/profile.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | 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) 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/profiles/profile.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 using base::Time; 76 using base::Time;
77 using base::TimeDelta; 77 using base::TimeDelta;
78 78
79 // A pointer to the request context for the default profile. See comments on 79 // A pointer to the request context for the default profile. See comments on
80 // Profile::GetDefaultRequestContext. 80 // Profile::GetDefaultRequestContext.
81 net::URLRequestContextGetter* Profile::default_request_context_; 81 net::URLRequestContextGetter* Profile::default_request_context_;
82 82
83 namespace { 83 namespace {
84 84
85 void NotifyOTRProfileCreatedOnIOThread(ProfileId original_profile_id, 85 void NotifyOTRProfileCreatedOnIOThread(void* original_profile,
86 ProfileId otr_profile_id) { 86 void* otr_profile) {
87 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( 87 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated(
88 original_profile_id, otr_profile_id); 88 original_profile, otr_profile);
89 } 89 }
90 90
91 void NotifyOTRProfileDestroyedOnIOThread(ProfileId original_profile_id, 91 void NotifyOTRProfileDestroyedOnIOThread(void* original_profile,
92 ProfileId otr_profile_id) { 92 void* otr_profile) {
93 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileDestroyed( 93 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileDestroyed(
94 original_profile_id, otr_profile_id); 94 original_profile, otr_profile);
95 } 95 }
96 96
97 } // namespace 97 } // namespace
98 98
99 Profile::Profile() 99 Profile::Profile()
100 : restored_last_session_(false), 100 : restored_last_session_(false),
101 accessibility_pause_level_(0) { 101 accessibility_pause_level_(0) {
102 } 102 }
103 103
104 // static 104 // static
105 const char* Profile::kProfileKey = "__PROFILE__"; 105 const char* Profile::kProfileKey = "__PROFILE__";
106 106
107 // static 107 // static
108 const ProfileId Profile::kInvalidProfileId = static_cast<ProfileId>(0);
109
110 // static
111 void Profile::RegisterUserPrefs(PrefService* prefs) { 108 void Profile::RegisterUserPrefs(PrefService* prefs) {
112 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, 109 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled,
113 true, 110 true,
114 PrefService::SYNCABLE_PREF); 111 PrefService::SYNCABLE_PREF);
115 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, 112 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly,
116 true, 113 true,
117 PrefService::UNSYNCABLE_PREF); 114 PrefService::UNSYNCABLE_PREF);
118 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, 115 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled,
119 true, 116 true,
120 PrefService::SYNCABLE_PREF); 117 PrefService::SYNCABLE_PREF);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 #if defined(OS_CHROMEOS) 237 #if defined(OS_CHROMEOS)
241 GetRequestContext(); 238 GetRequestContext();
242 #endif // defined(OS_CHROMEOS) 239 #endif // defined(OS_CHROMEOS)
243 240
244 // Make the chrome//extension-icon/ resource available. 241 // Make the chrome//extension-icon/ resource available.
245 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); 242 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile);
246 GetChromeURLDataManager()->AddDataSource(icon_source); 243 GetChromeURLDataManager()->AddDataSource(icon_source);
247 244
248 BrowserThread::PostTask( 245 BrowserThread::PostTask(
249 BrowserThread::IO, FROM_HERE, 246 BrowserThread::IO, FROM_HERE,
250 NewRunnableFunction( 247 NewRunnableFunction(&NotifyOTRProfileCreatedOnIOThread, profile_, this));
251 &NotifyOTRProfileCreatedOnIOThread,
252 profile_->GetRuntimeId(), GetRuntimeId()));
253 } 248 }
254 249
255 virtual ~OffTheRecordProfileImpl() { 250 virtual ~OffTheRecordProfileImpl() {
256 NotificationService::current()->Notify( 251 NotificationService::current()->Notify(
257 chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this), 252 chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this),
258 NotificationService::NoDetails()); 253 NotificationService::NoDetails());
259 254
260 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); 255 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
261 256
262 BrowserThread::PostTask( 257 BrowserThread::PostTask(
263 BrowserThread::IO, FROM_HERE, 258 BrowserThread::IO, FROM_HERE,
264 NewRunnableFunction( 259 NewRunnableFunction(
265 &NotifyOTRProfileDestroyedOnIOThread, 260 &NotifyOTRProfileDestroyedOnIOThread, profile_, this));
266 profile_->GetRuntimeId(), GetRuntimeId()));
267 261
268 // Clean up all DB files/directories 262 // Clean up all DB files/directories
269 if (db_tracker_) { 263 if (db_tracker_) {
270 BrowserThread::PostTask( 264 BrowserThread::PostTask(
271 BrowserThread::FILE, FROM_HERE, 265 BrowserThread::FILE, FROM_HERE,
272 NewRunnableMethod( 266 NewRunnableMethod(
273 db_tracker_.get(), 267 db_tracker_.get(),
274 &webkit_database::DatabaseTracker::Shutdown)); 268 &webkit_database::DatabaseTracker::Shutdown));
275 } 269 }
276 270
277 BrowserList::RemoveObserver(this); 271 BrowserList::RemoveObserver(this);
278 272
279 if (host_content_settings_map_) 273 if (host_content_settings_map_)
280 host_content_settings_map_->ShutdownOnUIThread(); 274 host_content_settings_map_->ShutdownOnUIThread();
281 275
282 if (pref_proxy_config_tracker_) 276 if (pref_proxy_config_tracker_)
283 pref_proxy_config_tracker_->DetachFromPrefService(); 277 pref_proxy_config_tracker_->DetachFromPrefService();
284 278
285 ExtensionService* extension_service = GetExtensionService(); 279 ExtensionService* extension_service = GetExtensionService();
286 if (extension_service) { 280 if (extension_service) {
287 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); 281 ExtensionPrefs* extension_prefs = extension_service->extension_prefs();
288 extension_prefs->ClearIncognitoSessionOnlyContentSettings(); 282 extension_prefs->ClearIncognitoSessionOnlyContentSettings();
289 } 283 }
290 } 284 }
291 285
292 virtual ProfileId GetRuntimeId() {
293 return reinterpret_cast<ProfileId>(this);
294 }
295
296 virtual std::string GetProfileName() { 286 virtual std::string GetProfileName() {
297 // Incognito profile should not return the profile name. 287 // Incognito profile should not return the profile name.
298 return std::string(); 288 return std::string();
299 } 289 }
300 290
301 virtual FilePath GetPath() { return profile_->GetPath(); } 291 virtual FilePath GetPath() { return profile_->GetPath(); }
302 292
303 virtual bool IsOffTheRecord() { 293 virtual bool IsOffTheRecord() {
304 return true; 294 return true;
305 } 295 }
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 }; 844 };
855 #endif 845 #endif
856 846
857 Profile* Profile::CreateOffTheRecordProfile() { 847 Profile* Profile::CreateOffTheRecordProfile() {
858 #if defined(OS_CHROMEOS) 848 #if defined(OS_CHROMEOS)
859 if (Profile::IsGuestSession()) 849 if (Profile::IsGuestSession())
860 return new GuestSessionProfile(this); 850 return new GuestSessionProfile(this);
861 #endif 851 #endif
862 return new OffTheRecordProfileImpl(this); 852 return new OffTheRecordProfileImpl(this);
863 } 853 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698