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 "extensions/browser/extension_prefs.h" | 7 #include "extensions/browser/extension_prefs.h" |
8 #include "extensions/browser/extension_registry.h" | 8 #include "extensions/browser/extension_registry.h" |
9 #include "extensions/common/manifest_handlers/app_isolation_info.h" | 9 #include "extensions/common/manifest_handlers/app_isolation_info.h" |
| 10 #include "extensions/common/manifest_handlers/incognito_info.h" |
10 | 11 |
11 namespace extensions { | 12 namespace extensions { |
12 namespace util { | 13 namespace util { |
13 | 14 |
14 bool IsExtensionInstalledPermanently(const std::string& extension_id, | 15 bool IsExtensionInstalledPermanently(const std::string& extension_id, |
15 content::BrowserContext* context) { | 16 content::BrowserContext* context) { |
16 const Extension* extension = ExtensionRegistry::Get(context)-> | 17 const Extension* extension = ExtensionRegistry::Get(context)-> |
17 GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); | 18 GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); |
18 return extension && !IsEphemeralApp(extension_id, context); | 19 return extension && !IsEphemeralApp(extension_id, context); |
19 } | 20 } |
(...skipping 21 matching lines...) Expand all Loading... |
41 } | 42 } |
42 | 43 |
43 bool SiteHasIsolatedStorage(const GURL& extension_site_url, | 44 bool SiteHasIsolatedStorage(const GURL& extension_site_url, |
44 content::BrowserContext* context) { | 45 content::BrowserContext* context) { |
45 const Extension* extension = ExtensionRegistry::Get(context)-> | 46 const Extension* extension = ExtensionRegistry::Get(context)-> |
46 enabled_extensions().GetExtensionOrAppByURL(extension_site_url); | 47 enabled_extensions().GetExtensionOrAppByURL(extension_site_url); |
47 | 48 |
48 return extension && AppIsolationInfo::HasIsolatedStorage(extension); | 49 return extension && AppIsolationInfo::HasIsolatedStorage(extension); |
49 } | 50 } |
50 | 51 |
| 52 bool CanBeIncognitoEnabled(const Extension* extension) { |
| 53 return IncognitoInfo::IsIncognitoAllowed(extension) && |
| 54 (!extension->is_platform_app() || |
| 55 extension->location() == Manifest::COMPONENT); |
| 56 } |
| 57 |
51 } // namespace util | 58 } // namespace util |
52 } // namespace extensions | 59 } // namespace extensions |
OLD | NEW |