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

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

Issue 602803002: Refactor ExtensionManagement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-fix
Patch Set: fix addressing #7 Created 6 years, 2 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
(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 "base/macros.h"
11 #include "chrome/browser/extensions/extension_management.h"
12 #include "extensions/common/manifest.h"
13
14 namespace base {
15 class DictionaryValue;
16 } // namespace base
17
18 namespace extensions {
19
20 class URLPatternSet;
21
22 namespace internal {
23
24 // Class to hold extension management settings for one or a group of
25 // extensions. Settings can be applied to an individual extension identified
26 // by an ID, a group of extensions with specific |update_url| or all
27 // extensions at once.
28 struct IndividualSettings {
29 enum ParsingScope {
30 // Parses the default settings.
31 SCOPE_DEFAULT = 0,
32 // Parses the settings for an extension with specified extension ID.
33 SCOPE_INDIVIDUAL,
34 };
35
36 IndividualSettings();
37 ~IndividualSettings();
38
39 void Reset();
40
41 // Parses the individual settings. |dict| is the a sub-dictionary in extension
42 // management preference and |scope| represents the applicable range of the
43 // settings, a single extension, a group of extensions or default settings.
44 // Note that in case of parsing errors, |this| will NOT be left untouched.
45 bool Parse(const base::DictionaryValue* dict, ParsingScope scope);
46
47 // Extension installation mode. Setting this to INSTALLATION_FORCED or
48 // INSTALLATION_RECOMMENDED will enable extension auto-loading (only
49 // applicable to single extension), and in this case the |update_url| must
50 // be specified, containing the update URL for this extension.
51 // Note that |update_url| will be ignored for INSTALLATION_ALLOWED and
52 // INSTALLATION_BLOCKED installation mode.
53 // These settings will override the default settings, and unspecified
54 // settings will take value from default settings.
55 ExtensionManagement::InstallationMode installation_mode;
56 std::string update_url;
57
58 private:
59 DISALLOW_ASSIGN(IndividualSettings);
60 };
61
62 // Global extension management settings, applicable to all extensions.
63 struct GlobalSettings {
64 GlobalSettings();
65 ~GlobalSettings();
66
67 void Reset();
68
69 // Settings specifying which URLs are allowed to install extensions, will be
70 // enforced only if |has_restricted_install_sources| is set to true.
71 URLPatternSet install_sources;
72 bool has_restricted_install_sources;
73
74 // Settings specifying all allowed app/extension types, will be enforced
75 // only of |has_restricted_allowed_types| is set to true.
76 std::vector<Manifest::Type> allowed_types;
77 bool has_restricted_allowed_types;
78
79 private:
80 DISALLOW_COPY_AND_ASSIGN(GlobalSettings);
81 };
82
83 } // namespace internal
84
85 } // namespace extensions
86
87 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_INTERNAL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management.cc ('k') | chrome/browser/extensions/extension_management_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698