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

Side by Side Diff: extensions/common/manifest_handlers/options_page_info.h

Issue 518653002: Add the "options_ui" extension manifest field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 enum OptionsUrlType { OPTIONS_PAGE, OPTIONS_UI_PAGE };
not at google - send to devlin 2014/08/29 05:39:25 When is this used?
ericzeng 2014/08/29 16:52:22 It's used in OptionsPageInfo::FromValues to determ
ericzeng 2014/08/29 22:08:51 Removed (as discussed in person)
22
23 OptionsPageInfo(GURL options_page,
not at google - send to devlin 2014/08/29 05:39:25 const GURL& and below.
24 GURL options_ui_page,
25 bool chrome_styles,
26 bool open_in_tab);
27 virtual ~OptionsPageInfo();
28
29 // Returns the URL to the given extension's options page. This method supports
30 // both the "options_ui.page" field and the legacy "options_page" field. If
31 // both are present, it will return the value of "options_ui.page".
32 static GURL GetOptionsPage(const Extension* extension);
not at google - send to devlin 2014/08/29 05:39:25 Put line breaks between the method declaration and
ericzeng 2014/08/29 22:08:52 Done.
33 // Returns whether the Chrome user agent stylesheet should be applied to the
34 // given extension's options page.
35 static bool ChromeStyle(const Extension* extension);
not at google - send to devlin 2014/08/29 05:39:25 IsChromeStyle?
ericzeng 2014/08/29 16:52:22 I thought that just naming the method the same thi
ericzeng 2014/08/29 22:08:51 Changed to ShouldUseChromeStyle as discussed in pe
36 // Returns whether the given extension's options page should be opened in a
37 // new tab instead of an embedded popup.
38 static bool OpenInTab(const Extension* extension);
39
40 static scoped_ptr<OptionsPageInfo> FromValues(
41 Extension* extension,
42 const base::Value* options_ui_value,
43 const base::Value* options_page_value,
44 std::vector<InstallWarning>* install_warnings,
45 base::string16* error);
46
47 private:
48 bool LoadOptionsPage(const Extension* extension, base::string16* error);
49
50 GURL options_page_; // The legacy options_page entry
51 GURL options_ui_page_; // The options_ui.page entry
52 bool chrome_styles_;
53 bool open_in_tab_;
54 };
55
56 // Parses the "options_ui" manifest key.
57 class OptionsPageManifestHandler : public ManifestHandler {
58 public:
59 OptionsPageManifestHandler();
60 virtual ~OptionsPageManifestHandler();
61
62 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE;
63 virtual bool Validate(const Extension* extension,
64 std::string* error,
65 std::vector<InstallWarning>* warnings) const OVERRIDE;
66
67 private:
68 virtual const std::vector<std::string> Keys() const OVERRIDE;
69
70 DISALLOW_COPY_AND_ASSIGN(OptionsPageManifestHandler);
71 };
72
73 } // namespace extensions
74
75 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_OPTIONS_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698