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

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: Win fix. 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 GetPath(), IsOffTheRecord(), false, GetExtensionSpecialStoragePolicy(), 604 GetPath(), IsOffTheRecord(), false, GetExtensionSpecialStoragePolicy(),
607 quota_manager_->proxy(), 605 quota_manager_->proxy(),
608 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 606 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
609 webkit_context_ = new WebKitContext( 607 webkit_context_ = new WebKitContext(
610 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(), 608 IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
611 false, quota_manager_->proxy(), 609 false, quota_manager_->proxy(),
612 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT)); 610 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT));
613 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); 611 appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
614 BrowserThread::PostTask( 612 BrowserThread::PostTask(
615 BrowserThread::IO, FROM_HERE, 613 BrowserThread::IO, FROM_HERE,
616 NewRunnableMethod( 614 base::Bind(&ChromeAppCacheService::InitializeOnIOThread,
617 appcache_service_.get(), 615 appcache_service_.get(),
618 &ChromeAppCacheService::InitializeOnIOThread, 616 IsOffTheRecord()
619 IsOffTheRecord() 617 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
620 ? FilePath() : GetPath().Append(chrome::kAppCacheDirname), 618 &GetResourceContext(),
621 &GetResourceContext(), 619 make_scoped_refptr(GetExtensionSpecialStoragePolicy())));
622 make_scoped_refptr(GetExtensionSpecialStoragePolicy())));
623 } 620 }
624 621
625 #if defined(OS_CHROMEOS) 622 #if defined(OS_CHROMEOS)
626 // Special case of the OffTheRecordProfileImpl which is used while Guest 623 // Special case of the OffTheRecordProfileImpl which is used while Guest
627 // session in CrOS. 624 // session in CrOS.
628 class GuestSessionProfile : public OffTheRecordProfileImpl { 625 class GuestSessionProfile : public OffTheRecordProfileImpl {
629 public: 626 public:
630 explicit GuestSessionProfile(Profile* real_profile) 627 explicit GuestSessionProfile(Profile* real_profile)
631 : OffTheRecordProfileImpl(real_profile) { 628 : OffTheRecordProfileImpl(real_profile) {
632 } 629 }
(...skipping 13 matching lines...) Expand all
646 OffTheRecordProfileImpl* profile = NULL; 643 OffTheRecordProfileImpl* profile = NULL;
647 #if defined(OS_CHROMEOS) 644 #if defined(OS_CHROMEOS)
648 if (Profile::IsGuestSession()) 645 if (Profile::IsGuestSession())
649 profile = new GuestSessionProfile(this); 646 profile = new GuestSessionProfile(this);
650 #endif 647 #endif
651 if (!profile) 648 if (!profile)
652 profile = new OffTheRecordProfileImpl(this); 649 profile = new OffTheRecordProfileImpl(this);
653 profile->Init(); 650 profile->Init();
654 return profile; 651 return profile;
655 } 652 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_impl.cc » ('j') | chrome/browser/profiles/profile_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698