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

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

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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) 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/api/identity/identity_api.h" 5 #include "chrome/browser/extensions/api/identity/identity_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 IdentityAPI::GetFactoryInstance()->Get(GetProfile())->GetAccounts(); 293 IdentityAPI::GetFactoryInstance()->Get(GetProfile())->GetAccounts();
294 DCHECK(gaia_ids.size() < 2 || switches::IsExtensionsMultiAccount()); 294 DCHECK(gaia_ids.size() < 2 || switches::IsExtensionsMultiAccount());
295 295
296 std::unique_ptr<base::ListValue> infos(new base::ListValue()); 296 std::unique_ptr<base::ListValue> infos(new base::ListValue());
297 297
298 for (std::vector<std::string>::const_iterator it = gaia_ids.begin(); 298 for (std::vector<std::string>::const_iterator it = gaia_ids.begin();
299 it != gaia_ids.end(); 299 it != gaia_ids.end();
300 ++it) { 300 ++it) {
301 api::identity::AccountInfo account_info; 301 api::identity::AccountInfo account_info;
302 account_info.id = *it; 302 account_info.id = *it;
303 infos->Append(account_info.ToValue().release()); 303 infos->Append(account_info.ToValue());
304 } 304 }
305 305
306 return RespondNow(OneArgument(std::move(infos))); 306 return RespondNow(OneArgument(std::move(infos)));
307 } 307 }
308 308
309 IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction() 309 IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction()
310 : OAuth2TokenService::Consumer("extensions_identity_api"), 310 : OAuth2TokenService::Consumer("extensions_identity_api"),
311 interactive_(false), 311 interactive_(false),
312 should_prompt_for_scopes_(false), 312 should_prompt_for_scopes_(false),
313 should_prompt_for_signin_(false) { 313 should_prompt_for_signin_(false) {
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { 1016 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) {
1017 SetResult(base::MakeUnique<base::StringValue>(redirect_url.spec())); 1017 SetResult(base::MakeUnique<base::StringValue>(redirect_url.spec()));
1018 SendResponse(true); 1018 SendResponse(true);
1019 if (auth_flow_) 1019 if (auth_flow_)
1020 auth_flow_.release()->DetachDelegateAndDelete(); 1020 auth_flow_.release()->DetachDelegateAndDelete();
1021 Release(); // Balanced in RunAsync. 1021 Release(); // Balanced in RunAsync.
1022 } 1022 }
1023 } 1023 }
1024 1024
1025 } // namespace extensions 1025 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698