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

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

Issue 2958343002: [Extensions] Change renderer-side web accessible resource determination (Closed)
Patch Set: s/web_accessible_ids/web_accessible_ids_ Created 3 years, 5 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.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (item->Matches(partition_id) && 79 if (item->Matches(partition_id) &&
80 extension->ResourceMatches(item->accessible_resources(), 80 extension->ResourceMatches(item->accessible_resources(),
81 relative_path)) { 81 relative_path)) {
82 return true; 82 return true;
83 } 83 }
84 } 84 }
85 85
86 return false; 86 return false;
87 } 87 }
88 88
89 // static
90 bool WebviewInfo::HasWebviewAccessibleResources(
91 const Extension& extension,
92 const std::string& partition_id) {
93 const WebviewInfo* webview_info = static_cast<const WebviewInfo*>(
94 extension.GetManifestData(keys::kWebviewAccessibleResources));
95 if (!webview_info)
96 return false;
97
98 for (const auto& item : webview_info->partition_items_) {
99 if (item->Matches(partition_id))
100 return true;
101 }
102 return false;
103 }
104
89 void WebviewInfo::AddPartitionItem(std::unique_ptr<PartitionItem> item) { 105 void WebviewInfo::AddPartitionItem(std::unique_ptr<PartitionItem> item) {
90 partition_items_.push_back(std::move(item)); 106 partition_items_.push_back(std::move(item));
91 } 107 }
92 108
93 WebviewHandler::WebviewHandler() { 109 WebviewHandler::WebviewHandler() {
94 } 110 }
95 111
96 WebviewHandler::~WebviewHandler() { 112 WebviewHandler::~WebviewHandler() {
97 } 113 }
98 114
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 extension->SetManifestData(keys::kWebviewAccessibleResources, 185 extension->SetManifestData(keys::kWebviewAccessibleResources,
170 std::move(info)); 186 std::move(info));
171 return true; 187 return true;
172 } 188 }
173 189
174 const std::vector<std::string> WebviewHandler::Keys() const { 190 const std::vector<std::string> WebviewHandler::Keys() const {
175 return SingleKey(keys::kWebview); 191 return SingleKey(keys::kWebview);
176 } 192 }
177 193
178 } // namespace extensions 194 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/manifest_handlers/webview_info.h ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698