OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_util.h" | 5 #include "chrome/browser/extensions/extension_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_sync_service.h" | 9 #include "chrome/browser/extensions/extension_sync_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 content::BrowserContext* context) { | 25 content::BrowserContext* context) { |
26 const Extension* extension = ExtensionRegistry::Get(context)-> | 26 const Extension* extension = ExtensionRegistry::Get(context)-> |
27 GetExtensionById(extension_id, ExtensionRegistry::ENABLED); | 27 GetExtensionById(extension_id, ExtensionRegistry::ENABLED); |
28 if (extension) { | 28 if (extension) { |
29 if (!extension->can_be_incognito_enabled()) | 29 if (!extension->can_be_incognito_enabled()) |
30 return false; | 30 return false; |
31 // If this is an existing component extension we always allow it to | 31 // If this is an existing component extension we always allow it to |
32 // work in incognito mode. | 32 // work in incognito mode. |
33 if (extension->location() == Manifest::COMPONENT) | 33 if (extension->location() == Manifest::COMPONENT) |
34 return true; | 34 return true; |
35 if (extension->force_incognito_enabled()) | |
36 return true; | |
37 } | 35 } |
38 | 36 |
39 return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id); | 37 return ExtensionPrefs::Get(context)->IsIncognitoEnabled(extension_id); |
40 } | 38 } |
41 | 39 |
42 void SetIsIncognitoEnabled(const std::string& extension_id, | 40 void SetIsIncognitoEnabled(const std::string& extension_id, |
43 content::BrowserContext* context, | 41 content::BrowserContext* context, |
44 bool enabled) { | 42 bool enabled) { |
45 ExtensionService* service = | 43 ExtensionService* service = |
46 ExtensionSystem::Get(context)->extension_service(); | 44 ExtensionSystem::Get(context)->extension_service(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 166 |
169 bool IsExtensionInstalledPermanently(const std::string& extension_id, | 167 bool IsExtensionInstalledPermanently(const std::string& extension_id, |
170 content::BrowserContext* context) { | 168 content::BrowserContext* context) { |
171 const Extension* extension = ExtensionRegistry::Get(context)-> | 169 const Extension* extension = ExtensionRegistry::Get(context)-> |
172 GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); | 170 GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); |
173 return extension && !extension->is_ephemeral(); | 171 return extension && !extension->is_ephemeral(); |
174 } | 172 } |
175 | 173 |
176 } // namespace util | 174 } // namespace util |
177 } // namespace extensions | 175 } // namespace extensions |
OLD | NEW |