| OLD | NEW |
| 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_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 FilePath media_cache_path = base_cache_path_; | 336 FilePath media_cache_path = base_cache_path_; |
| 337 int media_cache_max_size; | 337 int media_cache_max_size; |
| 338 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size); | 338 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size); |
| 339 media_cache_path = GetMediaCachePath(media_cache_path); | 339 media_cache_path = GetMediaCachePath(media_cache_path); |
| 340 | 340 |
| 341 FilePath extensions_cookie_path = GetPath(); | 341 FilePath extensions_cookie_path = GetPath(); |
| 342 extensions_cookie_path = | 342 extensions_cookie_path = |
| 343 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); | 343 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); |
| 344 | 344 |
| 345 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); |
| 346 |
| 345 // Make sure we initialize the ProfileIOData after everything else has been | 347 // Make sure we initialize the ProfileIOData after everything else has been |
| 346 // initialized that we might be reading from the IO thread. | 348 // initialized that we might be reading from the IO thread. |
| 347 io_data_.Init(cookie_path, cache_path, cache_max_size, | 349 io_data_.Init(cookie_path, cache_path, cache_max_size, |
| 348 media_cache_path, media_cache_max_size, extensions_cookie_path); | 350 media_cache_path, media_cache_max_size, extensions_cookie_path, |
| 351 app_path); |
| 349 | 352 |
| 350 // Initialize the ProfilePolicyConnector after |io_data_| since it requires | 353 // Initialize the ProfilePolicyConnector after |io_data_| since it requires |
| 351 // the URLRequestContextGetter to be initialized. | 354 // the URLRequestContextGetter to be initialized. |
| 352 GetPolicyConnector()->Initialize(); | 355 GetPolicyConnector()->Initialize(); |
| 353 } | 356 } |
| 354 | 357 |
| 355 void ProfileImpl::InitExtensions() { | 358 void ProfileImpl::InitExtensions() { |
| 356 if (user_script_master_ || extensions_service_) | 359 if (user_script_master_ || extensions_service_) |
| 357 return; // Already initialized. | 360 return; // Already initialized. |
| 358 | 361 |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 // TODO(eroman): this isn't terribly useful anymore now that the | 818 // TODO(eroman): this isn't terribly useful anymore now that the |
| 816 // net::URLRequestContext is constructed by the IO thread... | 819 // net::URLRequestContext is constructed by the IO thread... |
| 817 NotificationService::current()->Notify( | 820 NotificationService::current()->Notify( |
| 818 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, | 821 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, |
| 819 NotificationService::AllSources(), NotificationService::NoDetails()); | 822 NotificationService::AllSources(), NotificationService::NoDetails()); |
| 820 } | 823 } |
| 821 | 824 |
| 822 return request_context; | 825 return request_context; |
| 823 } | 826 } |
| 824 | 827 |
| 828 URLRequestContextGetter* ProfileImpl::GetRequestContextForPossibleApp( |
| 829 const Extension* installed_app) { |
| 830 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 831 switches::kEnableExperimentalAppManifests) && |
| 832 installed_app != NULL && |
| 833 installed_app->is_storage_isolated()) |
| 834 return GetRequestContextForIsolatedApp(installed_app->id()); |
| 835 |
| 836 return GetRequestContext(); |
| 837 } |
| 838 |
| 825 URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { | 839 URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { |
| 826 return io_data_.GetMediaRequestContextGetter(); | 840 return io_data_.GetMediaRequestContextGetter(); |
| 827 } | 841 } |
| 828 | 842 |
| 829 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { | 843 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { |
| 830 if (!favicon_service_created_) { | 844 if (!favicon_service_created_) { |
| 831 favicon_service_created_ = true; | 845 favicon_service_created_ = true; |
| 832 scoped_refptr<FaviconService> service(new FaviconService(this)); | 846 scoped_refptr<FaviconService> service(new FaviconService(this)); |
| 833 favicon_service_.swap(service); | 847 favicon_service_.swap(service); |
| 834 } | 848 } |
| 835 return favicon_service_.get(); | 849 return favicon_service_.get(); |
| 836 } | 850 } |
| 837 | 851 |
| 838 URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 852 URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
| 839 return io_data_.GetExtensionsRequestContextGetter(); | 853 return io_data_.GetExtensionsRequestContextGetter(); |
| 840 } | 854 } |
| 841 | 855 |
| 856 URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( |
| 857 const std::string& app_id) { |
| 858 return io_data_.GetIsolatedAppRequestContextGetter(app_id); |
| 859 } |
| 860 |
| 842 void ProfileImpl::RegisterExtensionWithRequestContexts( | 861 void ProfileImpl::RegisterExtensionWithRequestContexts( |
| 843 const Extension* extension) { | 862 const Extension* extension) { |
| 844 BrowserThread::PostTask( | 863 BrowserThread::PostTask( |
| 845 BrowserThread::IO, FROM_HERE, | 864 BrowserThread::IO, FROM_HERE, |
| 846 NewRunnableMethod(extension_info_map_.get(), | 865 NewRunnableMethod(extension_info_map_.get(), |
| 847 &ExtensionInfoMap::AddExtension, | 866 &ExtensionInfoMap::AddExtension, |
| 848 make_scoped_refptr(extension))); | 867 make_scoped_refptr(extension))); |
| 849 } | 868 } |
| 850 | 869 |
| 851 void ProfileImpl::UnregisterExtensionWithRequestContexts( | 870 void ProfileImpl::UnregisterExtensionWithRequestContexts( |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 return pref_proxy_config_tracker_; | 1555 return pref_proxy_config_tracker_; |
| 1537 } | 1556 } |
| 1538 | 1557 |
| 1539 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1558 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { |
| 1540 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) | 1559 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) |
| 1541 return NULL; | 1560 return NULL; |
| 1542 if (!prerender_manager_) | 1561 if (!prerender_manager_) |
| 1543 prerender_manager_ = new prerender::PrerenderManager(this); | 1562 prerender_manager_ = new prerender::PrerenderManager(this); |
| 1544 return prerender_manager_; | 1563 return prerender_manager_; |
| 1545 } | 1564 } |
| OLD | NEW |