Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ | |
| 5 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ | |
| 6 | |
| 7 #include <string> | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "chrome/browser/extensions/extension_management.h" | |
| 11 #include "extensions/common/manifest.h" | |
| 12 | |
| 13 namespace base { | |
| 14 class DictionaryValue; | |
| 15 } // namespace base | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 class URLPatternSet; | |
| 20 | |
| 21 namespace internal { | |
|
Joao da Silva
2014/09/25 08:53:51
The names in this file are specific to the Extensi
binjin
2014/09/25 13:19:19
I moved Scope Into IndividualSettings instead. "ex
| |
| 22 | |
| 23 enum Scope { | |
| 24 // Parses the default settings. | |
| 25 SCOPE_DEFAULT = 0, | |
| 26 // Parses the settings for an extension with specified extension ID. | |
| 27 SCOPE_INDIVIDUAL, | |
| 28 }; | |
| 29 | |
| 30 // Class to hold extension management settings for one or a group of | |
| 31 // extensions. Settings can be applied to an individual extension identified | |
| 32 // by an ID, a group of extensions with specific |update_url| or all | |
| 33 // extensions at once. | |
| 34 struct IndividualSettings { | |
| 35 IndividualSettings(); | |
| 36 ~IndividualSettings(); | |
| 37 | |
| 38 void Reset(); | |
| 39 | |
| 40 // Parses the individual settings. |dict| is the a sub-dictionary in extension | |
| 41 // management preference and |scope| represents the applicable range of the | |
| 42 // settings, a single extension, a group of extensions or default settings. | |
| 43 // Note that in case of parsing errors, |this| will NOT be left untouched. | |
| 44 bool Parse(const base::DictionaryValue* dict, Scope scope); | |
| 45 | |
| 46 // Extension installation mode. Setting this to INSTALLATION_FORCED or | |
| 47 // INSTALLATION_RECOMMENDED will enable extension auto-loading (only | |
| 48 // applicable to single extension), and in this case the |update_url| must | |
| 49 // be specified, containing the update URL for this extension. | |
| 50 // Note that |update_url| will be ignored for INSTALLATION_ALLOWED and | |
| 51 // INSTALLATION_BLOCKED installation mode. | |
| 52 // These settings will override the default settings, and unspecified | |
| 53 // settings will take value from default settings. | |
| 54 ExtensionManagement::InstallationMode installation_mode; | |
| 55 std::string update_url; | |
| 56 }; | |
|
Joao da Silva
2014/09/25 08:53:51
DISALLOW_COPY_AND_ASSIGN
binjin
2014/09/25 13:19:19
Done. I actually explicitly used copy constructor
| |
| 57 | |
| 58 // Global extension management settings, applicable to all extensions. | |
| 59 struct GlobalSettings { | |
| 60 GlobalSettings(); | |
| 61 ~GlobalSettings(); | |
| 62 | |
| 63 void Reset(); | |
| 64 | |
| 65 // Settings specifying which URLs are allowed to install extensions, will be | |
| 66 // enforced only if |has_restricted_install_sources| is set to true. | |
| 67 URLPatternSet install_sources; | |
| 68 bool has_restricted_install_sources; | |
| 69 | |
| 70 // Settings specifying all allowed app/extension types, will be enforced | |
| 71 // only of |has_restricted_allowed_types| is set to true. | |
| 72 std::vector<Manifest::Type> allowed_types; | |
| 73 bool has_restricted_allowed_types; | |
| 74 }; | |
|
Joao da Silva
2014/09/25 08:53:51
DISALLOW_COPY_AND_ASSIGN
binjin
2014/09/25 13:19:19
Done.
| |
| 75 | |
| 76 } // namespace internal | |
| 77 | |
| 78 } // namespace extensions | |
| 79 | |
| 80 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_ | |
| OLD | NEW |