summaryrefslogtreecommitdiffstats
path: root/extensions/common/manifest_handlers
diff options
context:
space:
mode:
authorpaulmeyer <paulmeyer@chromium.org>2015-09-09 08:29:59 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-09 15:30:39 +0000
commitad727fc6c70d04cdd0a9a7d14c4aa68b4c0e8e72 (patch)
tree636ac8f7f24b949da300eac03b6ac9668d8b0c84 /extensions/common/manifest_handlers
parentcb8a8e9c598b6a59c1955b89618680acdca17231 (diff)
downloadchromium_src-ad727fc6c70d04cdd0a9a7d14c4aa68b4c0e8e72.zip
chromium_src-ad727fc6c70d04cdd0a9a7d14c4aa68b4c0e8e72.tar.gz
chromium_src-ad727fc6c70d04cdd0a9a7d14c4aa68b4c0e8e72.tar.bz2
This patch allows the webview.partitions.accessible_resources entry in chrome app manifests to work fully as intended.
Previously, web pages attempting to use resources specified as webview accessible would fail to load those resources. This happened because a check in the renderer would stop the resource request from being made before the request ever reached the browser process where the webview accessible resources are checked in the manifest. This patch corrects this problem by propagating webview partition IDs to webview guest renderer processes, so that they can check the correct entry in the manifest for accessible resources and allow valid requests to go through to the browser process. BUG=460797 Review URL: https://codereview.chromium.org/1312653003 Cr-Commit-Position: refs/heads/master@{#347936}
Diffstat (limited to 'extensions/common/manifest_handlers')
-rw-r--r--extensions/common/manifest_handlers/webview_info.cc14
-rw-r--r--extensions/common/manifest_handlers/webview_info.h12
2 files changed, 14 insertions, 12 deletions
diff --git a/extensions/common/manifest_handlers/webview_info.cc b/extensions/common/manifest_handlers/webview_info.cc
index 5040002..3359c80 100644
--- a/extensions/common/manifest_handlers/webview_info.cc
+++ b/extensions/common/manifest_handlers/webview_info.cc
@@ -58,18 +58,20 @@ WebviewInfo::WebviewInfo(const std::string& extension_id)
WebviewInfo::~WebviewInfo() {
}
+// static
bool WebviewInfo::IsResourceWebviewAccessible(
const Extension* extension,
const std::string& partition_id,
- const std::string& relative_path) const {
- if (!extension || extension->id() != extension_id_)
+ const std::string& relative_path) {
+ if (!extension)
return false;
- DCHECK_EQ(this,
- extension->GetManifestData(keys::kWebviewAccessibleResources));
+ const WebviewInfo* webview_info = static_cast<const WebviewInfo*>(
+ extension->GetManifestData(keys::kWebviewAccessibleResources));
+ if (!webview_info)
+ return false;
- for (size_t i = 0; i < partition_items_.size(); ++i) {
- const PartitionItem* const item = partition_items_[i];
+ for (const PartitionItem* item : webview_info->partition_items_) {
if (item->Matches(partition_id) &&
extension->ResourceMatches(item->accessible_resources(),
relative_path)) {
diff --git a/extensions/common/manifest_handlers/webview_info.h b/extensions/common/manifest_handlers/webview_info.h
index 968e5fd..ca186a8 100644
--- a/extensions/common/manifest_handlers/webview_info.h
+++ b/extensions/common/manifest_handlers/webview_info.h
@@ -20,16 +20,16 @@ class PartitionItem;
// "webview" key.
class WebviewInfo : public Extension::ManifestData {
public:
+ // Returns true if |extension|'s resource at |relative_path| is accessible
+ // from the WebView partition with ID |partition_id|.
+ static bool IsResourceWebviewAccessible(const Extension* extension,
+ const std::string& partition_id,
+ const std::string& relative_path);
+
// Define out of line constructor/destructor to please Clang.
WebviewInfo(const std::string& extension_id);
~WebviewInfo() override;
- // Returns true if the specified resource is web accessible and the extension
- // matches the manifest's extension.
- bool IsResourceWebviewAccessible(const Extension* extension,
- const std::string& partition_id,
- const std::string& relative_path) const;
-
void AddPartitionItem(scoped_ptr<PartitionItem> item);
private: