| 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 #include "extensions/common/manifest_handlers/incognito_info.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 namespace util { | 13 namespace util { |
| 14 | 14 |
| 15 bool IsExtensionInstalledPermanently(const std::string& extension_id, | |
| 16 content::BrowserContext* context) { | |
| 17 const Extension* extension = ExtensionRegistry::Get(context)-> | |
| 18 GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); | |
| 19 return extension && !IsEphemeralApp(extension_id, context); | |
| 20 } | |
| 21 | |
| 22 bool IsEphemeralApp(const std::string& extension_id, | |
| 23 content::BrowserContext* context) { | |
| 24 return ExtensionPrefs::Get(context)->IsEphemeralApp(extension_id); | |
| 25 } | |
| 26 | |
| 27 bool HasIsolatedStorage(const ExtensionInfo& info) { | 15 bool HasIsolatedStorage(const ExtensionInfo& info) { |
| 28 if (!info.extension_manifest.get()) | 16 if (!info.extension_manifest.get()) |
| 29 return false; | 17 return false; |
| 30 | 18 |
| 31 std::string error; | 19 std::string error; |
| 32 scoped_refptr<const Extension> extension(Extension::Create( | 20 scoped_refptr<const Extension> extension(Extension::Create( |
| 33 info.extension_path, | 21 info.extension_path, |
| 34 info.extension_location, | 22 info.extension_location, |
| 35 *info.extension_manifest, | 23 *info.extension_manifest, |
| 36 Extension::NO_FLAGS, | 24 Extension::NO_FLAGS, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 } | 38 } |
| 51 | 39 |
| 52 bool CanBeIncognitoEnabled(const Extension* extension) { | 40 bool CanBeIncognitoEnabled(const Extension* extension) { |
| 53 return IncognitoInfo::IsIncognitoAllowed(extension) && | 41 return IncognitoInfo::IsIncognitoAllowed(extension) && |
| 54 (!extension->is_platform_app() || | 42 (!extension->is_platform_app() || |
| 55 extension->location() == Manifest::COMPONENT); | 43 extension->location() == Manifest::COMPONENT); |
| 56 } | 44 } |
| 57 | 45 |
| 58 } // namespace util | 46 } // namespace util |
| 59 } // namespace extensions | 47 } // namespace extensions |
| OLD | NEW |