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

Side by Side Diff: remoting/host/setup/oauth_helper.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/setup/daemon_controller_linux.cc ('k') | remoting/host/setup/start_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "remoting/host/setup/oauth_helper.h" 5 #include "remoting/host/setup/oauth_helper.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "google_apis/google_api_keys.h" 8 #include "google_apis/google_api_keys.h"
9 #include "googleurl/src/url_parse.h" 9 #include "googleurl/src/url_parse.h"
10 #include "net/base/escape.h" 10 #include "net/base/escape.h"
11 11
12 namespace { 12 namespace {
13 13
14 std::string GetComponent(const std::string& url, 14 std::string GetComponent(const std::string& url,
15 const url_parse::Component component) { 15 const url_parse::Component component) {
16 if (component.len < 0) { 16 if (component.len < 0) {
17 return ""; 17 return std::string();
18 } 18 }
19 return url.substr(component.begin, component.len); 19 return url.substr(component.begin, component.len);
20 } 20 }
21 21
22 } // namespace 22 } // namespace
23 23
24 namespace remoting { 24 namespace remoting {
25 25
26 std::string GetOauthScope() { 26 std::string GetOauthScope() {
27 return 27 return
(...skipping 25 matching lines...) Expand all
53 53
54 std::string GetOauthCodeInUrl(const std::string& url, 54 std::string GetOauthCodeInUrl(const std::string& url,
55 const std::string& redirect_url) { 55 const std::string& redirect_url) {
56 url_parse::Parsed url_parsed; 56 url_parse::Parsed url_parsed;
57 ParseStandardURL(url.c_str(), url.length(), &url_parsed); 57 ParseStandardURL(url.c_str(), url.length(), &url_parsed);
58 url_parse::Parsed redirect_url_parsed; 58 url_parse::Parsed redirect_url_parsed;
59 ParseStandardURL(redirect_url.c_str(), redirect_url.length(), 59 ParseStandardURL(redirect_url.c_str(), redirect_url.length(),
60 &redirect_url_parsed); 60 &redirect_url_parsed);
61 if (GetComponent(url, url_parsed.scheme) != 61 if (GetComponent(url, url_parsed.scheme) !=
62 GetComponent(redirect_url, redirect_url_parsed.scheme)) { 62 GetComponent(redirect_url, redirect_url_parsed.scheme)) {
63 return ""; 63 return std::string();
64 } 64 }
65 if (GetComponent(url, url_parsed.host) != 65 if (GetComponent(url, url_parsed.host) !=
66 GetComponent(redirect_url, redirect_url_parsed.host)) { 66 GetComponent(redirect_url, redirect_url_parsed.host)) {
67 return ""; 67 return std::string();
68 } 68 }
69 url_parse::Component query = url_parsed.query; 69 url_parse::Component query = url_parsed.query;
70 url_parse::Component key; 70 url_parse::Component key;
71 url_parse::Component value; 71 url_parse::Component value;
72 while (ExtractQueryKeyValue(url.c_str(), &query, &key, &value)) { 72 while (ExtractQueryKeyValue(url.c_str(), &query, &key, &value)) {
73 if (GetComponent(url, key) == "code") { 73 if (GetComponent(url, key) == "code") {
74 return GetComponent(url, value); 74 return GetComponent(url, value);
75 } 75 }
76 } 76 }
77 return ""; 77 return std::string();
78 } 78 }
79 79
80 } // namespace remoting 80 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/daemon_controller_linux.cc ('k') | remoting/host/setup/start_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698