OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_PAGE_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_PAGE_INFO_H_ |
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_PAGE_INFO_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_PAGE_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
13 #include "extensions/common/manifest_handler.h" | 13 #include "extensions/common/manifest_handler.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class Value; | 17 class Value; |
18 } | 18 } |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 | 21 |
22 // A class to provide options page configuration settings from the manifest. | 22 // A class to provide options page configuration settings from the manifest. |
23 class OptionsPageInfo : public Extension::ManifestData { | 23 class OptionsPageInfo : public Extension::ManifestData { |
24 public: | 24 public: |
25 OptionsPageInfo(const GURL& options_page, | 25 OptionsPageInfo(const GURL& options_page, |
26 bool chrome_styles, | 26 bool chrome_styles, |
27 bool open_in_tab); | 27 bool open_in_tab); |
28 virtual ~OptionsPageInfo(); | 28 ~OptionsPageInfo() override; |
29 | 29 |
30 // Returns the URL to the given extension's options page. This method supports | 30 // Returns the URL to the given extension's options page. This method supports |
31 // both the "options_ui.page" field and the legacy "options_page" field. If | 31 // both the "options_ui.page" field and the legacy "options_page" field. If |
32 // both are present, it will return the value of "options_ui.page". | 32 // both are present, it will return the value of "options_ui.page". |
33 static const GURL& GetOptionsPage(const Extension* extension); | 33 static const GURL& GetOptionsPage(const Extension* extension); |
34 | 34 |
35 // Returns true if the given extension has an options page. An extension has | 35 // Returns true if the given extension has an options page. An extension has |
36 // an options page if one or both of "options_ui.page" and "options_page" | 36 // an options page if one or both of "options_ui.page" and "options_page" |
37 // specify a valid options page. | 37 // specify a valid options page. |
38 static bool HasOptionsPage(const Extension* extension); | 38 static bool HasOptionsPage(const Extension* extension); |
(...skipping 23 matching lines...) Expand all Loading... |
62 | 62 |
63 bool open_in_tab_; | 63 bool open_in_tab_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(OptionsPageInfo); | 65 DISALLOW_COPY_AND_ASSIGN(OptionsPageInfo); |
66 }; | 66 }; |
67 | 67 |
68 // Parses the "options_ui" manifest key and the legacy "options_page" key. | 68 // Parses the "options_ui" manifest key and the legacy "options_page" key. |
69 class OptionsPageManifestHandler : public ManifestHandler { | 69 class OptionsPageManifestHandler : public ManifestHandler { |
70 public: | 70 public: |
71 OptionsPageManifestHandler(); | 71 OptionsPageManifestHandler(); |
72 virtual ~OptionsPageManifestHandler(); | 72 ~OptionsPageManifestHandler() override; |
73 | 73 |
74 virtual bool Parse(Extension* extension, base::string16* error) override; | 74 bool Parse(Extension* extension, base::string16* error) override; |
75 virtual bool Validate(const Extension* extension, | 75 bool Validate(const Extension* extension, |
76 std::string* error, | 76 std::string* error, |
77 std::vector<InstallWarning>* warnings) const override; | 77 std::vector<InstallWarning>* warnings) const override; |
78 | 78 |
79 private: | 79 private: |
80 virtual const std::vector<std::string> Keys() const override; | 80 const std::vector<std::string> Keys() const override; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(OptionsPageManifestHandler); | 82 DISALLOW_COPY_AND_ASSIGN(OptionsPageManifestHandler); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace extensions | 85 } // namespace extensions |
86 | 86 |
87 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_PAGE_INFO_H_ | 87 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_PAGE_INFO_H_ |
OLD | NEW |