| 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_WEBVIEW_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ |
| 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 14 #include "extensions/common/manifest_handler.h" | 14 #include "extensions/common/manifest_handler.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 class PartitionItem; | 18 class PartitionItem; |
| 19 | 19 |
| 20 // A class to hold the <webview> accessible extension resources | 20 // A class to hold the <webview> accessible extension resources |
| 21 // that may be specified in the manifest of an extension using the | 21 // that may be specified in the manifest of an extension using the |
| 22 // "webview" key. | 22 // "webview" key. |
| 23 class WebviewInfo : public Extension::ManifestData { | 23 class WebviewInfo : public Extension::ManifestData { |
| 24 public: | 24 public: |
| 25 // Returns true if |extension|'s resource at |relative_path| is accessible | 25 // Returns true if |extension|'s resource at |relative_path| is accessible |
| 26 // from the WebView partition with ID |partition_id|. | 26 // from the WebView partition with ID |partition_id|. |
| 27 static bool IsResourceWebviewAccessible(const Extension* extension, | 27 static bool IsResourceWebviewAccessible(const Extension* extension, |
| 28 const std::string& partition_id, | 28 const std::string& partition_id, |
| 29 const std::string& relative_path); | 29 const std::string& relative_path); |
| 30 | 30 |
| 31 // Define out of line constructor/destructor to please Clang. | 31 // Define out of line constructor/destructor to please Clang. |
| 32 WebviewInfo(const std::string& extension_id); | 32 WebviewInfo(const std::string& extension_id); |
| 33 ~WebviewInfo() override; | 33 ~WebviewInfo() override; |
| 34 | 34 |
| 35 void AddPartitionItem(scoped_ptr<PartitionItem> item); | 35 void AddPartitionItem(std::unique_ptr<PartitionItem> item); |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 std::string extension_id_; | 38 std::string extension_id_; |
| 39 std::vector<scoped_ptr<PartitionItem>> partition_items_; | 39 std::vector<std::unique_ptr<PartitionItem>> partition_items_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(WebviewInfo); | 41 DISALLOW_COPY_AND_ASSIGN(WebviewInfo); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // Parses the "webview" manifest key. | 44 // Parses the "webview" manifest key. |
| 45 class WebviewHandler : public ManifestHandler { | 45 class WebviewHandler : public ManifestHandler { |
| 46 public: | 46 public: |
| 47 WebviewHandler(); | 47 WebviewHandler(); |
| 48 ~WebviewHandler() override; | 48 ~WebviewHandler() override; |
| 49 | 49 |
| 50 bool Parse(Extension* extension, base::string16* error) override; | 50 bool Parse(Extension* extension, base::string16* error) override; |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 const std::vector<std::string> Keys() const override; | 53 const std::vector<std::string> Keys() const override; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(WebviewHandler); | 55 DISALLOW_COPY_AND_ASSIGN(WebviewHandler); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace extensions | 58 } // namespace extensions |
| 59 | 59 |
| 60 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ | 60 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ |
| OLD | NEW |