| 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 void NotifyOTRProfileCreatedOnIOThread(ProfileId original_profile_id, |
| 85 ProfileId otr_profile_id) { |
| 86 ExtensionWebRequestEventRouter::GetInstance()->OnOTRProfileCreated( |
| 87 original_profile_id, otr_profile_id); |
| 88 } |
| 89 |
| 90 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // getter. chromeos::OnlineAttempt is illegally trying to access this | 236 // getter. chromeos::OnlineAttempt is illegally trying to access this |
| 225 // Profile member from a thread other than the UI thread, so we need to | 237 // Profile member from a thread other than the UI thread, so we need to |
| 226 // prevent a race. | 238 // prevent a race. |
| 227 #if defined(OS_CHROMEOS) | 239 #if defined(OS_CHROMEOS) |
| 228 GetRequestContext(); | 240 GetRequestContext(); |
| 229 #endif // defined(OS_CHROMEOS) | 241 #endif // defined(OS_CHROMEOS) |
| 230 | 242 |
| 231 // Make the chrome//extension-icon/ resource available. | 243 // Make the chrome//extension-icon/ resource available. |
| 232 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); | 244 ExtensionIconSource* icon_source = new ExtensionIconSource(real_profile); |
| 233 GetChromeURLDataManager()->AddDataSource(icon_source); | 245 GetChromeURLDataManager()->AddDataSource(icon_source); |
| 246 |
| 247 BrowserThread::PostTask( |
| 248 BrowserThread::IO, FROM_HERE, |
| 249 NewRunnableFunction( |
| 250 &NotifyOTRProfileCreatedOnIOThread, |
| 251 profile_->GetRuntimeId(), GetRuntimeId())); |
| 234 } | 252 } |
| 235 | 253 |
| 236 virtual ~OffTheRecordProfileImpl() { | 254 virtual ~OffTheRecordProfileImpl() { |
| 237 NotificationService::current()->Notify(NotificationType::PROFILE_DESTROYED, | 255 NotificationService::current()->Notify(NotificationType::PROFILE_DESTROYED, |
| 238 Source<Profile>(this), | 256 Source<Profile>(this), |
| 239 NotificationService::NoDetails()); | 257 NotificationService::NoDetails()); |
| 240 | 258 |
| 241 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 259 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 242 | 260 |
| 261 BrowserThread::PostTask( |
| 262 BrowserThread::IO, FROM_HERE, |
| 263 NewRunnableFunction( |
| 264 &NotifyOTRProfileDestroyedOnIOThread, |
| 265 profile_->GetRuntimeId(), GetRuntimeId())); |
| 266 |
| 243 // Clean up all DB files/directories | 267 // Clean up all DB files/directories |
| 244 if (db_tracker_) | 268 if (db_tracker_) |
| 245 BrowserThread::PostTask( | 269 BrowserThread::PostTask( |
| 246 BrowserThread::FILE, FROM_HERE, | 270 BrowserThread::FILE, FROM_HERE, |
| 247 NewRunnableMethod( | 271 NewRunnableMethod( |
| 248 db_tracker_.get(), | 272 db_tracker_.get(), |
| 249 &webkit_database::DatabaseTracker::DeleteIncognitoDBDirectory)); | 273 &webkit_database::DatabaseTracker::DeleteIncognitoDBDirectory)); |
| 250 | 274 |
| 251 BrowserList::RemoveObserver(this); | 275 BrowserList::RemoveObserver(this); |
| 252 | 276 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 }; | 851 }; |
| 828 #endif | 852 #endif |
| 829 | 853 |
| 830 Profile* Profile::CreateOffTheRecordProfile() { | 854 Profile* Profile::CreateOffTheRecordProfile() { |
| 831 #if defined(OS_CHROMEOS) | 855 #if defined(OS_CHROMEOS) |
| 832 if (Profile::IsGuestSession()) | 856 if (Profile::IsGuestSession()) |
| 833 return new GuestSessionProfile(this); | 857 return new GuestSessionProfile(this); |
| 834 #endif | 858 #endif |
| 835 return new OffTheRecordProfileImpl(this); | 859 return new OffTheRecordProfileImpl(this); |
| 836 } | 860 } |
| OLD | NEW |