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

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

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 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 | Annotate | Revision Log
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/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 AbortInstall(); 140 AbortInstall();
141 } 141 }
142 142
143 // static 143 // static
144 bool WebstoreInlineInstaller::IsRequestorURLInVerifiedSite( 144 bool WebstoreInlineInstaller::IsRequestorURLInVerifiedSite(
145 const GURL& requestor_url, 145 const GURL& requestor_url,
146 const std::string& verified_site) { 146 const std::string& verified_site) {
147 // Turn the verified site (which may be a bare domain, or have a port and/or a 147 // Turn the verified site (which may be a bare domain, or have a port and/or a
148 // path) into a URL that can be parsed by URLPattern. 148 // path) into a URL that can be parsed by URLPattern.
149 std::string verified_site_url = 149 std::string verified_site_url =
150 StringPrintf("http://*.%s%s", 150 base::StringPrintf(
151 "http://*.%s%s",
151 verified_site.c_str(), 152 verified_site.c_str(),
152 verified_site.find('/') == std::string::npos ? "/*" : "*"); 153 verified_site.find('/') == std::string::npos ? "/*" : "*");
153 154
154 URLPattern verified_site_pattern( 155 URLPattern verified_site_pattern(
155 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS); 156 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS);
156 URLPattern::ParseResult parse_result = 157 URLPattern::ParseResult parse_result =
157 verified_site_pattern.Parse(verified_site_url); 158 verified_site_pattern.Parse(verified_site_url);
158 if (parse_result != URLPattern::PARSE_SUCCESS) { 159 if (parse_result != URLPattern::PARSE_SUCCESS) {
159 DLOG(WARNING) << "Could not parse " << verified_site_url << 160 DLOG(WARNING) << "Could not parse " << verified_site_url <<
160 " as URL pattern " << parse_result; 161 " as URL pattern " << parse_result;
161 return false; 162 return false;
162 } 163 }
163 verified_site_pattern.SetScheme("*"); 164 verified_site_pattern.SetScheme("*");
164 165
165 return verified_site_pattern.MatchesURL(requestor_url); 166 return verified_site_pattern.MatchesURL(requestor_url);
166 } 167 }
167 168
168 } // namespace extensions 169 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698