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

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

Issue 6831016: Profile shouldn't own background page stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months 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 | « chrome/browser/profiles/profile.h ('k') | chrome/browser/profiles/profile_impl.h » ('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/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"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/background_contents_service.h" 17 #include "chrome/browser/background_contents_service_factory.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/content_settings/host_content_settings_map.h" 19 #include "chrome/browser/content_settings/host_content_settings_map.h"
20 #include "chrome/browser/download/download_manager.h" 20 #include "chrome/browser/download/download_manager.h"
21 #include "chrome/browser/extensions/extension_message_service.h" 21 #include "chrome/browser/extensions/extension_message_service.h"
22 #include "chrome/browser/extensions/extension_pref_store.h" 22 #include "chrome/browser/extensions/extension_pref_store.h"
23 #include "chrome/browser/extensions/extension_process_manager.h" 23 #include "chrome/browser/extensions/extension_process_manager.h"
24 #include "chrome/browser/extensions/extension_special_storage_policy.h" 24 #include "chrome/browser/extensions/extension_special_storage_policy.h"
25 #include "chrome/browser/net/pref_proxy_config_service.h" 25 #include "chrome/browser/net/pref_proxy_config_service.h"
26 #include "chrome/browser/prefs/pref_service.h" 26 #include "chrome/browser/prefs/pref_service.h"
27 #include "chrome/browser/profiles/off_the_record_profile_io_data.h" 27 #include "chrome/browser/profiles/off_the_record_profile_io_data.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 public: 159 public:
160 explicit OffTheRecordProfileImpl(Profile* real_profile) 160 explicit OffTheRecordProfileImpl(Profile* real_profile)
161 : profile_(real_profile), 161 : profile_(real_profile),
162 prefs_(real_profile->GetOffTheRecordPrefs()), 162 prefs_(real_profile->GetOffTheRecordPrefs()),
163 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), 163 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)),
164 start_time_(Time::Now()) { 164 start_time_(Time::Now()) {
165 extension_process_manager_.reset(ExtensionProcessManager::Create(this)); 165 extension_process_manager_.reset(ExtensionProcessManager::Create(this));
166 166
167 BrowserList::AddObserver(this); 167 BrowserList::AddObserver(this);
168 168
169 background_contents_service_.reset( 169 BackgroundContentsServiceFactory::GetForProfile(this);
170 new BackgroundContentsService(this, CommandLine::ForCurrentProcess()));
171 170
172 DCHECK(real_profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)); 171 DCHECK(real_profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled));
173 172
174 // TODO(oshima): Remove the need to eagerly initialize the request context 173 // TODO(oshima): Remove the need to eagerly initialize the request context
175 // getter. chromeos::OnlineAttempt is illegally trying to access this 174 // getter. chromeos::OnlineAttempt is illegally trying to access this
176 // Profile member from a thread other than the UI thread, so we need to 175 // Profile member from a thread other than the UI thread, so we need to
177 // prevent a race. 176 // prevent a race.
178 #if defined(OS_CHROMEOS) 177 #if defined(OS_CHROMEOS)
179 GetRequestContext(); 178 GetRequestContext();
180 #endif // defined(OS_CHROMEOS) 179 #endif // defined(OS_CHROMEOS)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 virtual VisitedLinkMaster* GetVisitedLinkMaster() { 259 virtual VisitedLinkMaster* GetVisitedLinkMaster() {
261 // We don't provide access to the VisitedLinkMaster when we're OffTheRecord 260 // We don't provide access to the VisitedLinkMaster when we're OffTheRecord
262 // because we don't want to leak the sites that the user has visited before. 261 // because we don't want to leak the sites that the user has visited before.
263 return NULL; 262 return NULL;
264 } 263 }
265 264
266 virtual ExtensionService* GetExtensionService() { 265 virtual ExtensionService* GetExtensionService() {
267 return GetOriginalProfile()->GetExtensionService(); 266 return GetOriginalProfile()->GetExtensionService();
268 } 267 }
269 268
270 virtual BackgroundContentsService* GetBackgroundContentsService() const {
271 return background_contents_service_.get();
272 }
273
274 virtual StatusTray* GetStatusTray() { 269 virtual StatusTray* GetStatusTray() {
275 return GetOriginalProfile()->GetStatusTray(); 270 return GetOriginalProfile()->GetStatusTray();
276 } 271 }
277 272
278 virtual UserScriptMaster* GetUserScriptMaster() { 273 virtual UserScriptMaster* GetUserScriptMaster() {
279 return GetOriginalProfile()->GetUserScriptMaster(); 274 return GetOriginalProfile()->GetUserScriptMaster();
280 } 275 }
281 276
282 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() { 277 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() {
283 // TODO(mpcomplete): figure out whether we should return the original 278 // TODO(mpcomplete): figure out whether we should return the original
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 Time start_time_; 714 Time start_time_;
720 715
721 scoped_refptr<ChromeAppCacheService> appcache_service_; 716 scoped_refptr<ChromeAppCacheService> appcache_service_;
722 717
723 // The main database tracker for this profile. 718 // The main database tracker for this profile.
724 // Should be used only on the file thread. 719 // Should be used only on the file thread.
725 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; 720 scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
726 721
727 FilePath last_selected_directory_; 722 FilePath last_selected_directory_;
728 723
729 // Tracks all BackgroundContents running under this profile.
730 scoped_ptr<BackgroundContentsService> background_contents_service_;
731
732 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 724 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
733 725
734 // The file_system context for this profile. 726 // The file_system context for this profile.
735 scoped_refptr<fileapi::FileSystemContext> file_system_context_; 727 scoped_refptr<fileapi::FileSystemContext> file_system_context_;
736 728
737 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; 729 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
738 730
739 scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_; 731 scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_;
740 732
741 // Used read-only. 733 // Used read-only.
(...skipping 26 matching lines...) Expand all
768 }; 760 };
769 #endif 761 #endif
770 762
771 Profile* Profile::CreateOffTheRecordProfile() { 763 Profile* Profile::CreateOffTheRecordProfile() {
772 #if defined(OS_CHROMEOS) 764 #if defined(OS_CHROMEOS)
773 if (Profile::IsGuestSession()) 765 if (Profile::IsGuestSession())
774 return new GuestSessionProfile(this); 766 return new GuestSessionProfile(this);
775 #endif 767 #endif
776 return new OffTheRecordProfileImpl(this); 768 return new OffTheRecordProfileImpl(this);
777 } 769 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile.h ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698