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

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

Issue 2831183003: Fix loading success.html at the end of chrome://chrome-signin flow (Closed)
Patch Set: Created 3 years, 8 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_handler.cc ('k') | no next file » | 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // static 65 // static
66 bool WebviewInfo::IsResourceWebviewAccessible( 66 bool WebviewInfo::IsResourceWebviewAccessible(
67 const Extension* extension, 67 const Extension* extension,
68 const std::string& partition_id, 68 const std::string& partition_id,
69 const std::string& relative_path) { 69 const std::string& relative_path) {
70 if (!extension) 70 if (!extension)
71 return false; 71 return false;
72 72
73 const WebviewInfo* webview_info = static_cast<const WebviewInfo*>( 73 const WebviewInfo* webview_info = static_cast<const WebviewInfo*>(
74 extension->GetManifestData(keys::kWebviewAccessibleResources)); 74 extension->GetManifestData(keys::kWebviewAccessibleResources));
75 if (!webview_info) 75 if (!webview_info) {
76 LOG(ERROR) << "IsResourceWebviewAccessible " << extension->id()
77 << " to load " << relative_path << "? false 1 ";
76 return false; 78 return false;
79 }
77 80
78 for (const auto& item : webview_info->partition_items_) { 81 for (const auto& item : webview_info->partition_items_) {
79 if (item->Matches(partition_id) && 82 if (item->Matches(partition_id) &&
80 extension->ResourceMatches(item->accessible_resources(), 83 extension->ResourceMatches(item->accessible_resources(),
81 relative_path)) { 84 relative_path)) {
85 LOG(ERROR) << "IsResourceWebviewAccessible " << extension->id()
86 << " to load " << relative_path << "? true";
82 return true; 87 return true;
83 } 88 }
84 } 89 }
90 LOG(ERROR) << "IsResourceWebviewAccessible " << extension->id() << " to load "
91 << relative_path << "? false 2";
85 92
86 return false; 93 return false;
87 } 94 }
88 95
89 void WebviewInfo::AddPartitionItem(std::unique_ptr<PartitionItem> item) { 96 void WebviewInfo::AddPartitionItem(std::unique_ptr<PartitionItem> item) {
90 partition_items_.push_back(std::move(item)); 97 partition_items_.push_back(std::move(item));
91 } 98 }
92 99
93 WebviewHandler::WebviewHandler() { 100 WebviewHandler::WebviewHandler() {
101 LOG(ERROR) << "Create WebviewHandler";
94 } 102 }
95 103
96 WebviewHandler::~WebviewHandler() { 104 WebviewHandler::~WebviewHandler() {
97 } 105 }
98 106
99 bool WebviewHandler::Parse(Extension* extension, base::string16* error) { 107 bool WebviewHandler::Parse(Extension* extension, base::string16* error) {
108 LOG(ERROR) << "Parse WebviewInfo for extension " << extension->id();
100 std::unique_ptr<WebviewInfo> info(new WebviewInfo(extension->id())); 109 std::unique_ptr<WebviewInfo> info(new WebviewInfo(extension->id()));
101 110
102 const base::DictionaryValue* dict_value = NULL; 111 const base::DictionaryValue* dict_value = NULL;
103 if (!extension->manifest()->GetDictionary(keys::kWebview, 112 if (!extension->manifest()->GetDictionary(keys::kWebview,
104 &dict_value)) { 113 &dict_value)) {
105 *error = base::ASCIIToUTF16(errors::kInvalidWebview); 114 *error = base::ASCIIToUTF16(errors::kInvalidWebview);
106 return false; 115 return false;
107 } 116 }
108 117
109 const base::ListValue* partition_list = NULL; 118 const base::ListValue* partition_list = NULL;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return false; 168 return false;
160 } 169 }
161 URLPattern pattern(URLPattern::SCHEME_EXTENSION, 170 URLPattern pattern(URLPattern::SCHEME_EXTENSION,
162 Extension::GetResourceURL(extension->url(), 171 Extension::GetResourceURL(extension->url(),
163 relative_path).spec()); 172 relative_path).spec());
164 partition_item->AddPattern(pattern); 173 partition_item->AddPattern(pattern);
165 } 174 }
166 info->AddPartitionItem(std::move(partition_item)); 175 info->AddPartitionItem(std::move(partition_item));
167 } 176 }
168 177
178 LOG(ERROR) << "SetManifestData (kWebviewAccessibleResources)"
179 << extension->id() << " Done";
169 extension->SetManifestData(keys::kWebviewAccessibleResources, 180 extension->SetManifestData(keys::kWebviewAccessibleResources,
170 std::move(info)); 181 std::move(info));
171 return true; 182 return true;
172 } 183 }
173 184
174 const std::vector<std::string> WebviewHandler::Keys() const { 185 const std::vector<std::string> WebviewHandler::Keys() const {
175 return SingleKey(keys::kWebview); 186 return SingleKey(keys::kWebview);
176 } 187 }
177 188
178 } // namespace extensions 189 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/manifest_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698