Commit 75be7e87 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Avoid explicit conversion for CoreAccountId on desktop platforms.

Bug: 959157
Change-Id: I8d6a6c80a4f2aea5a84264f26b4047ca46f6e687
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904173Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713817}
parent 532ba437
...@@ -65,7 +65,7 @@ std::string DecryptRefreshToken(const std::string& cipher_text) { ...@@ -65,7 +65,7 @@ std::string DecryptRefreshToken(const std::string& cipher_text) {
// Finish the process of import credentials. This is either called directly // Finish the process of import credentials. This is either called directly
// from ImportCredentialsFromProvider() if a browser window for the profile is // from ImportCredentialsFromProvider() if a browser window for the profile is
// already available or is delayed until a browser can first be opened. // already available or is delayed until a browser can first be opened.
void FinishImportCredentialsFromProvider(const std::string& account_id, void FinishImportCredentialsFromProvider(const CoreAccountId& account_id,
Browser* browser, Browser* browser,
Profile* profile, Profile* profile,
Profile::CreateStatus status) { Profile::CreateStatus status) {
...@@ -111,7 +111,7 @@ void ImportCredentialsFromProvider(Profile* profile, ...@@ -111,7 +111,7 @@ void ImportCredentialsFromProvider(Profile* profile,
AboutSigninInternalsFactory::GetInstance()->GetForProfile(profile); AboutSigninInternalsFactory::GetInstance()->GetForProfile(profile);
signin_internals->OnAuthenticationResultReceived("Credential Provider"); signin_internals->OnAuthenticationResultReceived("Credential Provider");
std::string account_id = CoreAccountId account_id =
IdentityManagerFactory::GetForProfile(profile) IdentityManagerFactory::GetForProfile(profile)
->GetAccountsMutator() ->GetAccountsMutator()
->AddOrUpdateAccount(base::UTF16ToUTF8(gaia_id), ->AddOrUpdateAccount(base::UTF16ToUTF8(gaia_id),
......
...@@ -22,9 +22,11 @@ CoreAccountId::CoreAccountId(std::string&& id) : id(std::move(id)) {} ...@@ -22,9 +22,11 @@ CoreAccountId::CoreAccountId(std::string&& id) : id(std::move(id)) {}
CoreAccountId::CoreAccountId(const std::string& id) : id(id) {} CoreAccountId::CoreAccountId(const std::string& id) : id(id) {}
#if defined(OS_CHROMEOS) || defined(OS_IOS) || defined(OS_ANDROID)
CoreAccountId::operator std::string() const { CoreAccountId::operator std::string() const {
return id; return id;
} }
#endif
bool CoreAccountId::empty() const { bool CoreAccountId::empty() const {
return id.empty(); return id.empty();
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "build/build_config.h"
// Represent the id of an account for interaction with GAIA. It is // Represent the id of an account for interaction with GAIA. It is
// currently implicitly convertible to and from std::string to allow // currently implicitly convertible to and from std::string to allow
// progressive migration of the code (see https://crbug.com/959157 // progressive migration of the code (see https://crbug.com/959157
...@@ -22,6 +24,7 @@ struct CoreAccountId { ...@@ -22,6 +24,7 @@ struct CoreAccountId {
CoreAccountId& operator=(const CoreAccountId&); CoreAccountId& operator=(const CoreAccountId&);
CoreAccountId& operator=(CoreAccountId&&) noexcept; CoreAccountId& operator=(CoreAccountId&&) noexcept;
#if defined(OS_CHROMEOS) || defined(OS_IOS) || defined(OS_ANDROID)
// Those implicit constructor and conversion operator allow to // Those implicit constructor and conversion operator allow to
// progressively migrate the code to use this struct. Removing // progressively migrate the code to use this struct. Removing
// them is tracked by https://crbug.com/959161 // them is tracked by https://crbug.com/959161
...@@ -29,6 +32,11 @@ struct CoreAccountId { ...@@ -29,6 +32,11 @@ struct CoreAccountId {
CoreAccountId(std::string&& id); CoreAccountId(std::string&& id);
CoreAccountId(const std::string& id); CoreAccountId(const std::string& id);
operator std::string() const; operator std::string() const;
#else
explicit CoreAccountId(const char* id);
explicit CoreAccountId(std::string&& id);
explicit CoreAccountId(const std::string& id);
#endif
// Checks if the account is valid or not. // Checks if the account is valid or not.
// TODO(triploblastic): Possibly rename of remove this after // TODO(triploblastic): Possibly rename of remove this after
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment