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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // prevent a race. | 106 // prevent a race. |
107 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
108 GetRequestContext(); | 108 GetRequestContext(); |
109 #endif // defined(OS_CHROMEOS) | 109 #endif // defined(OS_CHROMEOS) |
110 | 110 |
111 // Make the chrome//extension-icon/ resource available. | 111 // Make the chrome//extension-icon/ resource available. |
112 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); | 112 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); |
113 GetChromeURLDataManager()->AddDataSource(icon_source); | 113 GetChromeURLDataManager()->AddDataSource(icon_source); |
114 | 114 |
115 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 115 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
116 PluginPrefs::GetForProfile(this), &io_data_.GetResourceContextNoInit()); | 116 PluginPrefs::GetForProfile(this), io_data_.GetResourceContextNoInit()); |
117 | 117 |
118 BrowserThread::PostTask( | 118 BrowserThread::PostTask( |
119 BrowserThread::IO, FROM_HERE, | 119 BrowserThread::IO, FROM_HERE, |
120 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); | 120 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this)); |
121 } | 121 } |
122 | 122 |
123 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { | 123 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { |
124 content::NotificationService::current()->Notify( | 124 content::NotificationService::current()->Notify( |
125 chrome::NOTIFICATION_PROFILE_DESTROYED, content::Source<Profile>(this), | 125 chrome::NOTIFICATION_PROFILE_DESTROYED, content::Source<Profile>(this), |
126 content::NotificationService::NoDetails()); | 126 content::NotificationService::NoDetails()); |
127 | 127 |
128 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 128 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
129 &io_data_.GetResourceContextNoInit()); | 129 io_data_.GetResourceContextNoInit()); |
130 | 130 |
131 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 131 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); |
132 | 132 |
133 BrowserThread::PostTask( | 133 BrowserThread::PostTask( |
134 BrowserThread::IO, FROM_HERE, | 134 BrowserThread::IO, FROM_HERE, |
135 base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this)); | 135 base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this)); |
136 | 136 |
137 // Clean up all DB files/directories | 137 // Clean up all DB files/directories |
138 if (db_tracker_) { | 138 if (db_tracker_) { |
139 BrowserThread::PostTask( | 139 BrowserThread::PostTask( |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 OffTheRecordProfileImpl::GetRequestContextForExtensions() { | 361 OffTheRecordProfileImpl::GetRequestContextForExtensions() { |
362 return io_data_.GetExtensionsRequestContextGetter(); | 362 return io_data_.GetExtensionsRequestContextGetter(); |
363 } | 363 } |
364 | 364 |
365 net::URLRequestContextGetter* | 365 net::URLRequestContextGetter* |
366 OffTheRecordProfileImpl::GetRequestContextForIsolatedApp( | 366 OffTheRecordProfileImpl::GetRequestContextForIsolatedApp( |
367 const std::string& app_id) { | 367 const std::string& app_id) { |
368 return io_data_.GetIsolatedAppRequestContextGetter(app_id); | 368 return io_data_.GetIsolatedAppRequestContextGetter(app_id); |
369 } | 369 } |
370 | 370 |
371 const content::ResourceContext& | 371 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { |
372 OffTheRecordProfileImpl::GetResourceContext() { | |
373 return io_data_.GetResourceContext(); | 372 return io_data_.GetResourceContext(); |
374 } | 373 } |
375 | 374 |
376 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { | 375 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { |
377 return profile_->GetSSLConfigService(); | 376 return profile_->GetSSLConfigService(); |
378 } | 377 } |
379 | 378 |
380 HostContentSettingsMap* OffTheRecordProfileImpl::GetHostContentSettingsMap() { | 379 HostContentSettingsMap* OffTheRecordProfileImpl::GetHostContentSettingsMap() { |
381 // Retrieve the host content settings map of the parent profile in order to | 380 // Retrieve the host content settings map of the parent profile in order to |
382 // ensure the preferences have been migrated. | 381 // ensure the preferences have been migrated. |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 false, quota_manager_->proxy(), | 599 false, quota_manager_->proxy(), |
601 BrowserThread::GetMessageLoopProxyForThread( | 600 BrowserThread::GetMessageLoopProxyForThread( |
602 BrowserThread::WEBKIT_DEPRECATED)); | 601 BrowserThread::WEBKIT_DEPRECATED)); |
603 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); | 602 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); |
604 BrowserThread::PostTask( | 603 BrowserThread::PostTask( |
605 BrowserThread::IO, FROM_HERE, | 604 BrowserThread::IO, FROM_HERE, |
606 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, | 605 base::Bind(&ChromeAppCacheService::InitializeOnIOThread, |
607 appcache_service_.get(), | 606 appcache_service_.get(), |
608 IsOffTheRecord() | 607 IsOffTheRecord() |
609 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), | 608 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), |
610 &io_data_.GetResourceContextNoInit(), | 609 io_data_.GetResourceContextNoInit(), |
611 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); | 610 make_scoped_refptr(GetExtensionSpecialStoragePolicy()))); |
612 } | 611 } |
613 | 612 |
614 #if defined(OS_CHROMEOS) | 613 #if defined(OS_CHROMEOS) |
615 // Special case of the OffTheRecordProfileImpl which is used while Guest | 614 // Special case of the OffTheRecordProfileImpl which is used while Guest |
616 // session in CrOS. | 615 // session in CrOS. |
617 class GuestSessionProfile : public OffTheRecordProfileImpl { | 616 class GuestSessionProfile : public OffTheRecordProfileImpl { |
618 public: | 617 public: |
619 explicit GuestSessionProfile(Profile* real_profile) | 618 explicit GuestSessionProfile(Profile* real_profile) |
620 : OffTheRecordProfileImpl(real_profile) { | 619 : OffTheRecordProfileImpl(real_profile) { |
(...skipping 14 matching lines...) Expand all Loading... |
635 OffTheRecordProfileImpl* profile = NULL; | 634 OffTheRecordProfileImpl* profile = NULL; |
636 #if defined(OS_CHROMEOS) | 635 #if defined(OS_CHROMEOS) |
637 if (Profile::IsGuestSession()) | 636 if (Profile::IsGuestSession()) |
638 profile = new GuestSessionProfile(this); | 637 profile = new GuestSessionProfile(this); |
639 #endif | 638 #endif |
640 if (!profile) | 639 if (!profile) |
641 profile = new OffTheRecordProfileImpl(this); | 640 profile = new OffTheRecordProfileImpl(this); |
642 profile->Init(); | 641 profile->Init(); |
643 return profile; | 642 return profile; |
644 } | 643 } |
OLD | NEW |