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

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: Updated metrics 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/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 namespace base { 13 namespace base {
14 class DictionaryValue; 14 class DictionaryValue;
15 } 15 }
16 16
17 namespace content { 17 namespace content {
18 class BrowserContext; 18 class BrowserContext;
19 } 19 }
20 20
21 namespace gfx { 21 namespace gfx {
22 class ImageSkia; 22 class ImageSkia;
23 } 23 }
24 24
25 namespace extensions { 25 namespace extensions {
26 26
27 class Extension; 27 class Extension;
28 struct ExtensionInfo; 28 struct ExtensionInfo;
29 class PermissionSet;
29 30
30 namespace util { 31 namespace util {
31 32
32 // Returns true if |extension_id| can run in an incognito window. 33 // Returns true if |extension_id| can run in an incognito window.
33 bool IsIncognitoEnabled(const std::string& extension_id, 34 bool IsIncognitoEnabled(const std::string& extension_id,
34 content::BrowserContext* context); 35 content::BrowserContext* context);
35 36
36 // Sets whether |extension_id| can run in an incognito window. Reloads the 37 // 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 38 // extension if it's enabled since this permission is applied at loading time
38 // only. Note that an ExtensionService must exist. 39 // only. Note that an ExtensionService must exist.
(...skipping 22 matching lines...) Expand all
61 bool allow); 62 bool allow);
62 63
63 // Returns true if the extension with |extension_id| is allowed to execute 64 // Returns true if the extension with |extension_id| is allowed to execute
64 // scripts on all urls (exempting chrome:// urls, etc) without explicit 65 // scripts on all urls (exempting chrome:// urls, etc) without explicit
65 // user consent. 66 // user consent.
66 // This should only be used with FeatureSwitch::scripts_require_action() 67 // This should only be used with FeatureSwitch::scripts_require_action()
67 // enabled. 68 // enabled.
68 bool AllowedScriptingOnAllUrls(const std::string& extension_id, 69 bool AllowedScriptingOnAllUrls(const std::string& extension_id,
69 content::BrowserContext* context); 70 content::BrowserContext* context);
70 71
72 // Returns the default value for being allowed to script on all urls.
73 bool DefaultAllowedScriptingOnAllUrls();
74
71 // Sets whether the extension with |extension_id| is allowed to execute scripts 75 // Sets whether the extension with |extension_id| is allowed to execute scripts
72 // on all urls (exempting chrome:// urls, etc) without explicit user consent. 76 // on all urls (exempting chrome:// urls, etc) without explicit user consent.
73 // This should only be used with FeatureSwitch::scripts_require_action() 77 // This should only be used with FeatureSwitch::scripts_require_action()
74 // enabled. 78 // enabled.
75 void SetAllowedScriptingOnAllUrls(const std::string& extension_id, 79 void SetAllowedScriptingOnAllUrls(const std::string& extension_id,
76 content::BrowserContext* context, 80 content::BrowserContext* context,
77 bool allowed); 81 bool allowed);
78 82
79 // Returns true if the --scripts-require-action flag would possibly affect 83 // Returns true if the --scripts-require-action flag would possibly affect
80 // the given |extension|. 84 // the given |extension| and |permissions|. We pass in the |permissions|
81 bool ScriptsMayRequireActionForExtension(const Extension* extension); 85 // explicitly, as we may need to check with permissions other than the ones
86 // that are currently on the extension's PermissionsData.
87 bool ScriptsMayRequireActionForExtension(
88 const Extension* extension,
89 const PermissionSet* permissions);
82 90
83 // Returns true if |extension_id| can be launched (possibly only after being 91 // Returns true if |extension_id| can be launched (possibly only after being
84 // enabled). 92 // enabled).
85 bool IsAppLaunchable(const std::string& extension_id, 93 bool IsAppLaunchable(const std::string& extension_id,
86 content::BrowserContext* context); 94 content::BrowserContext* context);
87 95
88 // Returns true if |extension_id| can be launched without being enabled first. 96 // Returns true if |extension_id| can be launched without being enabled first.
89 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id, 97 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id,
90 content::BrowserContext* context); 98 content::BrowserContext* context);
91 99
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Returns true if the bookmark apps feature is enabled. 134 // Returns true if the bookmark apps feature is enabled.
127 // 135 //
128 // TODO(benwells): http://crbug.com/441128: Remove this entirely once the 136 // TODO(benwells): http://crbug.com/441128: Remove this entirely once the
129 // feature is stable. 137 // feature is stable.
130 bool IsNewBookmarkAppsEnabled(); 138 bool IsNewBookmarkAppsEnabled();
131 139
132 } // namespace util 140 } // namespace util
133 } // namespace extensions 141 } // namespace extensions
134 142
135 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_ 143 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_ui_unittest.cc ('k') | chrome/browser/extensions/extension_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698