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

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

Issue 874683005: [Extensions] Enable the scripts-require-action feature based on all-urls pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 namespace base { 14 namespace base {
14 class DictionaryValue; 15 class DictionaryValue;
15 } 16 }
16 17
17 namespace content { 18 namespace content {
18 class BrowserContext; 19 class BrowserContext;
19 } 20 }
20 21
21 namespace gfx { 22 namespace gfx {
22 class ImageSkia; 23 class ImageSkia;
23 } 24 }
24 25
25 namespace extensions { 26 namespace extensions {
26 27
27 class Extension; 28 class Extension;
28 struct ExtensionInfo; 29 struct ExtensionInfo;
30 class PermissionSet;
29 31
30 namespace util { 32 namespace util {
31 33
32 // Returns true if |extension_id| can run in an incognito window. 34 // Returns true if |extension_id| can run in an incognito window.
33 bool IsIncognitoEnabled(const std::string& extension_id, 35 bool IsIncognitoEnabled(const std::string& extension_id,
34 content::BrowserContext* context); 36 content::BrowserContext* context);
35 37
36 // Sets whether |extension_id| can run in an incognito window. Reloads the 38 // Sets whether |extension_id| can run in an incognito window. Reloads the
37 // extension if it's enabled since this permission is applied at loading time 39 // extension if it's enabled since this permission is applied at loading time
38 // only. Note that an ExtensionService must exist. 40 // only. Note that an ExtensionService must exist.
(...skipping 22 matching lines...) Expand all
61 bool allow); 63 bool allow);
62 64
63 // Returns true if the extension with |extension_id| is allowed to execute 65 // Returns true if the extension with |extension_id| is allowed to execute
64 // scripts on all urls (exempting chrome:// urls, etc) without explicit 66 // scripts on all urls (exempting chrome:// urls, etc) without explicit
65 // user consent. 67 // user consent.
66 // This should only be used with FeatureSwitch::scripts_require_action() 68 // This should only be used with FeatureSwitch::scripts_require_action()
67 // enabled. 69 // enabled.
68 bool AllowedScriptingOnAllUrls(const std::string& extension_id, 70 bool AllowedScriptingOnAllUrls(const std::string& extension_id,
69 content::BrowserContext* context); 71 content::BrowserContext* context);
70 72
73 // Returns the default value for being allowed to script on all urls.
74 bool DefaultAllowedScriptingOnAllUrls();
75
71 // Sets whether the extension with |extension_id| is allowed to execute scripts 76 // Sets whether the extension with |extension_id| is allowed to execute scripts
72 // on all urls (exempting chrome:// urls, etc) without explicit user consent. 77 // on all urls (exempting chrome:// urls, etc) without explicit user consent.
73 // This should only be used with FeatureSwitch::scripts_require_action() 78 // This should only be used with FeatureSwitch::scripts_require_action()
74 // enabled. 79 // enabled.
75 void SetAllowedScriptingOnAllUrls(const std::string& extension_id, 80 void SetAllowedScriptingOnAllUrls(const std::string& extension_id,
76 content::BrowserContext* context, 81 content::BrowserContext* context,
77 bool allowed); 82 bool allowed);
78 83
79 // Returns true if the --scripts-require-action flag would possibly affect 84 // Returns true if the --scripts-require-action flag would possibly affect
80 // the given |extension|. 85 // the given |extension| and |permissions|. We pass in the |permissions|
81 bool ScriptsMayRequireActionForExtension(const Extension* extension); 86 // explicitly, as we may need to check with permissions other than the ones
87 // that are currently on the extension's PermissionsData.
88 bool ScriptsMayRequireActionForExtension(
89 const Extension* extension,
90 const scoped_refptr<const PermissionSet>& permissions);
not at google - send to devlin 2015/02/06 00:26:56 A little odd to be passing refcounted |extension|
Devlin 2015/02/06 18:58:43 Done.
82 91
83 // Returns true if |extension_id| can be launched (possibly only after being 92 // Returns true if |extension_id| can be launched (possibly only after being
84 // enabled). 93 // enabled).
85 bool IsAppLaunchable(const std::string& extension_id, 94 bool IsAppLaunchable(const std::string& extension_id,
86 content::BrowserContext* context); 95 content::BrowserContext* context);
87 96
88 // Returns true if |extension_id| can be launched without being enabled first. 97 // Returns true if |extension_id| can be launched without being enabled first.
89 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id, 98 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id,
90 content::BrowserContext* context); 99 content::BrowserContext* context);
91 100
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Returns true if the bookmark apps feature is enabled. 135 // Returns true if the bookmark apps feature is enabled.
127 // 136 //
128 // TODO(benwells): http://crbug.com/441128: Remove this entirely once the 137 // TODO(benwells): http://crbug.com/441128: Remove this entirely once the
129 // feature is stable. 138 // feature is stable.
130 bool IsNewBookmarkAppsEnabled(); 139 bool IsNewBookmarkAppsEnabled();
131 140
132 } // namespace util 141 } // namespace util
133 } // namespace extensions 142 } // namespace extensions
134 143
135 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_ 144 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698