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

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

Issue 2695883003: Change uses of base::JoinString to pass StringPieces where possible. (Closed)
Patch Set: Remove dependency CL. Created 3 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
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_piece.h"
8 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
11 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/signin/chrome_signin_client_factory.h" 14 #include "chrome/browser/signin/chrome_signin_client_factory.h"
14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
15 #include "chrome/browser/signin/signin_manager_factory.h" 16 #include "chrome/browser/signin/signin_manager_factory.h"
16 #include "components/signin/core/browser/profile_oauth2_token_service.h" 17 #include "components/signin/core/browser/profile_oauth2_token_service.h"
17 #include "components/signin/core/browser/signin_manager.h" 18 #include "components/signin/core/browser/signin_manager.h"
(...skipping 30 matching lines...) Expand all
48 "client_id=%s&" 49 "client_id=%s&"
49 "scope=%s&" 50 "scope=%s&"
50 "origin=chrome-extension://%s/&" 51 "origin=chrome-extension://%s/&"
51 "redirect_uri=%s:/%s&" 52 "redirect_uri=%s:/%s&"
52 "hl=%s"; 53 "hl=%s";
53 // Additional parameters to pass if device_id is enabled. 54 // Additional parameters to pass if device_id is enabled.
54 const char kOAuth2AuthorizeFormatDeviceIdAddendum[] = 55 const char kOAuth2AuthorizeFormatDeviceIdAddendum[] =
55 "&device_id=%s&" 56 "&device_id=%s&"
56 "device_type=chrome"; 57 "device_type=chrome";
57 58
58 std::vector<std::string> scopes(token_key->scopes.begin(), 59 std::vector<base::StringPiece> scopes(token_key->scopes.begin(),
59 token_key->scopes.end()); 60 token_key->scopes.end());
60 std::vector<std::string> client_id_parts = base::SplitString( 61 std::vector<base::StringPiece> client_id_parts = base::SplitStringPiece(
61 oauth2_client_id, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 62 oauth2_client_id, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
62 std::reverse(client_id_parts.begin(), client_id_parts.end()); 63 std::reverse(client_id_parts.begin(), client_id_parts.end());
63 redirect_scheme_ = base::JoinString(client_id_parts, "."); 64 redirect_scheme_ = base::JoinString(client_id_parts, ".");
64 std::string signin_scoped_device_id; 65 std::string signin_scoped_device_id;
65 // profile_ can be nullptr in unittests. 66 // profile_ can be nullptr in unittests.
66 SigninClient* signin_client = 67 SigninClient* signin_client =
67 profile_ ? ChromeSigninClientFactory::GetForProfile(profile_) : nullptr; 68 profile_ ? ChromeSigninClientFactory::GetForProfile(profile_) : nullptr;
68 if (signin_client) 69 if (signin_client)
69 signin_scoped_device_id = signin_client->GetSigninScopedDeviceId(); 70 signin_scoped_device_id = signin_client->GetSigninScopedDeviceId();
70 71
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 FROM_HERE, 300 FROM_HERE,
300 base::Bind(&GaiaWebAuthFlow::StartUberTokenFetch, 301 base::Bind(&GaiaWebAuthFlow::StartUberTokenFetch,
301 gaia_web_auth_flow_)); 302 gaia_web_auth_flow_));
302 } 303 }
303 304
304 void GaiaWebAuthFlow::IOHelper::Cleanup() { 305 void GaiaWebAuthFlow::IOHelper::Cleanup() {
305 delete this; 306 delete this;
306 } 307 }
307 308
308 } // namespace extensions 309 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698