| OLD | NEW |
| 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/profiles/off_the_record_profile_impl.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // prevent a race. | 107 // prevent a race. |
| 108 #if defined(OS_CHROMEOS) | 108 #if defined(OS_CHROMEOS) |
| 109 GetRequestContext(); | 109 GetRequestContext(); |
| 110 #endif // defined(OS_CHROMEOS) | 110 #endif // defined(OS_CHROMEOS) |
| 111 | 111 |
| 112 // Make the chrome//extension-icon/ resource available. | 112 // Make the chrome//extension-icon/ resource available. |
| 113 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); | 113 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); |
| 114 GetChromeURLDataManager()->AddDataSource(icon_source); | 114 GetChromeURLDataManager()->AddDataSource(icon_source); |
| 115 | 115 |
| 116 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 116 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 117 PluginPrefs::GetForProfile(this), &GetResourceContext()); | 117 PluginPrefs::GetForProfile(this), &io_data_.GetResourceContextNoInit()); |
| 118 | 118 |
| 119 BrowserThread::PostTask( | 119 BrowserThread::PostTask( |
| 120 BrowserThread::IO, FROM_HERE, | 120 BrowserThread::IO, FROM_HERE, |
| 121 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); | 121 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { | 124 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { |
| 125 content::NotificationService::current()->Notify( | 125 content::NotificationService::current()->Notify( |
| 126 chrome::NOTIFICATION_PROFILE_DESTROYED, content::Source<Profile>(this), | 126 chrome::NOTIFICATION_PROFILE_DESTROYED, content::Source<Profile>(this), |
| 127 content::NotificationService::NoDetails()); | 127 content::NotificationService::NoDetails()); |
| 128 | 128 |
| 129 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 129 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
| 130 &GetResourceContext()); | 130 &io_data_.GetResourceContextNoInit()); |
| 131 | 131 |
| 132 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 132 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
| 133 | 133 |
| 134 BrowserThread::PostTask( | 134 BrowserThread::PostTask( |
| 135 BrowserThread::IO, FROM_HERE, | 135 BrowserThread::IO, FROM_HERE, |
| 136 base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this)); | 136 base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this)); |
| 137 | 137 |
| 138 // Clean up all DB files/directories | 138 // Clean up all DB files/directories |
| 139 if (db_tracker_) { | 139 if (db_tracker_) { |
| 140 BrowserThread::PostTask( | 140 BrowserThread::PostTask( |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 false, quota_manager_->proxy(), | 627 false, quota_manager_->proxy(), |
| 628 BrowserThread::GetMessageLoopProxyForThread( | 628 BrowserThread::GetMessageLoopProxyForThread( |
| 629 BrowserThread::WEBKIT_DEPRECATED)); | 629 BrowserThread::WEBKIT_DEPRECATED)); |
| 630 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 630 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
| 631 BrowserThread::PostTask( | 631 BrowserThread::PostTask( |
| 632 BrowserThread::IO, FROM_HERE, | 632 BrowserThread::IO, FROM_HERE, |
| 633 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 633 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, |
| 634 appcache_service_.get(), | 634 appcache_service_.get(), |
| 635 IsOffTheRecord() | 635 IsOffTheRecord() |
| 636 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 636 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
| 637 &GetResourceContext(), | 637 &io_data_.GetResourceContextNoInit(), |
| 638 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); | 638 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); |
| 639 } | 639 } |
| 640 | 640 |
| 641 #if defined(OS_CHROMEOS) | 641 #if defined(OS_CHROMEOS) |
| 642 // Special case of the OffTheRecordProfileImpl which is used while Guest | 642 // Special case of the OffTheRecordProfileImpl which is used while Guest |
| 643 // session in CrOS. | 643 // session in CrOS. |
| 644 class GuestSessionProfile : public OffTheRecordProfileImpl { | 644 class GuestSessionProfile : public OffTheRecordProfileImpl { |
| 645 public: | 645 public: |
| 646 explicit GuestSessionProfile(Profile* real_profile) | 646 explicit GuestSessionProfile(Profile* real_profile) |
| 647 : OffTheRecordProfileImpl(real_profile) { | 647 : OffTheRecordProfileImpl(real_profile) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 662 OffTheRecordProfileImpl* profile = NULL; | 662 OffTheRecordProfileImpl* profile = NULL; |
| 663 #if defined(OS_CHROMEOS) | 663 #if defined(OS_CHROMEOS) |
| 664 if (Profile::IsGuestSession()) | 664 if (Profile::IsGuestSession()) |
| 665 profile = new GuestSessionProfile(this); | 665 profile = new GuestSessionProfile(this); |
| 666 #endif | 666 #endif |
| 667 if (!profile) | 667 if (!profile) |
| 668 profile = new OffTheRecordProfileImpl(this); | 668 profile = new OffTheRecordProfileImpl(this); |
| 669 profile->Init(); | 669 profile->Init(); |
| 670 return profile; | 670 return profile; |
| 671 } | 671 } |
| OLD | NEW |