Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: extensions/common/manifest_handlers/webview_info.cc

Issue 1312653003: Fix for WebView accessible resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fix. Rebased. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/common/manifest_handlers/webview_info.h ('k') | extensions/renderer/dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 URLPatternSet accessible_resources_; 51 URLPatternSet accessible_resources_;
52 }; 52 };
53 53
54 WebviewInfo::WebviewInfo(const std::string& extension_id) 54 WebviewInfo::WebviewInfo(const std::string& extension_id)
55 : extension_id_(extension_id) { 55 : extension_id_(extension_id) {
56 } 56 }
57 57
58 WebviewInfo::~WebviewInfo() { 58 WebviewInfo::~WebviewInfo() {
59 } 59 }
60 60
61 // static
61 bool WebviewInfo::IsResourceWebviewAccessible( 62 bool WebviewInfo::IsResourceWebviewAccessible(
62 const Extension* extension, 63 const Extension* extension,
63 const std::string& partition_id, 64 const std::string& partition_id,
64 const std::string& relative_path) const { 65 const std::string& relative_path) {
65 if (!extension || extension->id() != extension_id_) 66 if (!extension)
66 return false; 67 return false;
67 68
68 DCHECK_EQ(this, 69 const WebviewInfo* webview_info = static_cast<const WebviewInfo*>(
69 extension->GetManifestData(keys::kWebviewAccessibleResources)); 70 extension->GetManifestData(keys::kWebviewAccessibleResources));
71 if (!webview_info)
72 return false;
70 73
71 for (size_t i = 0; i < partition_items_.size(); ++i) { 74 for (const PartitionItem* item : webview_info->partition_items_) {
72 const PartitionItem* const item = partition_items_[i];
73 if (item->Matches(partition_id) && 75 if (item->Matches(partition_id) &&
74 extension->ResourceMatches(item->accessible_resources(), 76 extension->ResourceMatches(item->accessible_resources(),
75 relative_path)) { 77 relative_path)) {
76 return true; 78 return true;
77 } 79 }
78 } 80 }
79 81
80 return false; 82 return false;
81 } 83 }
82 84
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 extension->SetManifestData(keys::kWebviewAccessibleResources, info.release()); 165 extension->SetManifestData(keys::kWebviewAccessibleResources, info.release());
164 return true; 166 return true;
165 } 167 }
166 168
167 const std::vector<std::string> WebviewHandler::Keys() const { 169 const std::vector<std::string> WebviewHandler::Keys() const {
168 return SingleKey(keys::kWebview); 170 return SingleKey(keys::kWebview);
169 } 171 }
170 172
171 } // namespace extensions 173 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/manifest_handlers/webview_info.h ('k') | extensions/renderer/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698