Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_POLICY_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_POLICY_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <set> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "chrome/common/extensions/extension.h" | |
| 13 | |
| 14 // Combiner. FIXME comment. | |
| 15 class ExtensionManagementPolicy { | |
|
Aaron Boodman
2012/05/17 22:41:06
extensions::ManagementPolicy - then you can make t
| |
| 16 public: | |
| 17 class Delegate { | |
|
Aaron Boodman
2012/05/17 22:41:06
A class can typically only have a single delegate.
Pam (message me for reviews)
2012/05/18 20:15:15
There's precedent in the list of delegates in reso
| |
| 18 public: | |
| 19 Delegate() {} | |
| 20 virtual ~Delegate() {} | |
| 21 | |
| 22 // FIXME all comments | |
| 23 virtual bool UserMayInstall(const std::string& extension_id, | |
| 24 Extension::Location location, | |
| 25 const std::string& extension_name, | |
| 26 string16* error) const; | |
| 27 | |
| 28 // Enable, disable, remove | |
| 29 virtual bool UserMayModifyStatus(const Extension* extension, | |
| 30 string16* error) const; | |
| 31 | |
| 32 // Incognito, file access, etc. | |
| 33 virtual bool UserMayModifyUsage(const Extension* extension, | |
|
Aaron Boodman
2012/05/17 22:41:06
ModifySettings?
| |
| 34 string16* error) const; | |
| 35 | |
| 36 // Forced on; you probably also want to set the others | |
| 37 virtual bool MustRemainEnabled(const Extension* extension, | |
|
Aaron Boodman
2012/05/17 22:41:06
It seems like these can be simplified:
// Better
Pam (message me for reviews)
2012/05/18 20:15:15
That would be enough for policy force- and blackli
| |
| 38 string16* error) const; | |
| 39 | |
| 40 private: | |
| 41 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
| 42 }; | |
| 43 | |
| 44 ExtensionManagementPolicy(); | |
| 45 ~ExtensionManagementPolicy(); | |
| 46 | |
| 47 // Does not take ownership | |
| 48 void RegisterDelegate(Delegate* delegate); | |
| 49 void UnregisterDelegate(Delegate* delegate); | |
| 50 | |
| 51 // FIXME all comments - combiners | |
| 52 bool UserMayInstall(const std::string& extension_id, | |
| 53 Extension::Location location, | |
| 54 const std::string& extension_name, | |
| 55 string16* error) const; | |
| 56 | |
| 57 // Enable, disable, remove | |
| 58 bool UserMayModifyStatus(const Extension* extension, | |
| 59 string16* error) const; | |
| 60 | |
| 61 // Incognito, file access, etc. | |
| 62 bool UserMayModifyUsage(const Extension* extension, | |
| 63 string16* error) const; | |
| 64 | |
| 65 // Forced on | |
| 66 bool MustRemainEnabled(const Extension* extension, | |
| 67 string16* error) const; | |
| 68 | |
| 69 // For use in testing. | |
| 70 void UnregisterAllDelegates(); | |
| 71 size_t CountDelegates(); | |
|
Aaron Boodman
2012/05/17 22:41:06
Use int.
Aaron Boodman
2012/05/17 22:41:06
GetNumDelegates().
| |
| 72 | |
| 73 private: | |
| 74 typedef std::set<Delegate*> DelegateList; | |
| 75 DelegateList delegates_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementPolicy); | |
| 78 }; | |
| 79 | |
| 80 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_POLICY_H_ | |
| OLD | NEW |