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

Side by Side Diff: extensions/browser/management_policy.h

Issue 384423002: [Canceled] Extensions: Add install_flags parameter to ManagementPolicy::UserMayLoad (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update tests Created 6 years, 5 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
« no previous file with comments | « extensions/browser/extension_prefs.cc ('k') | extensions/browser/management_policy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ 5 #ifndef EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_
6 #define EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ 6 #define EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 virtual ~Provider() {} 45 virtual ~Provider() {}
46 46
47 // A human-readable name for this provider, for use in debug messages. 47 // A human-readable name for this provider, for use in debug messages.
48 // Implementers should return an empty string in non-debug builds, to save 48 // Implementers should return an empty string in non-debug builds, to save
49 // executable size. 49 // executable size.
50 virtual std::string GetDebugPolicyProviderName() const = 0; 50 virtual std::string GetDebugPolicyProviderName() const = 0;
51 51
52 // Providers should return false if a user may not install the |extension|, 52 // Providers should return false if a user may not install the |extension|,
53 // or load or run it if it has already been installed. 53 // or load or run it if it has already been installed.
54 virtual bool UserMayLoad(const Extension* extension, 54 virtual bool UserMayLoad(const Extension* extension,
55 int install_flags,
55 base::string16* error) const; 56 base::string16* error) const;
56 57
57 // Providers should return false if a user may not enable, disable, or 58 // Providers should return false if a user may not enable, disable, or
58 // uninstall the |extension|, or change its usage options (incognito 59 // uninstall the |extension|, or change its usage options (incognito
59 // permission, file access, etc.). 60 // permission, file access, etc.).
60 virtual bool UserMayModifySettings(const Extension* extension, 61 virtual bool UserMayModifySettings(const Extension* extension,
61 base::string16* error) const; 62 base::string16* error) const;
62 63
63 // Providers should return true if the |extension| must always remain 64 // Providers should return true if the |extension| must always remain
64 // enabled. This is distinct from UserMayModifySettings() in that the latter 65 // enabled. This is distinct from UserMayModifySettings() in that the latter
(...skipping 15 matching lines...) Expand all
80 81
81 ManagementPolicy(); 82 ManagementPolicy();
82 ~ManagementPolicy(); 83 ~ManagementPolicy();
83 84
84 // Registers or unregisters a provider, causing it to be added to or removed 85 // Registers or unregisters a provider, causing it to be added to or removed
85 // from the list of providers queried. Ownership of the provider remains with 86 // from the list of providers queried. Ownership of the provider remains with
86 // the caller. Providers do not need to be unregistered on shutdown. 87 // the caller. Providers do not need to be unregistered on shutdown.
87 void RegisterProvider(Provider* provider); 88 void RegisterProvider(Provider* provider);
88 void UnregisterProvider(Provider* provider); 89 void UnregisterProvider(Provider* provider);
89 90
90 // Returns true if the user is permitted to install, load, and run the given 91 // Returns true if the user is permitted to install, load and run the given
91 // extension. If not, |error| may be set to an appropriate message. 92 // extension. If not, |error| may be set to an appropriate message.
92 bool UserMayLoad(const Extension* extension, base::string16* error) const; 93 // |install_flags| is a bitmask of extensions::InstallFlag. For extensions
94 // that are already installed, the flags can be queried with
95 // ExtensionPrefs::GetInstallFlags.
96 bool UserMayLoad(const Extension* extension,
97 int install_flags,
98 base::string16* error) const;
93 99
94 // Returns true if the user is permitted to enable, disable, or uninstall the 100 // Returns true if the user is permitted to enable, disable, or uninstall the
95 // given extension, or change the extension's usage options (incognito mode, 101 // given extension, or change the extension's usage options (incognito mode,
96 // file access, etc.). If not, |error| may be set to an appropriate message. 102 // file access, etc.). If not, |error| may be set to an appropriate message.
97 bool UserMayModifySettings(const Extension* extension, 103 bool UserMayModifySettings(const Extension* extension,
98 base::string16* error) const; 104 base::string16* error) const;
99 105
100 // Returns true if the extension must remain enabled at all times (e.g. a 106 // Returns true if the extension must remain enabled at all times (e.g. a
101 // compoment extension). In that case, |error| may be set to an appropriate 107 // compoment extension). In that case, |error| may be set to an appropriate
102 // message. 108 // message.
(...skipping 22 matching lines...) Expand all
125 // the Provider objects in |providers_|. The return value of this function 131 // the Provider objects in |providers_|. The return value of this function
126 // will be |normal_result|, unless any of the Provider calls to |function| 132 // will be |normal_result|, unless any of the Provider calls to |function|
127 // return !normal_result, in which case this function will then early-return 133 // return !normal_result, in which case this function will then early-return
128 // !normal_result. 134 // !normal_result.
129 bool ApplyToProviderList(ProviderFunction function, 135 bool ApplyToProviderList(ProviderFunction function,
130 const char* debug_operation_name, 136 const char* debug_operation_name,
131 bool normal_result, 137 bool normal_result,
132 const Extension* extension, 138 const Extension* extension,
133 base::string16* error) const; 139 base::string16* error) const;
134 140
141 void LogProhibitedOperation(const char* debug_operation_name,
142 const Extension* extension,
143 const Provider* provider) const;
144
135 ProviderList providers_; 145 ProviderList providers_;
136 146
137 DISALLOW_COPY_AND_ASSIGN(ManagementPolicy); 147 DISALLOW_COPY_AND_ASSIGN(ManagementPolicy);
138 }; 148 };
139 149
140 } // namespace extensions 150 } // namespace extensions
141 151
142 #endif // EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_ 152 #endif // EXTENSIONS_BROWSER_MANAGEMENT_POLICY_H_
OLDNEW
« no previous file with comments | « extensions/browser/extension_prefs.cc ('k') | extensions/browser/management_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698