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