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

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

Issue 8399028: base::Bind: Convert chrome/browser/profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More win fox. Created 9 years, 1 month 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 | « no previous file | chrome/browser/profiles/profile_impl.cc » ('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/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/command_line.h" 8 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 10 #include "base/file_path.h"
10 #include "base/file_util.h" 11 #include "base/file_util.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "chrome/browser/background/background_contents_service_factory.h" 16 #include "chrome/browser/background/background_contents_service_factory.h"
16 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 106
106 // Make the chrome//extension-icon/ resource available. 107 // Make the chrome//extension-icon/ resource available.
107 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_); 108 ExtensionIconSource* icon_source = new ExtensionIconSource(profile_);
108 GetChromeURLDataManager()->AddDataSource(icon_source); 109 GetChromeURLDataManager()->AddDataSource(icon_source);
109 110
110 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( 111 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
111 PluginPrefs::GetForProfile(this), &GetResourceContext()); 112 PluginPrefs::GetForProfile(this), &GetResourceContext());
112 113
113 BrowserThread::PostTask( 114 BrowserThread::PostTask(
114 BrowserThread::IO, FROM_HERE, 115 BrowserThread::IO, FROM_HERE,
115 NewRunnableFunction( 116 base::Bind(&NotifyOTRProfileCreatedOnIOThread, profile_, this));
116 &NotifyOTRProfileCreatedOnIOThread, profile_, this));
117 } 117 }
118 118
119 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() { 119 OffTheRecordProfileImpl::~OffTheRecordProfileImpl() {
120 content::NotificationService::current()->Notify( 120 content::NotificationService::current()->Notify(
121 chrome::NOTIFICATION_PROFILE_DESTROYED, content::Source<Profile>(this), 121 chrome::NOTIFICATION_PROFILE_DESTROYED, content::Source<Profile>(this),
122 content::NotificationService::NoDetails()); 122 content::NotificationService::NoDetails());
123 123
124 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( 124 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
125 &GetResourceContext()); 125 &GetResourceContext());
126 126
127 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); 127 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
128 128
129 BrowserThread::PostTask( 129 BrowserThread::PostTask(
130 BrowserThread::IO, FROM_HERE, 130 BrowserThread::IO, FROM_HERE,
131 NewRunnableFunction(&NotifyOTRProfileDestroyedOnIOThread, profile_, 131 base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this));
132 this));
133 132
134 // Clean up all DB files/directories 133 // Clean up all DB files/directories
135 if (db_tracker_) { 134 if (db_tracker_) {
136 BrowserThread::PostTask( 135 BrowserThread::PostTask(
137 BrowserThread::FILE, FROM_HERE, 136 BrowserThread::FILE, FROM_HERE,
138 NewRunnableMethod(db_tracker_.get(), 137 base::Bind(&webkit_database::DatabaseTracker::Shutdown,
139 &webkit_database::DatabaseTracker::Shutdown)); 138 db_tracker_.get()));
140 } 139 }
141 140
142 BrowserList::RemoveObserver(this); 141 BrowserList::RemoveObserver(this);
143 142
144 if (host_content_settings_map_) 143 if (host_content_settings_map_)
145 host_content_settings_map_->ShutdownOnUIThread(); 144 host_content_settings_map_->ShutdownOnUIThread();
146 145
147 if (pref_proxy_config_tracker_) 146 if (pref_proxy_config_tracker_)
148 pref_proxy_config_tracker_->DetachFromPrefService(); 147 pref_proxy_config_tracker_->DetachFromPrefService();
149 148
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 509 }
511 510
512 void OffTheRecordProfileImpl::OnBrowserRemoved(const Browser* browser) { 511 void OffTheRecordProfileImpl::OnBrowserRemoved(const Browser* browser) {
513 } 512 }
514 513
515 ChromeBlobStorageContext* OffTheRecordProfileImpl::GetBlobStorageContext() { 514 ChromeBlobStorageContext* OffTheRecordProfileImpl::GetBlobStorageContext() {
516 if (!blob_storage_context_) { 515 if (!blob_storage_context_) {
517 blob_storage_context_ = new ChromeBlobStorageContext(); 516 blob_storage_context_ = new ChromeBlobStorageContext();
518 BrowserThread::PostTask( 517 BrowserThread::PostTask(
519 BrowserThread::IO, FROM_HERE, 518 BrowserThread::IO, FROM_HERE,
520 NewRunnableMethod( 519 base::Bind(&ChromeBlobStorageContext::InitializeOnIOThread,
521 blob_storage_context_.get(), 520 blob_storage_context_.get()));
522 &ChromeBlobStorageContext::InitializeOnIOThread));
523 } 521 }
524 return blob_storage_context_; 522 return blob_storage_context_;
525 } 523 }
526 524
527 ExtensionInfoMap* OffTheRecordProfileImpl::GetExtensionInfoMap() { 525 ExtensionInfoMap* OffTheRecordProfileImpl::GetExtensionInfoMap() {
528 return profile_->GetExtensionInfoMap(); 526 return profile_->GetExtensionInfoMap();
529 } 527 }
530 528
531 ChromeURLDataManager* OffTheRecordProfileImpl::GetChromeURLDataManager() { 529 ChromeURLDataManager* OffTheRecordProfileImpl::GetChromeURLDataManager() {
532 if (!chrome_url_data_manager_.get()) 530 if (!chrome_url_data_manager_.get())
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 GetPath(), IsOffTheRecord(), false, GetExtensionSpecialStoragePolicy(), 608 GetPath(), IsOffTheRecord(), false, GetExtensionSpecialStoragePolicy(),
611 quota_manager_->proxy(), 609 quota_manager_->proxy(),
612 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 610 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
613 webkit_context_ = new WebKitContext( 611 webkit_context_ = new WebKitContext(
614 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), 612 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
615 false, quota_manager_->proxy(), 613 false, quota_manager_->proxy(),
616 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); 614 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT));
617 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); 615 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
618 BrowserThread::PostTask( 616 BrowserThread::PostTask(
619 BrowserThread::IO, FROM_HERE, 617 BrowserThread::IO, FROM_HERE,
620 NewRunnableMethod( 618 base::Bind(&ChromeAppCacheService::InitializeOnIOThread,
621 appcache_service_.get(), 619 appcache_service_.get(),
622 &ChromeAppCacheService::InitializeOnIOThread, 620 IsOffTheRecord()
623 IsOffTheRecord() 621 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
624 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), 622 &GetResourceContext(),
625 &GetResourceContext(), 623 make_scoped_refptr(GetExtensionSpecialStoragePolicy())));
626 make_scoped_refptr(GetExtensionSpecialStoragePolicy())));
627 } 624 }
628 625
629 #if defined(OS_CHROMEOS) 626 #if defined(OS_CHROMEOS)
630 // Special case of the OffTheRecordProfileImpl which is used while Guest 627 // Special case of the OffTheRecordProfileImpl which is used while Guest
631 // session in CrOS. 628 // session in CrOS.
632 class GuestSessionProfile : public OffTheRecordProfileImpl { 629 class GuestSessionProfile : public OffTheRecordProfileImpl {
633 public: 630 public:
634 explicit GuestSessionProfile(Profile* real_profile) 631 explicit GuestSessionProfile(Profile* real_profile)
635 : OffTheRecordProfileImpl(real_profile) { 632 : OffTheRecordProfileImpl(real_profile) {
636 } 633 }
(...skipping 13 matching lines...) Expand all
650 OffTheRecordProfileImpl* profile = NULL; 647 OffTheRecordProfileImpl* profile = NULL;
651 #if defined(OS_CHROMEOS) 648 #if defined(OS_CHROMEOS)
652 if (Profile::IsGuestSession()) 649 if (Profile::IsGuestSession())
653 profile = new GuestSessionProfile(this); 650 profile = new GuestSessionProfile(this);
654 #endif 651 #endif
655 if (!profile) 652 if (!profile)
656 profile = new OffTheRecordProfileImpl(this); 653 profile = new OffTheRecordProfileImpl(this);
657 profile->Init(); 654 profile->Init();
658 return profile; 655 return profile;
659 } 656 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698