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

Side by Side Diff: chrome/browser/extensions/api/identity/gaia_web_auth_flow.cc

Issue 1223153003: Move JoinString to the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows Created 5 years, 5 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/api/identity/gaia_web_auth_flow.h" 5 #include "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Additional parameters to pass if device_id is enabled. 48 // Additional parameters to pass if device_id is enabled.
49 const char kOAuth2AuthorizeFormatDeviceIdAddendum[] = 49 const char kOAuth2AuthorizeFormatDeviceIdAddendum[] =
50 "&device_id=%s&" 50 "&device_id=%s&"
51 "device_type=chrome"; 51 "device_type=chrome";
52 52
53 std::vector<std::string> scopes(token_key->scopes.begin(), 53 std::vector<std::string> scopes(token_key->scopes.begin(),
54 token_key->scopes.end()); 54 token_key->scopes.end());
55 std::vector<std::string> client_id_parts; 55 std::vector<std::string> client_id_parts;
56 base::SplitString(oauth2_client_id, '.', &client_id_parts); 56 base::SplitString(oauth2_client_id, '.', &client_id_parts);
57 std::reverse(client_id_parts.begin(), client_id_parts.end()); 57 std::reverse(client_id_parts.begin(), client_id_parts.end());
58 redirect_scheme_ = JoinString(client_id_parts, '.'); 58 redirect_scheme_ = base::JoinString(client_id_parts, ".");
59 std::string signin_scoped_device_id; 59 std::string signin_scoped_device_id;
60 // profile_ can be nullptr in unittests. 60 // profile_ can be nullptr in unittests.
61 SigninClient* signin_client = 61 SigninClient* signin_client =
62 profile_ ? ChromeSigninClientFactory::GetForProfile(profile_) : nullptr; 62 profile_ ? ChromeSigninClientFactory::GetForProfile(profile_) : nullptr;
63 if (signin_client) 63 if (signin_client)
64 signin_scoped_device_id = signin_client->GetSigninScopedDeviceId(); 64 signin_scoped_device_id = signin_client->GetSigninScopedDeviceId();
65 65
66 redirect_path_prefix_ = base::StringPrintf(kOAuth2RedirectPathFormat, 66 redirect_path_prefix_ = base::StringPrintf(kOAuth2RedirectPathFormat,
67 token_key->extension_id.c_str()); 67 token_key->extension_id.c_str());
68 68
69 std::string oauth2_authorize_params = base::StringPrintf( 69 std::string oauth2_authorize_params = base::StringPrintf(
70 kOAuth2AuthorizeFormat, 70 kOAuth2AuthorizeFormat,
71 oauth2_client_id.c_str(), 71 oauth2_client_id.c_str(),
72 net::EscapeUrlEncodedData(JoinString(scopes, ' '), true).c_str(), 72 net::EscapeUrlEncodedData(base::JoinString(scopes, " "), true).c_str(),
73 token_key->extension_id.c_str(), 73 token_key->extension_id.c_str(),
74 redirect_scheme_.c_str(), 74 redirect_scheme_.c_str(),
75 token_key->extension_id.c_str(), 75 token_key->extension_id.c_str(),
76 locale.c_str()); 76 locale.c_str());
77 if (!signin_scoped_device_id.empty()) { 77 if (!signin_scoped_device_id.empty()) {
78 oauth2_authorize_params += base::StringPrintf( 78 oauth2_authorize_params += base::StringPrintf(
79 kOAuth2AuthorizeFormatDeviceIdAddendum, 79 kOAuth2AuthorizeFormatDeviceIdAddendum,
80 net::EscapeUrlEncodedData(signin_scoped_device_id, true).c_str()); 80 net::EscapeUrlEncodedData(signin_scoped_device_id, true).c_str());
81 } 81 }
82 auth_url_ = GaiaUrls::GetInstance()->oauth2_auth_url().Resolve( 82 auth_url_ = GaiaUrls::GetInstance()->oauth2_auth_url().Resolve(
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 233
234 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) { 234 scoped_ptr<WebAuthFlow> GaiaWebAuthFlow::CreateWebAuthFlow(GURL url) {
235 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this, 235 return scoped_ptr<WebAuthFlow>(new WebAuthFlow(this,
236 profile_, 236 profile_,
237 url, 237 url,
238 WebAuthFlow::INTERACTIVE)); 238 WebAuthFlow::INTERACTIVE));
239 } 239 }
240 240
241 } // namespace extensions 241 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698