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

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

Issue 6201005: Initial support for partitioning cookies for isolated apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 9 years, 9 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
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_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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 FilePath media_cache_path = base_cache_path_; 334 FilePath media_cache_path = base_cache_path_;
335 int media_cache_max_size; 335 int media_cache_max_size;
336 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size); 336 GetCacheParameters(kMediaContext, &media_cache_path, &media_cache_max_size);
337 media_cache_path = GetMediaCachePath(media_cache_path); 337 media_cache_path = GetMediaCachePath(media_cache_path);
338 338
339 FilePath extensions_cookie_path = GetPath(); 339 FilePath extensions_cookie_path = GetPath();
340 extensions_cookie_path = 340 extensions_cookie_path =
341 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); 341 extensions_cookie_path.Append(chrome::kExtensionsCookieFilename);
342 342
343 FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname);
344
343 // Make sure we initialize the ProfileIOData after everything else has been 345 // Make sure we initialize the ProfileIOData after everything else has been
344 // initialized that we might be reading from the IO thread. 346 // initialized that we might be reading from the IO thread.
345 io_data_.Init(cookie_path, cache_path, cache_max_size, 347 io_data_.Init(cookie_path, cache_path, cache_max_size,
346 media_cache_path, media_cache_max_size, extensions_cookie_path); 348 media_cache_path, media_cache_max_size, extensions_cookie_path,
349 app_path);
347 350
348 // Initialize the ProfilePolicyConnector after |io_data_| since it requires 351 // Initialize the ProfilePolicyConnector after |io_data_| since it requires
349 // the URLRequestContextGetter to be initialized. 352 // the URLRequestContextGetter to be initialized.
350 GetPolicyConnector()->Initialize(); 353 GetPolicyConnector()->Initialize();
351 } 354 }
352 355
353 void ProfileImpl::InitExtensions() { 356 void ProfileImpl::InitExtensions() {
354 if (user_script_master_ || extensions_service_) 357 if (user_script_master_ || extensions_service_)
355 return; // Already initialized. 358 return; // Already initialized.
356 359
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 // TODO(eroman): this isn't terribly useful anymore now that the 812 // TODO(eroman): this isn't terribly useful anymore now that the
810 // net::URLRequestContext is constructed by the IO thread... 813 // net::URLRequestContext is constructed by the IO thread...
811 NotificationService::current()->Notify( 814 NotificationService::current()->Notify(
812 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, 815 NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE,
813 NotificationService::AllSources(), NotificationService::NoDetails()); 816 NotificationService::AllSources(), NotificationService::NoDetails());
814 } 817 }
815 818
816 return request_context; 819 return request_context;
817 } 820 }
818 821
822 URLRequestContextGetter* ProfileImpl::GetRequestContextForPossibleApp(
823 const Extension* installed_app) {
824 if (CommandLine::ForCurrentProcess()->HasSwitch(
825 switches::kEnableExperimentalAppManifests) &&
826 installed_app != NULL &&
827 installed_app->is_storage_isolated())
828 return GetRequestContextForIsolatedApp(installed_app);
829
830 return GetRequestContext();
831 }
832
819 URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { 833 URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() {
820 return io_data_.GetMediaRequestContextGetter(); 834 return io_data_.GetMediaRequestContextGetter();
821 } 835 }
822 836
823 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { 837 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) {
824 if (!favicon_service_created_) { 838 if (!favicon_service_created_) {
825 favicon_service_created_ = true; 839 favicon_service_created_ = true;
826 scoped_refptr<FaviconService> service(new FaviconService(this)); 840 scoped_refptr<FaviconService> service(new FaviconService(this));
827 favicon_service_.swap(service); 841 favicon_service_.swap(service);
828 } 842 }
829 return favicon_service_.get(); 843 return favicon_service_.get();
830 } 844 }
831 845
832 URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { 846 URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
833 return io_data_.GetExtensionsRequestContextGetter(); 847 return io_data_.GetExtensionsRequestContextGetter();
834 } 848 }
835 849
850 URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp(
851 const Extension* installed_app) {
852 return io_data_.GetIsolatedAppRequestContextGetter(installed_app);
853 }
854
836 void ProfileImpl::RegisterExtensionWithRequestContexts( 855 void ProfileImpl::RegisterExtensionWithRequestContexts(
837 const Extension* extension) { 856 const Extension* extension) {
838 // AddRef to ensure the data lives until the other thread gets it. Balanced in 857 // AddRef to ensure the data lives until the other thread gets it. Balanced in
839 // OnNewExtensions. 858 // OnNewExtensions.
840 extension->AddRef(); 859 extension->AddRef();
841 BrowserThread::PostTask( 860 BrowserThread::PostTask(
842 BrowserThread::IO, FROM_HERE, 861 BrowserThread::IO, FROM_HERE,
843 NewRunnableMethod(extension_info_map_.get(), 862 NewRunnableMethod(extension_info_map_.get(),
844 &ExtensionInfoMap::AddExtension, 863 &ExtensionInfoMap::AddExtension,
845 extension)); 864 extension));
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 return pref_proxy_config_tracker_; 1548 return pref_proxy_config_tracker_;
1530 } 1549 }
1531 1550
1532 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() { 1551 prerender::PrerenderManager* ProfileImpl::GetPrerenderManager() {
1533 if (!prerender::PrerenderManager::IsPrerenderingEnabled()) 1552 if (!prerender::PrerenderManager::IsPrerenderingEnabled())
1534 return NULL; 1553 return NULL;
1535 if (!prerender_manager_) 1554 if (!prerender_manager_)
1536 prerender_manager_ = new prerender::PrerenderManager(this); 1555 prerender_manager_ = new prerender::PrerenderManager(this);
1537 return prerender_manager_; 1556 return prerender_manager_;
1538 } 1557 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698