| 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 <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "chrome/common/extensions/api/manifest_types.h" | 11 #include "chrome/common/extensions/api/manifest_types.h" |
| 10 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 11 #include "extensions/common/manifest_handler.h" | 13 #include "extensions/common/manifest_handler.h" |
| 12 | 14 |
| 13 namespace extensions { | 15 namespace extensions { |
| 14 | 16 |
| 15 class ManifestPermission; | 17 class ManifestPermission; |
| 16 | 18 |
| 17 // UIOverrides is associated with "chrome_ui_overrides" manifest key, and | 19 // UIOverrides is associated with "chrome_ui_overrides" manifest key, and |
| 18 // represents manifest settings to override aspects of the Chrome user | 20 // represents manifest settings to override aspects of the Chrome user |
| 19 // interface. | 21 // interface. |
| 20 struct UIOverrides : public Extension::ManifestData { | 22 struct UIOverrides : public Extension::ManifestData { |
| 21 UIOverrides(); | 23 UIOverrides(); |
| 22 ~UIOverrides() override; | 24 ~UIOverrides() override; |
| 23 | 25 |
| 24 static const UIOverrides* Get(const Extension* extension); | 26 static const UIOverrides* Get(const Extension* extension); |
| 25 | 27 |
| 26 static bool RemovesBookmarkButton(const Extension* extension); | 28 static bool RemovesBookmarkButton(const Extension* extension); |
| 27 static bool RemovesBookmarkShortcut(const Extension* extension); | 29 static bool RemovesBookmarkShortcut(const Extension* extension); |
| 28 static bool RemovesBookmarkOpenPagesShortcut(const Extension* extension); | 30 static bool RemovesBookmarkOpenPagesShortcut(const Extension* extension); |
| 29 | 31 |
| 30 scoped_ptr<api::manifest_types::ChromeUIOverrides::Bookmarks_ui> bookmarks_ui; | 32 std::unique_ptr<api::manifest_types::ChromeUIOverrides::Bookmarks_ui> |
| 33 bookmarks_ui; |
| 31 | 34 |
| 32 scoped_ptr<ManifestPermission> manifest_permission; | 35 std::unique_ptr<ManifestPermission> manifest_permission; |
| 33 | 36 |
| 34 private: | 37 private: |
| 35 DISALLOW_COPY_AND_ASSIGN(UIOverrides); | 38 DISALLOW_COPY_AND_ASSIGN(UIOverrides); |
| 36 }; | 39 }; |
| 37 | 40 |
| 38 class UIOverridesHandler : public ManifestHandler { | 41 class UIOverridesHandler : public ManifestHandler { |
| 39 public: | 42 public: |
| 40 UIOverridesHandler(); | 43 UIOverridesHandler(); |
| 41 ~UIOverridesHandler() override; | 44 ~UIOverridesHandler() override; |
| 42 | 45 |
| 43 bool Parse(Extension* extension, base::string16* error) override; | 46 bool Parse(Extension* extension, base::string16* error) override; |
| 44 bool Validate(const Extension* extension, | 47 bool Validate(const Extension* extension, |
| 45 std::string* error, | 48 std::string* error, |
| 46 std::vector<InstallWarning>* warnings) const override; | 49 std::vector<InstallWarning>* warnings) const override; |
| 47 | 50 |
| 48 ManifestPermission* CreatePermission() override; | 51 ManifestPermission* CreatePermission() override; |
| 49 ManifestPermission* CreateInitialRequiredPermission( | 52 ManifestPermission* CreateInitialRequiredPermission( |
| 50 const Extension* extension) override; | 53 const Extension* extension) override; |
| 51 | 54 |
| 52 private: | 55 private: |
| 53 class ManifestPermissionImpl; | 56 class ManifestPermissionImpl; |
| 54 | 57 |
| 55 const std::vector<std::string> Keys() const override; | 58 const std::vector<std::string> Keys() const override; |
| 56 | 59 |
| 57 DISALLOW_COPY_AND_ASSIGN(UIOverridesHandler); | 60 DISALLOW_COPY_AND_ASSIGN(UIOverridesHandler); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 } // namespace extensions | 63 } // namespace extensions |
| 61 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ | 64 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_UI_OVERRIDES_HANDLER_H_ |
| OLD | NEW |