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

Side by Side Diff: chrome/browser/extensions/extension_util.cc

Issue 184043024: Limit scope of settings API configuration and proxy permission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move incognito permission test from ChromeExtensionsBrowserClient to ExtensionPrefs Created 6 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 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698