OLD | NEW |
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_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ |
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ |
7 | 7 |
8 #include "chrome/common/extensions/api/manifest_types.h" | 8 #include "chrome/common/extensions/api/manifest_types.h" |
9 #include "extensions/common/extension.h" | 9 #include "extensions/common/extension.h" |
10 #include "extensions/common/manifest_handler.h" | 10 #include "extensions/common/manifest_handler.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 class ManifestPermission; | 14 class ManifestPermission; |
15 | 15 |
16 // SettingsOverride is associated with "chrome_settings_overrides" manifest key. | 16 // UIOverrides is associated with "chrome_ui_overrides" manifest key, and |
17 // An extension can add a search engine as default or non-default, overwrite the | 17 // represents manifest settings to override aspects of the Chrome user |
18 // homepage and append a startup page to the list. | 18 // interface. |
19 struct SettingsOverrides : public Extension::ManifestData { | 19 struct UIOverrides : public Extension::ManifestData { |
20 SettingsOverrides(); | 20 UIOverrides(); |
21 virtual ~SettingsOverrides(); | 21 virtual ~UIOverrides(); |
22 | 22 |
23 static const SettingsOverrides* Get(const Extension* extension); | 23 static const UIOverrides* Get(const Extension* extension); |
24 | 24 |
25 static bool RemovesBookmarkButton( | 25 static bool RemovesBookmarkButton(const UIOverrides& ui_overrides); |
26 const SettingsOverrides& settings_overrides); | 26 static bool RemovesBookmarkShortcut(const UIOverrides& ui_overrides); |
27 static bool RemovesBookmarkShortcut( | |
28 const SettingsOverrides& settings_overrides); | |
29 | 27 |
30 scoped_ptr<api::manifest_types::ChromeSettingsOverrides::Bookmarks_ui> | 28 scoped_ptr<api::manifest_types::ChromeUIOverrides::Bookmarks_ui> bookmarks_ui; |
31 bookmarks_ui; | |
32 scoped_ptr<api::manifest_types::ChromeSettingsOverrides::Search_provider> | |
33 search_engine; | |
34 scoped_ptr<GURL> homepage; | |
35 std::vector<GURL> startup_pages; | |
36 | 29 |
37 scoped_ptr<ManifestPermission> manifest_permission; | 30 scoped_ptr<ManifestPermission> manifest_permission; |
38 | 31 |
39 private: | 32 private: |
40 DISALLOW_COPY_AND_ASSIGN(SettingsOverrides); | 33 DISALLOW_COPY_AND_ASSIGN(UIOverrides); |
41 }; | 34 }; |
42 | 35 |
43 class SettingsOverridesHandler : public ManifestHandler { | 36 class UIOverridesHandler : public ManifestHandler { |
44 public: | 37 public: |
45 SettingsOverridesHandler(); | 38 UIOverridesHandler(); |
46 virtual ~SettingsOverridesHandler(); | 39 virtual ~UIOverridesHandler(); |
47 | 40 |
48 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; | 41 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; |
49 virtual bool Validate(const Extension* extension, | 42 virtual bool Validate(const Extension* extension, |
50 std::string* error, | 43 std::string* error, |
51 std::vector<InstallWarning>* warnings) const OVERRIDE; | 44 std::vector<InstallWarning>* warnings) const OVERRIDE; |
52 | 45 |
53 virtual ManifestPermission* CreatePermission() OVERRIDE; | 46 virtual ManifestPermission* CreatePermission() OVERRIDE; |
54 virtual ManifestPermission* CreateInitialRequiredPermission( | 47 virtual ManifestPermission* CreateInitialRequiredPermission( |
55 const Extension* extension) OVERRIDE; | 48 const Extension* extension) OVERRIDE; |
56 | 49 |
57 private: | 50 private: |
58 class ManifestPermissionImpl; | 51 class ManifestPermissionImpl; |
59 | 52 |
60 virtual const std::vector<std::string> Keys() const OVERRIDE; | 53 virtual const std::vector<std::string> Keys() const OVERRIDE; |
61 | 54 |
62 DISALLOW_COPY_AND_ASSIGN(SettingsOverridesHandler); | 55 DISALLOW_COPY_AND_ASSIGN(UIOverridesHandler); |
63 }; | 56 }; |
64 | 57 |
65 } // namespace extensions | 58 } // namespace extensions |
66 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ | 59 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ |
OLD | NEW |