| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_util.h" | 5 #include "extensions/browser/extension_util.h" |
| 6 | 6 |
| 7 #include "content/public/browser/browser_context.h" |
| 8 #include "content/public/browser/site_instance.h" |
| 7 #include "extensions/browser/extension_prefs.h" | 9 #include "extensions/browser/extension_prefs.h" |
| 8 #include "extensions/browser/extension_registry.h" | 10 #include "extensions/browser/extension_registry.h" |
| 9 #include "extensions/common/manifest_handlers/app_isolation_info.h" | 11 #include "extensions/common/manifest_handlers/app_isolation_info.h" |
| 10 #include "extensions/common/manifest_handlers/incognito_info.h" | 12 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 11 | 13 |
| 12 namespace extensions { | 14 namespace extensions { |
| 13 namespace util { | 15 namespace util { |
| 14 | 16 |
| 15 bool HasIsolatedStorage(const ExtensionInfo& info) { | 17 bool HasIsolatedStorage(const ExtensionInfo& info) { |
| 16 if (!info.extension_manifest.get()) | 18 if (!info.extension_manifest.get()) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 | 38 |
| 37 return extension && AppIsolationInfo::HasIsolatedStorage(extension); | 39 return extension && AppIsolationInfo::HasIsolatedStorage(extension); |
| 38 } | 40 } |
| 39 | 41 |
| 40 bool CanBeIncognitoEnabled(const Extension* extension) { | 42 bool CanBeIncognitoEnabled(const Extension* extension) { |
| 41 return IncognitoInfo::IsIncognitoAllowed(extension) && | 43 return IncognitoInfo::IsIncognitoAllowed(extension) && |
| 42 (!extension->is_platform_app() || | 44 (!extension->is_platform_app() || |
| 43 extension->location() == Manifest::COMPONENT); | 45 extension->location() == Manifest::COMPONENT); |
| 44 } | 46 } |
| 45 | 47 |
| 48 content::StoragePartition* GetStoragePartitionForExtensionId( |
| 49 const std::string& extension_id, |
| 50 content::BrowserContext* browser_context) { |
| 51 GURL site_url = content::SiteInstance::GetSiteForURL( |
| 52 browser_context, Extension::GetBaseURLFromExtensionId(extension_id)); |
| 53 content::StoragePartition* storage_partition = |
| 54 content::BrowserContext::GetStoragePartitionForSite(browser_context, |
| 55 site_url); |
| 56 return storage_partition; |
| 57 } |
| 58 |
| 46 } // namespace util | 59 } // namespace util |
| 47 } // namespace extensions | 60 } // namespace extensions |
| OLD | NEW |