Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 74 |
| 75 using base::Time; | 75 using base::Time; |
| 76 using base::TimeDelta; | 76 using base::TimeDelta; |
| 77 | 77 |
| 78 // A pointer to the request context for the default profile. See comments on | 78 // A pointer to the request context for the default profile. See comments on |
| 79 // Profile::GetDefaultRequestContext. | 79 // Profile::GetDefaultRequestContext. |
| 80 net::URLRequestContextGetter* Profile::default_request_context_; | 80 net::URLRequestContextGetter* Profile::default_request_context_; |
| 81 | 81 |
| 82 namespace { | 82 namespace { |
| 83 | 83 |
| 84 static void NotifyOTRProfileCreatedOnIOThread(ProfileId original_profile_id, | |
|
Mihai Parparita -not on Chrome
2011/06/08 01:11:59
I thought that using an anonymous namespace was eq
Matt Perry
2011/06/08 20:47:00
Done.
(There's a slight difference, but it doesn'
| |
| 85 ProfileId otr_profile_id) { | |
| 86 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( | |
| 87 original_profile_id, otr_profile_id); | |
| 88 } | |
| 89 | |
| 90 static void NotifyOTRProfileDestroyedOnIOThread(ProfileId original_profile_id, | |
| 91 ProfileId otr_profile_id) { | |
| 92 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileDestroyed( | |
| 93 original_profile_id, otr_profile_id); | |
| 94 } | |
| 95 | |
| 84 } // namespace | 96 } // namespace |
| 85 | 97 |
| 86 Profile::Profile() | 98 Profile::Profile() |
| 87 : restored_last_session_(false), | 99 : restored_last_session_(false), |
| 88 accessibility_pause_level_(0) { | 100 accessibility_pause_level_(0) { |
| 89 } | 101 } |
| 90 | 102 |
| 91 // static | 103 // static |
| 92 const char* Profile::kProfileKey = "__PROFILE__"; | 104 const char* Profile::kProfileKey = "__PROFILE__"; |
| 93 | 105 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 // getter. chromeos::OnlineAttempt is illegally trying to access this | 228 // getter. chromeos::OnlineAttempt is illegally trying to access this |
| 217 // Profile member from a thread other than the UI thread, so we need to | 229 // Profile member from a thread other than the UI thread, so we need to |
| 218 // prevent a race. | 230 // prevent a race. |
| 219 #if defined(OS_CHROMEOS) | 231 #if defined(OS_CHROMEOS) |
| 220 GetRequestContext(); | 232 GetRequestContext(); |
| 221 #endif // defined(OS_CHROMEOS) | 233 #endif // defined(OS_CHROMEOS) |
| 222 | 234 |
| 223 // Make the chrome//extension-icon/ resource available. | 235 // Make the chrome//extension-icon/ resource available. |
| 224 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); | 236 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); |
| 225 GetChromeURLDataManager()->AddDataSource(icon_source); | 237 GetChromeURLDataManager()->AddDataSource(icon_source); |
| 238 | |
| 239 BrowserThread::PostTask( | |
| 240 BrowserThread::IO, FROM_HERE, | |
| 241 NewRunnableFunction( | |
| 242 &NotifyOTRProfileCreatedOnIOThread, | |
| 243 profile_->GetRuntimeId(), reinterpret_cast<ProfileId>(this))); | |
|
Mihai Parparita -not on Chrome
2011/06/08 01:11:59
Use GetRuntimeId instead of the cast? I think that
Matt Perry
2011/06/08 20:47:00
Done.
| |
| 226 } | 244 } |
| 227 | 245 |
| 228 virtual ~OffTheRecordProfileImpl() { | 246 virtual ~OffTheRecordProfileImpl() { |
| 229 NotificationService::current()->Notify(NotificationType::PROFILE_DESTROYED, | 247 NotificationService::current()->Notify(NotificationType::PROFILE_DESTROYED, |
| 230 Source<Profile>(this), | 248 Source<Profile>(this), |
| 231 NotificationService::NoDetails()); | 249 NotificationService::NoDetails()); |
| 232 | 250 |
| 233 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 251 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 234 | 252 |
| 253 BrowserThread::PostTask( | |
| 254 BrowserThread::IO, FROM_HERE, | |
| 255 NewRunnableFunction( | |
| 256 &NotifyOTRProfileDestroyedOnIOThread, | |
| 257 profile_->GetRuntimeId(), reinterpret_cast<ProfileId>(this))); | |
|
Mihai Parparita -not on Chrome
2011/06/08 01:11:59
Ditto.
Matt Perry
2011/06/08 20:47:00
Done.
| |
| 258 | |
| 235 // Clean up all DB files/directories | 259 // Clean up all DB files/directories |
| 236 if (db_tracker_) | 260 if (db_tracker_) |
| 237 BrowserThread::PostTask( | 261 BrowserThread::PostTask( |
| 238 BrowserThread::FILE, FROM_HERE, | 262 BrowserThread::FILE, FROM_HERE, |
| 239 NewRunnableMethod( | 263 NewRunnableMethod( |
| 240 db_tracker_.get(), | 264 db_tracker_.get(), |
| 241 &webkit_database::DatabaseTracker::DeleteIncognitoDBDirectory)); | 265 &webkit_database::DatabaseTracker::DeleteIncognitoDBDirectory)); |
| 242 | 266 |
| 243 BrowserList::RemoveObserver(this); | 267 BrowserList::RemoveObserver(this); |
| 244 | 268 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 }; | 843 }; |
| 820 #endif | 844 #endif |
| 821 | 845 |
| 822 Profile* Profile::CreateOffTheRecordProfile() { | 846 Profile* Profile::CreateOffTheRecordProfile() { |
| 823 #if defined(OS_CHROMEOS) | 847 #if defined(OS_CHROMEOS) |
| 824 if (Profile::IsGuestSession()) | 848 if (Profile::IsGuestSession()) |
| 825 return new GuestSessionProfile(this); | 849 return new GuestSessionProfile(this); |
| 826 #endif | 850 #endif |
| 827 return new OffTheRecordProfileImpl(this); | 851 return new OffTheRecordProfileImpl(this); |
| 828 } | 852 } |
| OLD | NEW |