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

Side by Side Diff: chrome/browser/extensions/webstore_inline_installer.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/webstore_inline_installer.h" 5 #include "chrome/browser/extensions/webstore_inline_installer.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 verified_site_url = GURL("http://" + verified_site); 222 verified_site_url = GURL("http://" + verified_site);
223 else if (verified_site_url.SchemeIs("http")) 223 else if (verified_site_url.SchemeIs("http"))
224 valid_schemes = URLPattern::SCHEME_HTTP; 224 valid_schemes = URLPattern::SCHEME_HTTP;
225 else if (verified_site_url.SchemeIs("https")) 225 else if (verified_site_url.SchemeIs("https"))
226 valid_schemes = URLPattern::SCHEME_HTTPS; 226 valid_schemes = URLPattern::SCHEME_HTTPS;
227 else 227 else
228 return false; 228 return false;
229 229
230 std::string port_spec = 230 std::string port_spec =
231 verified_site_url.has_port() ? ":" + verified_site_url.port() : ""; 231 verified_site_url.has_port() ? ":" + verified_site_url.port() : "";
232 std::string path_spec = verified_site_url.path() + "*"; 232 std::string path_spec = verified_site_url.path().as_string() + "*";
233 std::string verified_site_pattern_spec = 233 std::string verified_site_pattern_spec =
234 base::StringPrintf( 234 base::StringPrintf(
235 "%s://*.%s%s%s", 235 "%s://*.%s%s%s",
236 verified_site_url.scheme().c_str(), 236 verified_site_url.scheme().c_str(),
237 verified_site_url.host().c_str(), 237 verified_site_url.host().c_str(),
238 port_spec.c_str(), 238 port_spec.c_str(),
239 path_spec.c_str()); 239 path_spec.c_str());
240 240
241 URLPattern verified_site_pattern(valid_schemes); 241 URLPattern verified_site_pattern(valid_schemes);
242 URLPattern::ParseResult parse_result = 242 URLPattern::ParseResult parse_result =
243 verified_site_pattern.Parse(verified_site_pattern_spec); 243 verified_site_pattern.Parse(verified_site_pattern_spec);
244 if (parse_result != URLPattern::PARSE_SUCCESS) { 244 if (parse_result != URLPattern::PARSE_SUCCESS) {
245 DLOG(WARNING) << "Could not parse " << verified_site_pattern_spec << 245 DLOG(WARNING) << "Could not parse " << verified_site_pattern_spec <<
246 " as URL pattern " << parse_result; 246 " as URL pattern " << parse_result;
247 return false; 247 return false;
248 } 248 }
249 verified_site_pattern.SetScheme("*"); 249 verified_site_pattern.SetScheme("*");
250 250
251 return verified_site_pattern.MatchesURL(requestor_url); 251 return verified_site_pattern.MatchesURL(requestor_url);
252 } 252 }
253 253
254 } // namespace extensions 254 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc ('k') | chrome/browser/importer/profile_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698