Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / chrome / common / extensions / manifest_handlers / automation.h
blob2eaed61f500a858bfd37959566527b27ca0019f5
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.
5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/manifest_handler.h"
13 #include "extensions/common/url_pattern_set.h"
14 #include "extensions/common/user_script.h"
16 namespace extensions {
18 namespace api {
19 namespace manifest_types {
20 struct Automation;
24 class URLPatternSet;
25 class AutomationManifestPermission;
27 namespace automation_errors {
28 extern const char kErrorInvalidMatchPattern[];
29 extern const char kErrorDesktopTrueInteractFalse[];
30 extern const char kErrorDesktopTrueMatchesSpecified[];
31 extern const char kErrorURLMalformed[];
32 extern const char kErrorInvalidMatch[];
33 extern const char kErrorNoMatchesProvided[];
36 // The parsed form of the automation manifest entry.
37 struct AutomationInfo : public Extension::ManifestData {
38 public:
39 static const AutomationInfo* Get(const Extension* extension);
40 static scoped_ptr<AutomationInfo> FromValue(
41 const base::Value& value,
42 std::vector<InstallWarning>* install_warnings,
43 base::string16* error);
45 static scoped_ptr<base::Value> ToValue(const AutomationInfo& info);
46 ~AutomationInfo() override;
48 // true if the extension has requested 'desktop' permission.
49 const bool desktop;
51 // Returns the list of hosts that this extension can request an automation
52 // tree from.
53 const URLPatternSet matches;
55 // Whether the extension is allowed interactive access (true) or read-only
56 // access (false) to the automation tree.
57 const bool interact;
59 private:
60 AutomationInfo();
61 AutomationInfo(bool desktop, URLPatternSet matches, bool interact);
63 static scoped_ptr<api::manifest_types::Automation> AsManifestType(
64 const AutomationInfo& info);
66 DISALLOW_COPY_AND_ASSIGN(AutomationInfo);
67 friend class AutomationManifestPermission;
68 friend class AutomationHandler;
71 // Parses the automation manifest entry.
72 class AutomationHandler : public ManifestHandler {
73 public:
74 AutomationHandler();
75 ~AutomationHandler() override;
77 private:
78 // ManifestHandler implementation.
79 bool Parse(Extension* extensions, base::string16* error) override;
81 ManifestPermission* CreatePermission() override;
82 ManifestPermission* CreateInitialRequiredPermission(
83 const Extension* extension) override;
84 const std::vector<std::string> Keys() const override;
86 DISALLOW_COPY_AND_ASSIGN(AutomationHandler);
89 } // namespace extensions
91 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_