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

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

Issue 258008: Move initialization of ChromeURLRequestContexts to the IO thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again, just in case Created 11 years, 2 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/profile.h ('k') | chrome/browser/profile_manager.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/profile.h" 5 #include "chrome/browser/profile.h"
6 6
7 #include "app/theme_provider.h" 7 #include "app/theme_provider.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 bool HasACacheSubdir(const FilePath &dir) { 118 bool HasACacheSubdir(const FilePath &dir) {
119 return file_util::PathExists(GetCachePath(dir)) || 119 return file_util::PathExists(GetCachePath(dir)) ||
120 file_util::PathExists(GetMediaCachePath(dir)); 120 file_util::PathExists(GetMediaCachePath(dir));
121 } 121 }
122 122
123 } // namespace 123 } // namespace
124 124
125 // A pointer to the request context for the default profile. See comments on 125 // A pointer to the request context for the default profile. See comments on
126 // Profile::GetDefaultRequestContext. 126 // Profile::GetDefaultRequestContext.
127 URLRequestContext* Profile::default_request_context_; 127 URLRequestContextGetter* Profile::default_request_context_;
128 128
129 static void CleanupRequestContext(ChromeURLRequestContext* context) { 129 static void CleanupRequestContext(ChromeURLRequestContextGetter* context) {
130 if (context) { 130 if (context) {
131 context->CleanupOnUIThread(); 131 context->CleanupOnUIThread();
132 132
133 // Clean up request context on IO thread. 133 // Clean up request context on IO thread.
134 g_browser_process->io_thread()->message_loop()->ReleaseSoon(FROM_HERE, 134 g_browser_process->io_thread()->message_loop()->ReleaseSoon(FROM_HERE,
135 context); 135 context);
136 } 136 }
137 } 137 }
138 138
139 static void CleanupAppCacheService(ChromeAppCacheService* appcache_service) {
140 if (appcache_service) {
141 // The I/O thread may be NULL during testing.
142 base::Thread* io_thread = g_browser_process->io_thread();
143 if (io_thread)
144 io_thread->message_loop()->ReleaseSoon(FROM_HERE, appcache_service);
145 else
146 appcache_service->Release();
147 }
148 }
149
150 // static 139 // static
151 const ProfileId Profile::InvalidProfileId = static_cast<ProfileId>(0); 140 const ProfileId Profile::InvalidProfileId = static_cast<ProfileId>(0);
152 141
153 // static 142 // static
154 void Profile::RegisterUserPrefs(PrefService* prefs) { 143 void Profile::RegisterUserPrefs(PrefService* prefs) {
155 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); 144 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true);
156 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); 145 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true);
157 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); 146 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true);
158 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. 147 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string.
159 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, 148 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary,
(...skipping 12 matching lines...) Expand all
172 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); 161 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties);
173 prefs->RegisterBooleanPref(prefs::kDisableExtensions, false); 162 prefs->RegisterBooleanPref(prefs::kDisableExtensions, false);
174 } 163 }
175 164
176 // static 165 // static
177 Profile* Profile::CreateProfile(const FilePath& path) { 166 Profile* Profile::CreateProfile(const FilePath& path) {
178 return new ProfileImpl(path); 167 return new ProfileImpl(path);
179 } 168 }
180 169
181 // static 170 // static
182 URLRequestContext* Profile::GetDefaultRequestContext() { 171 URLRequestContextGetter* Profile::GetDefaultRequestContext() {
183 return default_request_context_; 172 return default_request_context_;
184 } 173 }
185 174
186 #if defined(OS_LINUX) 175 #if defined(OS_LINUX)
187 // Temporarily disabled while we figure some stuff out. 176 // Temporarily disabled while we figure some stuff out.
188 // http://code.google.com/p/chromium/issues/detail?id=12351 177 // http://code.google.com/p/chromium/issues/detail?id=12351
189 // #include "chrome/browser/password_manager/password_store_gnome.h" 178 // #include "chrome/browser/password_manager/password_store_gnome.h"
190 // #include "chrome/browser/password_manager/password_store_kwallet.h" 179 // #include "chrome/browser/password_manager/password_store_kwallet.h"
191 #elif defined(OS_WIN) 180 #elif defined(OS_WIN)
192 #include "chrome/browser/password_manager/password_store_win.h" 181 #include "chrome/browser/password_manager/password_store_win.h"
193 #elif defined(OS_MACOSX) 182 #elif defined(OS_MACOSX)
194 #include "chrome/browser/keychain_mac.h" 183 #include "chrome/browser/keychain_mac.h"
195 #include "chrome/browser/password_manager/login_database_mac.h" 184 #include "chrome/browser/password_manager/login_database_mac.h"
196 #include "chrome/browser/password_manager/password_store_mac.h" 185 #include "chrome/browser/password_manager/password_store_mac.h"
197 #endif 186 #endif
198 187
199 //////////////////////////////////////////////////////////////////////////////// 188 ////////////////////////////////////////////////////////////////////////////////
200 // 189 //
201 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile 190 // OffTheRecordProfileImpl is a profile subclass that wraps an existing profile
202 // to make it suitable for the off the record mode. 191 // to make it suitable for the off the record mode.
203 // 192 //
204 //////////////////////////////////////////////////////////////////////////////// 193 ////////////////////////////////////////////////////////////////////////////////
205 class OffTheRecordProfileImpl : public Profile, 194 class OffTheRecordProfileImpl : public Profile,
206 public NotificationObserver { 195 public NotificationObserver {
207 public: 196 public:
208 explicit OffTheRecordProfileImpl(Profile* real_profile) 197 explicit OffTheRecordProfileImpl(Profile* real_profile)
209 : profile_(real_profile), 198 : profile_(real_profile),
210 extensions_request_context_(NULL), 199 extensions_request_context_(NULL),
211 start_time_(Time::Now()) { 200 start_time_(Time::Now()) {
212 // Created here but lazily inititialized later, finally released on 201 request_context_ = ChromeURLRequestContextGetter::CreateOffTheRecord(this);
213 // on the io thread, see CleanupAppCacheService.
214 appcache_service_ = new ChromeAppCacheService();
215 appcache_service_->AddRef();
216
217 request_context_ = ChromeURLRequestContext::CreateOffTheRecord(
218 this, appcache_service_);
219 request_context_->AddRef(); 202 request_context_->AddRef();
220 203
221 // Register for browser close notifications so we can detect when the last 204 // Register for browser close notifications so we can detect when the last
222 // off-the-record window is closed, in which case we can clean our states 205 // off-the-record window is closed, in which case we can clean our states
223 // (cookies, downloads...). 206 // (cookies, downloads...).
224 registrar_.Add(this, NotificationType::BROWSER_CLOSED, 207 registrar_.Add(this, NotificationType::BROWSER_CLOSED,
225 NotificationService::AllSources()); 208 NotificationService::AllSources());
226 } 209 }
227 210
228 virtual ~OffTheRecordProfileImpl() { 211 virtual ~OffTheRecordProfileImpl() {
229 CleanupRequestContext(request_context_); 212 CleanupRequestContext(request_context_);
230 CleanupRequestContext(extensions_request_context_); 213 CleanupRequestContext(extensions_request_context_);
231 CleanupAppCacheService(appcache_service_);
232 } 214 }
233 215
234 virtual ProfileId GetRuntimeId() { 216 virtual ProfileId GetRuntimeId() {
235 return reinterpret_cast<ProfileId>(this); 217 return reinterpret_cast<ProfileId>(this);
236 } 218 }
237 219
238 virtual FilePath GetPath() { return profile_->GetPath(); } 220 virtual FilePath GetPath() { return profile_->GetPath(); }
239 221
240 virtual bool IsOffTheRecord() { 222 virtual bool IsOffTheRecord() {
241 return true; 223 return true;
242 } 224 }
243 225
244 virtual Profile* GetOffTheRecordProfile() { 226 virtual Profile* GetOffTheRecordProfile() {
245 return this; 227 return this;
246 } 228 }
247 229
248 virtual void DestroyOffTheRecordProfile() { 230 virtual void DestroyOffTheRecordProfile() {
249 // Suicide is bad! 231 // Suicide is bad!
250 NOTREACHED(); 232 NOTREACHED();
251 } 233 }
252 234
253 virtual Profile* GetOriginalProfile() { 235 virtual Profile* GetOriginalProfile() {
254 return profile_; 236 return profile_;
255 } 237 }
256 238
257 virtual ChromeAppCacheService* GetAppCacheService() {
258 DCHECK(request_context_); // should be created in ctor
259 if (!appcache_service_->is_initialized())
260 appcache_service_->InitializeOnUIThread(GetPath(), true);
261 return appcache_service_;
262 }
263
264 virtual VisitedLinkMaster* GetVisitedLinkMaster() { 239 virtual VisitedLinkMaster* GetVisitedLinkMaster() {
265 // We don't provide access to the VisitedLinkMaster when we're OffTheRecord 240 // We don't provide access to the VisitedLinkMaster when we're OffTheRecord
266 // because we don't want to leak the sites that the user has visited before. 241 // because we don't want to leak the sites that the user has visited before.
267 return NULL; 242 return NULL;
268 } 243 }
269 244
270 virtual ExtensionsService* GetExtensionsService() { 245 virtual ExtensionsService* GetExtensionsService() {
271 return NULL; 246 return NULL;
272 } 247 }
273 248
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 361 }
387 362
388 virtual Extension* GetTheme() { 363 virtual Extension* GetTheme() {
389 return GetOriginalProfile()->GetTheme(); 364 return GetOriginalProfile()->GetTheme();
390 } 365 }
391 366
392 virtual ThemeProvider* GetThemeProvider() { 367 virtual ThemeProvider* GetThemeProvider() {
393 return GetOriginalProfile()->GetThemeProvider(); 368 return GetOriginalProfile()->GetThemeProvider();
394 } 369 }
395 370
396 virtual URLRequestContext* GetRequestContext() { 371 virtual URLRequestContextGetter* GetRequestContext() {
397 return request_context_; 372 return request_context_;
398 } 373 }
399 374
400 virtual URLRequestContext* GetRequestContextForMedia() { 375 virtual URLRequestContextGetter* GetRequestContextForMedia() {
401 // In OTR mode, media request context is the same as the original one. 376 // In OTR mode, media request context is the same as the original one.
402 return request_context_; 377 return request_context_;
403 } 378 }
404 379
405 URLRequestContext* GetRequestContextForExtensions() { 380 URLRequestContextGetter* GetRequestContextForExtensions() {
406 if (!extensions_request_context_) { 381 if (!extensions_request_context_) {
407 extensions_request_context_ = 382 extensions_request_context_ =
408 ChromeURLRequestContext::CreateOffTheRecordForExtensions(this); 383 ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions(this);
409 extensions_request_context_->AddRef(); 384 extensions_request_context_->AddRef();
410
411 DCHECK(extensions_request_context_->cookie_store());
412 } 385 }
413 386
414 return extensions_request_context_; 387 return extensions_request_context_;
415 } 388 }
416 389
417 virtual net::SSLConfigService* GetSSLConfigService() { 390 virtual net::SSLConfigService* GetSSLConfigService() {
418 return GetOriginalProfile()->GetSSLConfigService(); 391 return GetOriginalProfile()->GetSSLConfigService();
419 } 392 }
420 393
421 virtual Blacklist* GetBlacklist() { 394 virtual Blacklist* GetBlacklist() {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 ExitedOffTheRecordMode(); 513 ExitedOffTheRecordMode();
541 } 514 }
542 515
543 private: 516 private:
544 NotificationRegistrar registrar_; 517 NotificationRegistrar registrar_;
545 518
546 // The real underlying profile. 519 // The real underlying profile.
547 Profile* profile_; 520 Profile* profile_;
548 521
549 // The context to use for requests made from this OTR session. 522 // The context to use for requests made from this OTR session.
550 ChromeURLRequestContext* request_context_; 523 ChromeURLRequestContextGetter* request_context_;
551 524
552 ChromeURLRequestContext* extensions_request_context_; 525 ChromeURLRequestContextGetter* extensions_request_context_;
553
554 // Use a seperate appcache service for OTR.
555 ChromeAppCacheService* appcache_service_;
556 526
557 // The download manager that only stores downloaded items in memory. 527 // The download manager that only stores downloaded items in memory.
558 scoped_refptr<DownloadManager> download_manager_; 528 scoped_refptr<DownloadManager> download_manager_;
559 529
560 // Use a special WebKit context for OTR browsing. 530 // Use a special WebKit context for OTR browsing.
561 scoped_refptr<WebKitContext> webkit_context_; 531 scoped_refptr<WebKitContext> webkit_context_;
562 532
563 // We don't want SSLHostState from the OTR profile to leak back to the main 533 // We don't want SSLHostState from the OTR profile to leak back to the main
564 // profile because then the main profile would learn some of the host names 534 // profile because then the main profile would learn some of the host names
565 // the user visited while OTR. 535 // the user visited while OTR.
(...skipping 30 matching lines...) Expand all
596 "profile files to the root directory!"; 566 "profile files to the root directory!";
597 create_session_service_timer_.Start( 567 create_session_service_timer_.Start(
598 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, 568 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this,
599 &ProfileImpl::EnsureSessionServiceCreated); 569 &ProfileImpl::EnsureSessionServiceCreated);
600 570
601 if (CommandLine::ForCurrentProcess()->HasSwitch( 571 if (CommandLine::ForCurrentProcess()->HasSwitch(
602 switches::kEnableExtensionTimelineApi)) { 572 switches::kEnableExtensionTimelineApi)) {
603 extension_devtools_manager_ = new ExtensionDevToolsManager(this); 573 extension_devtools_manager_ = new ExtensionDevToolsManager(this);
604 } 574 }
605 575
606 // Created here but lazily inititialized later, finally released on
607 // on the io thread, see CleanupAppCacheService.
608 appcache_service_ = new ChromeAppCacheService();
609 appcache_service_->AddRef();
610
611 extension_process_manager_.reset(new ExtensionProcessManager(this)); 576 extension_process_manager_.reset(new ExtensionProcessManager(this));
612 extension_message_service_ = new ExtensionMessageService(this); 577 extension_message_service_ = new ExtensionMessageService(this);
613 578
614 PrefService* prefs = GetPrefs(); 579 PrefService* prefs = GetPrefs();
615 prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this); 580 prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this);
616 prefs->AddPrefObserver(prefs::kEnableSpellCheck, this); 581 prefs->AddPrefObserver(prefs::kEnableSpellCheck, this);
617 prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this); 582 prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this);
618 583
619 if (CommandLine::ForCurrentProcess()-> 584 if (CommandLine::ForCurrentProcess()->
620 HasSwitch(switches::kPrivacyBlacklist)) { 585 HasSwitch(switches::kPrivacyBlacklist)) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 // We use default_request_context_ for OCSP. 746 // We use default_request_context_ for OCSP.
782 // Release URLRequestContext used in OCSP handlers. 747 // Release URLRequestContext used in OCSP handlers.
783 net::SetURLRequestContextForOCSP(NULL); 748 net::SetURLRequestContextForOCSP(NULL);
784 #endif 749 #endif
785 default_request_context_ = NULL; 750 default_request_context_ = NULL;
786 } 751 }
787 752
788 CleanupRequestContext(request_context_); 753 CleanupRequestContext(request_context_);
789 CleanupRequestContext(media_request_context_); 754 CleanupRequestContext(media_request_context_);
790 CleanupRequestContext(extensions_request_context_); 755 CleanupRequestContext(extensions_request_context_);
791 CleanupAppCacheService(appcache_service_);
792 756
793 // When the request contexts are gone, the blacklist wont be needed anymore. 757 // When the request contexts are gone, the blacklist wont be needed anymore.
794 delete blacklist_; 758 delete blacklist_;
795 blacklist_ = 0; 759 blacklist_ = 0;
796 760
797 // HistoryService may call into the BookmarkModel, as such we need to 761 // HistoryService may call into the BookmarkModel, as such we need to
798 // delete HistoryService before the BookmarkModel. The destructor for 762 // delete HistoryService before the BookmarkModel. The destructor for
799 // HistoryService will join with HistoryService's backend thread so that 763 // HistoryService will join with HistoryService's backend thread so that
800 // by the time the destructor has finished we're sure it will no longer call 764 // by the time the destructor has finished we're sure it will no longer call
801 // into the BookmarkModel. 765 // into the BookmarkModel.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 } 800 }
837 801
838 void ProfileImpl::DestroyOffTheRecordProfile() { 802 void ProfileImpl::DestroyOffTheRecordProfile() {
839 off_the_record_profile_.reset(); 803 off_the_record_profile_.reset();
840 } 804 }
841 805
842 Profile* ProfileImpl::GetOriginalProfile() { 806 Profile* ProfileImpl::GetOriginalProfile() {
843 return this; 807 return this;
844 } 808 }
845 809
846 ChromeAppCacheService* ProfileImpl::GetAppCacheService() {
847 if (!appcache_service_->is_initialized()) {
848 EnsureRequestContextCreated();
849 appcache_service_->InitializeOnUIThread(GetPath(), false);
850 }
851 return appcache_service_;
852 }
853
854 VisitedLinkMaster* ProfileImpl::GetVisitedLinkMaster() { 810 VisitedLinkMaster* ProfileImpl::GetVisitedLinkMaster() {
855 if (!visited_link_master_.get()) { 811 if (!visited_link_master_.get()) {
856 scoped_ptr<VisitedLinkMaster> visited_links( 812 scoped_ptr<VisitedLinkMaster> visited_links(
857 new VisitedLinkMaster(g_browser_process->file_thread(), 813 new VisitedLinkMaster(g_browser_process->file_thread(),
858 visited_link_event_listener_.get(), this)); 814 visited_link_event_listener_.get(), this));
859 if (!visited_links->Init()) 815 if (!visited_links->Init())
860 return NULL; 816 return NULL;
861 visited_link_master_.swap(visited_links); 817 visited_link_master_.swap(visited_links);
862 } 818 }
863 819
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 888
933 return prefs_.get(); 889 return prefs_.get();
934 } 890 }
935 891
936 FilePath ProfileImpl::GetPrefFilePath() { 892 FilePath ProfileImpl::GetPrefFilePath() {
937 FilePath pref_file_path = path_; 893 FilePath pref_file_path = path_;
938 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); 894 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename);
939 return pref_file_path; 895 return pref_file_path;
940 } 896 }
941 897
942 URLRequestContext* ProfileImpl::GetRequestContext() { 898 URLRequestContextGetter* ProfileImpl::GetRequestContext() {
943 if (!request_context_) { 899 if (!request_context_) {
944 FilePath cookie_path = GetPath(); 900 FilePath cookie_path = GetPath();
945 cookie_path = cookie_path.Append(chrome::kCookieFilename); 901 cookie_path = cookie_path.Append(chrome::kCookieFilename);
946 FilePath cache_path = base_cache_path_; 902 FilePath cache_path = base_cache_path_;
947 int max_size; 903 int max_size;
948 GetCacheParameters(kNormalContext, &cache_path, &max_size); 904 GetCacheParameters(kNormalContext, &cache_path, &max_size);
949 905
950 cache_path = GetCachePath(cache_path); 906 cache_path = GetCachePath(cache_path);
951 request_context_ = ChromeURLRequestContext::CreateOriginal( 907 request_context_ = ChromeURLRequestContextGetter::CreateOriginal(
952 this, cookie_path, cache_path, max_size, appcache_service_); 908 this, cookie_path, cache_path, max_size);
953 request_context_->AddRef(); 909 request_context_->AddRef();
954 910
955 // The first request context is always a normal (non-OTR) request context. 911 // The first request context is always a normal (non-OTR) request context.
956 // Even when Chromium is started in OTR mode, a normal profile is always 912 // Even when Chromium is started in OTR mode, a normal profile is always
957 // created first. 913 // created first.
958 if (!default_request_context_) { 914 if (!default_request_context_) {
959 default_request_context_ = request_context_; 915 default_request_context_ = request_context_;
916 // TODO(eroman): this isn't terribly useful anymore now that the
917 // URLRequestContext is constructed by the IO thread...
960 NotificationService::current()->Notify( 918 NotificationService::current()->Notify(
961 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, 919 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE,
962 NotificationService::AllSources(), NotificationService::NoDetails()); 920 NotificationService::AllSources(), NotificationService::NoDetails());
963 #if defined(OS_LINUX)
964 // TODO(ukai): find a better way to set the URLRequestContext for OCSP.
965 net::SetURLRequestContextForOCSP(default_request_context_);
966 #endif
967 } 921 }
968
969 DCHECK(request_context_->cookie_store());
970 } 922 }
971 923
972 return request_context_; 924 return request_context_;
973 } 925 }
974 926
975 URLRequestContext* ProfileImpl::GetRequestContextForMedia() { 927 URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() {
976 if (!media_request_context_) { 928 if (!media_request_context_) {
977 FilePath cache_path = base_cache_path_; 929 FilePath cache_path = base_cache_path_;
978 int max_size; 930 int max_size;
979 GetCacheParameters(kMediaContext, &cache_path, &max_size); 931 GetCacheParameters(kMediaContext, &cache_path, &max_size);
980 932
981 cache_path = GetMediaCachePath(cache_path); 933 cache_path = GetMediaCachePath(cache_path);
982 media_request_context_ = ChromeURLRequestContext::CreateOriginalForMedia( 934 media_request_context_ =
983 this, cache_path, max_size, appcache_service_); 935 ChromeURLRequestContextGetter::CreateOriginalForMedia(
936 this, cache_path, max_size);
984 media_request_context_->AddRef(); 937 media_request_context_->AddRef();
985
986 DCHECK(media_request_context_->cookie_store());
987 } 938 }
988 939
989 return media_request_context_; 940 return media_request_context_;
990 } 941 }
991 942
992 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { 943 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) {
993 if (!favicon_service_created_) { 944 if (!favicon_service_created_) {
994 favicon_service_created_ = true; 945 favicon_service_created_ = true;
995 scoped_refptr<FaviconService> service(new FaviconService(this)); 946 scoped_refptr<FaviconService> service(new FaviconService(this));
996 favicon_service_.swap(service); 947 favicon_service_.swap(service);
997 } 948 }
998 return favicon_service_.get(); 949 return favicon_service_.get();
999 } 950 }
1000 951
1001 URLRequestContext* ProfileImpl::GetRequestContextForExtensions() { 952 URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
1002 if (!extensions_request_context_) { 953 if (!extensions_request_context_) {
1003 FilePath cookie_path = GetPath(); 954 FilePath cookie_path = GetPath();
1004 cookie_path = cookie_path.Append(chrome::kExtensionsCookieFilename); 955 cookie_path = cookie_path.Append(chrome::kExtensionsCookieFilename);
1005 956
1006 extensions_request_context_ = 957 extensions_request_context_ =
1007 ChromeURLRequestContext::CreateOriginalForExtensions(this, cookie_path); 958 ChromeURLRequestContextGetter::CreateOriginalForExtensions(
959 this, cookie_path);
1008 extensions_request_context_->AddRef(); 960 extensions_request_context_->AddRef();
1009
1010 DCHECK(extensions_request_context_->cookie_store());
1011 } 961 }
1012 962
1013 return extensions_request_context_; 963 return extensions_request_context_;
1014 } 964 }
1015 965
1016 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { 966 net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
1017 return ssl_config_service_manager_->Get(); 967 return ssl_config_service_manager_->Get();
1018 } 968 }
1019 969
1020 Blacklist* ProfileImpl::GetBlacklist() { 970 Blacklist* ProfileImpl::GetBlacklist() {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 #endif 1356 #endif
1407 return NULL; 1357 return NULL;
1408 } 1358 }
1409 1359
1410 void ProfileImpl::InitSyncService() { 1360 void ProfileImpl::InitSyncService() {
1411 #if defined(BROWSER_SYNC) 1361 #if defined(BROWSER_SYNC)
1412 sync_service_.reset(new ProfileSyncService(this)); 1362 sync_service_.reset(new ProfileSyncService(this));
1413 sync_service_->Initialize(); 1363 sync_service_->Initialize();
1414 #endif 1364 #endif
1415 } 1365 }
OLDNEW
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/browser/profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698