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 | |
| 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_UI_H_ | |
| 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_UI_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/values.h" | |
| 12 #include "extensions/common/extension.h" | |
| 13 #include "extensions/common/manifest_handler.h" | |
| 14 #include "url/gurl.h" | |
| 15 | |
| 16 namespace extensions { | |
| 17 | |
| 18 // A class to provide options page configuration settings from the manifest. | |
| 19 class OptionsPageInfo : public Extension::ManifestData { | |
| 20 public: | |
| 21 OptionsPageInfo(const GURL& options_page, | |
| 22 const GURL& options_ui_page, | |
| 23 bool chrome_styles, | |
| 24 bool open_in_tab); | |
| 25 virtual ~OptionsPageInfo(); | |
| 26 | |
| 27 // Returns the URL to the given extension's options page. This method supports | |
| 28 // both the "options_ui.page" field and the legacy "options_page" field. If | |
| 29 // both are present, it will return the value of "options_ui.page". | |
| 30 static const GURL& GetOptionsPage(const Extension* extension); | |
| 31 | |
| 32 static bool HasOptionsPage(const Extension* extension); | |
|
not at google - send to devlin
2014/08/29 22:33:37
Comment.
ericzeng
2014/08/29 23:54:04
Done.
| |
| 33 | |
| 34 // Returns whether the Chrome user agent stylesheet should be applied to the | |
| 35 // given extension's options page. | |
| 36 static bool ShouldUseChromeStyle(const Extension* extension); | |
| 37 | |
| 38 // Returns whether the given extension's options page should be opened in a | |
| 39 // new tab instead of an embedded popup. | |
| 40 static bool ShouldOpenInTab(const Extension* extension); | |
| 41 | |
| 42 static scoped_ptr<OptionsPageInfo> Parse( | |
|
not at google - send to devlin
2014/08/29 22:33:37
Oh hey. Now that I'm reading this in daylight, it
ericzeng
2014/08/29 23:54:04
Done.
| |
| 43 Extension* extension, | |
| 44 const base::Value* options_ui_value, | |
| 45 const std::string& options_page_string, | |
| 46 std::vector<InstallWarning>* install_warnings, | |
| 47 base::string16* error); | |
| 48 | |
| 49 private: | |
| 50 bool LoadOptionsPage(const Extension* extension, base::string16* error); | |
|
Yoyo Zhou
2014/08/29 23:06:27
This looks unused.
ericzeng
2014/09/02 18:23:37
Done.
| |
| 51 | |
| 52 GURL options_page_; // The legacy options_page entry | |
| 53 GURL options_ui_page_; // The options_ui.page entry | |
| 54 bool chrome_styles_; | |
| 55 bool open_in_tab_; | |
| 56 }; | |
| 57 | |
| 58 // Parses the "options_ui" manifest key. | |
| 59 class OptionsPageManifestHandler : public ManifestHandler { | |
| 60 public: | |
| 61 OptionsPageManifestHandler(); | |
| 62 virtual ~OptionsPageManifestHandler(); | |
| 63 | |
| 64 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; | |
| 65 virtual bool Validate(const Extension* extension, | |
| 66 std::string* error, | |
| 67 std::vector<InstallWarning>* warnings) const OVERRIDE; | |
| 68 | |
| 69 private: | |
| 70 virtual const std::vector<std::string> Keys() const OVERRIDE; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(OptionsPageManifestHandler); | |
| 73 }; | |
| 74 | |
| 75 } // namespace extensions | |
| 76 | |
| 77 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_UI_H_ | |
| OLD | NEW |