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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 // TODO(eroman): this isn't terribly useful anymore now that the | 813 // TODO(eroman): this isn't terribly useful anymore now that the |
811 // net::URLRequestContext is constructed by the IO thread... | 814 // net::URLRequestContext is constructed by the IO thread... |
812 NotificationService::current()->Notify( | 815 NotificationService::current()->Notify( |
813 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, | 816 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, |
814 NotificationService::AllSources(), NotificationService::NoDetails()); | 817 NotificationService::AllSources(), NotificationService::NoDetails()); |
815 } | 818 } |
816 | 819 |
817 return request_context; | 820 return request_context; |
818 } | 821 } |
819 | 822 |
| 823 URLRequestContextGetter* ProfileImpl::GetRequestContextForPossibleApp( |
| 824 const Extension* installed_app) { |
| 825 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 826 switches::kEnableExperimentalAppManifests) && |
| 827 installed_app != NULL && |
| 828 installed_app->is_storage_isolated()) |
| 829 return GetRequestContextForIsolatedApp(installed_app); |
| 830 |
| 831 return GetRequestContext(); |
| 832 } |
| 833 |
820 URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { | 834 URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { |
821 return io_data_.GetMediaRequestContextGetter(); | 835 return io_data_.GetMediaRequestContextGetter(); |
822 } | 836 } |
823 | 837 |
824 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { | 838 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { |
825 if (!favicon_service_created_) { | 839 if (!favicon_service_created_) { |
826 favicon_service_created_ = true; | 840 favicon_service_created_ = true; |
827 scoped_refptr<FaviconService> service(new FaviconService(this)); | 841 scoped_refptr<FaviconService> service(new FaviconService(this)); |
828 favicon_service_.swap(service); | 842 favicon_service_.swap(service); |
829 } | 843 } |
830 return favicon_service_.get(); | 844 return favicon_service_.get(); |
831 } | 845 } |
832 | 846 |
833 URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 847 URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
834 return io_data_.GetExtensionsRequestContextGetter(); | 848 return io_data_.GetExtensionsRequestContextGetter(); |
835 } | 849 } |
836 | 850 |
| 851 URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( |
| 852 const Extension* installed_app) { |
| 853 return io_data_.GetIsolatedAppRequestContextGetter(installed_app); |
| 854 } |
| 855 |
837 void ProfileImpl::RegisterExtensionWithRequestContexts( | 856 void ProfileImpl::RegisterExtensionWithRequestContexts( |
838 const Extension* extension) { | 857 const Extension* extension) { |
839 // AddRef to ensure the data lives until the other thread gets it. Balanced in | 858 // AddRef to ensure the data lives until the other thread gets it. Balanced in |
840 // OnNewExtensions. | 859 // OnNewExtensions. |
841 extension->AddRef(); | 860 extension->AddRef(); |
842 BrowserThread::PostTask( | 861 BrowserThread::PostTask( |
843 BrowserThread::IO, FROM_HERE, | 862 BrowserThread::IO, FROM_HERE, |
844 NewRunnableMethod(extension_info_map_.get(), | 863 NewRunnableMethod(extension_info_map_.get(), |
845 &ExtensionInfoMap::AddExtension, | 864 &ExtensionInfoMap::AddExtension, |
846 extension)); | 865 extension)); |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 return pref_proxy_config_tracker_; | 1553 return pref_proxy_config_tracker_; |
1535 } | 1554 } |
1536 | 1555 |
1537 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { | 1556 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { |
1538 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) | 1557 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) |
1539 return NULL; | 1558 return NULL; |
1540 if (!prerender_manager_) | 1559 if (!prerender_manager_) |
1541 prerender_manager_ = new prerender::PrerenderManager(this); | 1560 prerender_manager_ = new prerender::PrerenderManager(this); |
1542 return prerender_manager_; | 1561 return prerender_manager_; |
1543 } | 1562 } |
OLD | NEW |