| 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 CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // The parsed form of the automation manifest entry. | 36 // The parsed form of the automation manifest entry. |
| 37 struct AutomationInfo : public Extension::ManifestData { | 37 struct AutomationInfo : public Extension::ManifestData { |
| 38 public: | 38 public: |
| 39 static const AutomationInfo* Get(const Extension* extension); | 39 static const AutomationInfo* Get(const Extension* extension); |
| 40 static scoped_ptr<AutomationInfo> FromValue( | 40 static scoped_ptr<AutomationInfo> FromValue( |
| 41 const base::Value& value, | 41 const base::Value& value, |
| 42 std::vector<InstallWarning>* install_warnings, | 42 std::vector<InstallWarning>* install_warnings, |
| 43 base::string16* error); | 43 base::string16* error); |
| 44 | 44 |
| 45 static scoped_ptr<base::Value> ToValue(const AutomationInfo& info); | 45 static scoped_ptr<base::Value> ToValue(const AutomationInfo& info); |
| 46 virtual ~AutomationInfo(); | 46 ~AutomationInfo() override; |
| 47 | 47 |
| 48 // true if the extension has requested 'desktop' permission. | 48 // true if the extension has requested 'desktop' permission. |
| 49 const bool desktop; | 49 const bool desktop; |
| 50 | 50 |
| 51 // Returns the list of hosts that this extension can request an automation | 51 // Returns the list of hosts that this extension can request an automation |
| 52 // tree from. | 52 // tree from. |
| 53 const URLPatternSet matches; | 53 const URLPatternSet matches; |
| 54 | 54 |
| 55 // Whether the extension is allowed interactive access (true) or read-only | 55 // Whether the extension is allowed interactive access (true) or read-only |
| 56 // access (false) to the automation tree. | 56 // access (false) to the automation tree. |
| 57 const bool interact; | 57 const bool interact; |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 AutomationInfo(); | 60 AutomationInfo(); |
| 61 AutomationInfo(bool desktop, URLPatternSet matches, bool interact); | 61 AutomationInfo(bool desktop, URLPatternSet matches, bool interact); |
| 62 | 62 |
| 63 static scoped_ptr<api::manifest_types::Automation> AsManifestType( | 63 static scoped_ptr<api::manifest_types::Automation> AsManifestType( |
| 64 const AutomationInfo& info); | 64 const AutomationInfo& info); |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(AutomationInfo); | 66 DISALLOW_COPY_AND_ASSIGN(AutomationInfo); |
| 67 friend class AutomationManifestPermission; | 67 friend class AutomationManifestPermission; |
| 68 friend class AutomationHandler; | 68 friend class AutomationHandler; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Parses the automation manifest entry. | 71 // Parses the automation manifest entry. |
| 72 class AutomationHandler : public ManifestHandler { | 72 class AutomationHandler : public ManifestHandler { |
| 73 public: | 73 public: |
| 74 AutomationHandler(); | 74 AutomationHandler(); |
| 75 virtual ~AutomationHandler(); | 75 ~AutomationHandler() override; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 // ManifestHandler implementation. | 78 // ManifestHandler implementation. |
| 79 virtual bool Parse(Extension* extensions, base::string16* error) override; | 79 bool Parse(Extension* extensions, base::string16* error) override; |
| 80 | 80 |
| 81 virtual ManifestPermission* CreatePermission() override; | 81 ManifestPermission* CreatePermission() override; |
| 82 virtual ManifestPermission* CreateInitialRequiredPermission( | 82 ManifestPermission* CreateInitialRequiredPermission( |
| 83 const Extension* extension) override; | 83 const Extension* extension) override; |
| 84 virtual const std::vector<std::string> Keys() const override; | 84 const std::vector<std::string> Keys() const override; |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(AutomationHandler); | 86 DISALLOW_COPY_AND_ASSIGN(AutomationHandler); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 } // namespace extensions | 89 } // namespace extensions |
| 90 | 90 |
| 91 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_ | 91 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_AUTOMATION_H_ |
| OLD | NEW |