| 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_EXTERNALLY_CONNECTABLE_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ |
| 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 extern const char kErrorInvalidId[]; | 29 extern const char kErrorInvalidId[]; |
| 30 extern const char kErrorNothingSpecified[]; | 30 extern const char kErrorNothingSpecified[]; |
| 31 extern const char kErrorTopLevelDomainsNotAllowed[]; | 31 extern const char kErrorTopLevelDomainsNotAllowed[]; |
| 32 extern const char kErrorWildcardHostsNotAllowed[]; | 32 extern const char kErrorWildcardHostsNotAllowed[]; |
| 33 } // namespace externally_connectable_errors | 33 } // namespace externally_connectable_errors |
| 34 | 34 |
| 35 // Parses the externally_connectable manifest entry. | 35 // Parses the externally_connectable manifest entry. |
| 36 class ExternallyConnectableHandler : public ManifestHandler { | 36 class ExternallyConnectableHandler : public ManifestHandler { |
| 37 public: | 37 public: |
| 38 ExternallyConnectableHandler(); | 38 ExternallyConnectableHandler(); |
| 39 virtual ~ExternallyConnectableHandler(); | 39 ~ExternallyConnectableHandler() override; |
| 40 | 40 |
| 41 virtual bool Parse(Extension* extension, base::string16* error) override; | 41 bool Parse(Extension* extension, base::string16* error) override; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 virtual const std::vector<std::string> Keys() const override; | 44 const std::vector<std::string> Keys() const override; |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableHandler); | 46 DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableHandler); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // The parsed form of the externally_connectable manifest entry. | 49 // The parsed form of the externally_connectable manifest entry. |
| 50 struct ExternallyConnectableInfo : public Extension::ManifestData { | 50 struct ExternallyConnectableInfo : public Extension::ManifestData { |
| 51 public: | 51 public: |
| 52 // Gets the ExternallyConnectableInfo for |extension|, or NULL if none was | 52 // Gets the ExternallyConnectableInfo for |extension|, or NULL if none was |
| 53 // specified. | 53 // specified. |
| 54 static ExternallyConnectableInfo* Get(const Extension* extension); | 54 static ExternallyConnectableInfo* Get(const Extension* extension); |
| 55 | 55 |
| 56 // Tries to construct the info based on |value|, as it would have appeared in | 56 // Tries to construct the info based on |value|, as it would have appeared in |
| 57 // the manifest. Sets |error| and returns an empty scoped_ptr on failure. | 57 // the manifest. Sets |error| and returns an empty scoped_ptr on failure. |
| 58 static scoped_ptr<ExternallyConnectableInfo> FromValue( | 58 static scoped_ptr<ExternallyConnectableInfo> FromValue( |
| 59 const base::Value& value, | 59 const base::Value& value, |
| 60 bool allow_all_urls, | 60 bool allow_all_urls, |
| 61 std::vector<InstallWarning>* install_warnings, | 61 std::vector<InstallWarning>* install_warnings, |
| 62 base::string16* error); | 62 base::string16* error); |
| 63 | 63 |
| 64 virtual ~ExternallyConnectableInfo(); | 64 ~ExternallyConnectableInfo() override; |
| 65 | 65 |
| 66 // The URL patterns that are allowed to connect/sendMessage. | 66 // The URL patterns that are allowed to connect/sendMessage. |
| 67 const URLPatternSet matches; | 67 const URLPatternSet matches; |
| 68 | 68 |
| 69 // The extension IDs that are allowed to connect/sendMessage. Sorted. | 69 // The extension IDs that are allowed to connect/sendMessage. Sorted. |
| 70 const std::vector<std::string> ids; | 70 const std::vector<std::string> ids; |
| 71 | 71 |
| 72 // True if any extension is allowed to connect. This would have corresponded | 72 // True if any extension is allowed to connect. This would have corresponded |
| 73 // to an ID of "*" in |ids|. | 73 // to an ID of "*" in |ids|. |
| 74 const bool all_ids; | 74 const bool all_ids; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 89 bool all_ids, | 89 bool all_ids, |
| 90 bool accepts_tls_channel_id); | 90 bool accepts_tls_channel_id); |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableInfo); | 93 DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableInfo); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace extensions | 96 } // namespace extensions |
| 97 | 97 |
| 98 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ | 98 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ |
| OLD | NEW |