| 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/pattern.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return accessible_resources_; | 44 return accessible_resources_; |
| 45 } | 45 } |
| 46 private: | 46 private: |
| 47 // A pattern string that matches partition IDs. | 47 // A pattern string that matches partition IDs. |
| 48 const std::string partition_pattern_; | 48 const std::string partition_pattern_; |
| 49 // A URL pattern set of resources accessible to the given | 49 // A URL pattern set of resources accessible to the given |
| 50 // |partition_pattern_|. | 50 // |partition_pattern_|. |
| 51 URLPatternSet accessible_resources_; | 51 URLPatternSet accessible_resources_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // static. |
| 55 const WebviewInfo* WebviewInfo::Get(const Extension* extension) { |
| 56 return static_cast<const WebviewInfo*>( |
| 57 extension->GetManifestData(keys::kWebviewAccessibleResources)); |
| 58 } |
| 59 |
| 54 WebviewInfo::WebviewInfo(const std::string& extension_id) | 60 WebviewInfo::WebviewInfo(const std::string& extension_id) |
| 55 : extension_id_(extension_id) { | 61 : extension_id_(extension_id) { |
| 56 } | 62 } |
| 57 | 63 |
| 58 WebviewInfo::~WebviewInfo() { | 64 WebviewInfo::~WebviewInfo() { |
| 59 } | 65 } |
| 60 | 66 |
| 61 bool WebviewInfo::IsResourceWebviewAccessible( | 67 bool WebviewInfo::IsResourceWebviewAccessible( |
| 62 const Extension* extension, | 68 const Extension* extension, |
| 63 const std::string& partition_id, | 69 const std::string& partition_id, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 168 |
| 163 extension->SetManifestData(keys::kWebviewAccessibleResources, info.release()); | 169 extension->SetManifestData(keys::kWebviewAccessibleResources, info.release()); |
| 164 return true; | 170 return true; |
| 165 } | 171 } |
| 166 | 172 |
| 167 const std::vector<std::string> WebviewHandler::Keys() const { | 173 const std::vector<std::string> WebviewHandler::Keys() const { |
| 168 return SingleKey(keys::kWebview); | 174 return SingleKey(keys::kWebview); |
| 169 } | 175 } |
| 170 | 176 |
| 171 } // namespace extensions | 177 } // namespace extensions |
| OLD | NEW |