| 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 #include "extensions/common/manifest_handlers/webview_info.h" | 5 #include "extensions/common/manifest_handlers/webview_info.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/pattern.h" |
| 8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 #include "extensions/common/error_utils.h" | 13 #include "extensions/common/error_utils.h" |
| 13 #include "extensions/common/manifest.h" | 14 #include "extensions/common/manifest.h" |
| 14 #include "extensions/common/manifest_constants.h" | 15 #include "extensions/common/manifest_constants.h" |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace extensions { |
| 17 | 18 |
| 18 namespace keys = extensions::manifest_keys; | 19 namespace keys = extensions::manifest_keys; |
| 19 namespace errors = extensions::manifest_errors; | 20 namespace errors = extensions::manifest_errors; |
| 20 | 21 |
| 21 // A PartitionItem represents a set of accessible resources given a partition | 22 // A PartitionItem represents a set of accessible resources given a partition |
| 22 // ID pattern. | 23 // ID pattern. |
| 23 class PartitionItem { | 24 class PartitionItem { |
| 24 public: | 25 public: |
| 25 explicit PartitionItem(const std::string& partition_pattern) | 26 explicit PartitionItem(const std::string& partition_pattern) |
| 26 : partition_pattern_(partition_pattern) { | 27 : partition_pattern_(partition_pattern) { |
| 27 } | 28 } |
| 28 | 29 |
| 29 virtual ~PartitionItem() { | 30 virtual ~PartitionItem() { |
| 30 } | 31 } |
| 31 | 32 |
| 32 bool Matches(const std::string& partition_id) const { | 33 bool Matches(const std::string& partition_id) const { |
| 33 return MatchPattern(partition_id, partition_pattern_); | 34 return base::MatchPattern(partition_id, partition_pattern_); |
| 34 } | 35 } |
| 35 | 36 |
| 36 // Adds a pattern to the set. Returns true if a new pattern was inserted, | 37 // Adds a pattern to the set. Returns true if a new pattern was inserted, |
| 37 // false if the pattern was already in the set. | 38 // false if the pattern was already in the set. |
| 38 bool AddPattern(const URLPattern& pattern) { | 39 bool AddPattern(const URLPattern& pattern) { |
| 39 return accessible_resources_.AddPattern(pattern); | 40 return accessible_resources_.AddPattern(pattern); |
| 40 } | 41 } |
| 41 | 42 |
| 42 const URLPatternSet& accessible_resources() const { | 43 const URLPatternSet& accessible_resources() const { |
| 43 return accessible_resources_; | 44 return accessible_resources_; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 162 |
| 162 extension->SetManifestData(keys::kWebviewAccessibleResources, info.release()); | 163 extension->SetManifestData(keys::kWebviewAccessibleResources, info.release()); |
| 163 return true; | 164 return true; |
| 164 } | 165 } |
| 165 | 166 |
| 166 const std::vector<std::string> WebviewHandler::Keys() const { | 167 const std::vector<std::string> WebviewHandler::Keys() const { |
| 167 return SingleKey(keys::kWebview); | 168 return SingleKey(keys::kWebview); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace extensions | 171 } // namespace extensions |
| OLD | NEW |