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

Side by Side Diff: extensions/browser/url_request_util.cc

Issue 2831183003: Fix loading success.html at the end of chrome://chrome-signin flow (Closed)
Patch Set: Add browser test Created 3 years, 7 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
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/browser/url_request_util.h" 5 #include "extensions/browser/url_request_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/browser/resource_request_info.h" 9 #include "content/public/browser/resource_request_info.h"
10 #include "content/public/common/browser_side_navigation_policy.h" 10 #include "content/public/common/browser_side_navigation_policy.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 bool AllowCrossRendererResourceLoadHelper(bool is_guest, 148 bool AllowCrossRendererResourceLoadHelper(bool is_guest,
149 const Extension* extension, 149 const Extension* extension,
150 const Extension* owner_extension, 150 const Extension* owner_extension,
151 const std::string& partition_id, 151 const std::string& partition_id,
152 const std::string& resource_path, 152 const std::string& resource_path,
153 ui::PageTransition page_transition, 153 ui::PageTransition page_transition,
154 bool* allowed) { 154 bool* allowed) {
155 if (is_guest) { 155 if (is_guest) {
156 // Exceptionally, the resource at path "/success.html" that belongs to the
157 // sign-in extension (loaded by chrome://chrome-signin) is accessible to
158 // WebViews that are not owned by that extension.
159 // This exception is required as in order to mark the end of the the sign-in
160 // flow, Gaia redirects to the following continue URL:
161 // "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/success.html".
162 //
163 // TODO(http://crbug.com/688565) Remove this check once the sign-in
164 // extension is deprecated and removed.
165 bool is_signin_extension =
166 extension && extension->id() == "mfffpogegjflfpflabcdkioaeobkgjik";
167 if (is_signin_extension && resource_path == "/success.html") {
168 *allowed = true;
169 return true;
170 }
171
156 // An extension's resources should only be accessible to WebViews owned by 172 // An extension's resources should only be accessible to WebViews owned by
157 // that extension. 173 // that extension.
158 if (owner_extension != extension) { 174 if (owner_extension != extension) {
159 *allowed = false; 175 *allowed = false;
160 return true; 176 return true;
161 } 177 }
162 178
163 *allowed = WebviewInfo::IsResourceWebviewAccessible(extension, partition_id, 179 *allowed = WebviewInfo::IsResourceWebviewAccessible(extension, partition_id,
164 resource_path); 180 resource_path);
165 return true; 181 return true;
166 } 182 }
167 183
168 return false; 184 return false;
169 } 185 }
170 186
171 } // namespace url_request_util 187 } // namespace url_request_util
172 } // namespace extensions 188 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698