diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-07-14 17:41:05 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-08-04 12:37:36 +0000 |
commit | 399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch) | |
tree | 6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/components/signin | |
parent | 7366110654eec46f21b6824f302356426f48cd74 (diff) | |
download | qtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz |
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/components/signin')
44 files changed, 189 insertions, 129 deletions
diff --git a/chromium/components/signin/core/account_id/account_id.cc b/chromium/components/signin/core/account_id/account_id.cc index 7bd86ef0597..17d0ffd70ec 100644 --- a/chromium/components/signin/core/account_id/account_id.cc +++ b/chromium/components/signin/core/account_id/account_id.cc @@ -5,10 +5,10 @@ #include "components/signin/core/account_id/account_id.h" #include <functional> +#include <memory> #include "base/json/json_reader.h" #include "base/json/json_writer.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/strings/string_util.h" #include "base/values.h" @@ -159,7 +159,7 @@ std::string AccountId::Serialize() const { bool AccountId::Deserialize(const std::string& serialized, AccountId* account_id) { base::JSONReader reader; - scoped_ptr<const base::Value> value(reader.Read(serialized)); + std::unique_ptr<const base::Value> value(reader.Read(serialized)); const base::DictionaryValue* dictionary_value = NULL; if (!value || !value->GetAsDictionary(&dictionary_value)) diff --git a/chromium/components/signin/core/browser/about_signin_internals.cc b/chromium/components/signin/core/browser/about_signin_internals.cc index 349d7a2ff8a..9ec0228cc17 100644 --- a/chromium/components/signin/core/browser/about_signin_internals.cc +++ b/chromium/components/signin/core/browser/about_signin_internals.cc @@ -37,7 +37,7 @@ std::string GetTimeStr(base::Time time) { base::ListValue* AddSection(base::ListValue* parent_list, const std::string& title) { - scoped_ptr<base::DictionaryValue> section(new base::DictionaryValue()); + std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue()); base::ListValue* section_contents = new base::ListValue(); section->SetString("title", title); @@ -50,7 +50,7 @@ void AddSectionEntry(base::ListValue* section_list, const std::string& field_name, const std::string& field_status, const std::string& field_time = "") { - scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); + std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); entry->SetString("label", field_name); entry->SetString("status", field_status); entry->SetString("time", field_time); @@ -61,7 +61,7 @@ void AddCookieEntry(base::ListValue* accounts_list, const std::string& field_email, const std::string& field_gaia_id, const std::string& field_valid) { - scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); + std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); entry->SetString("email", field_email); entry->SetString("gaia_id", field_gaia_id); entry->SetString("valid", field_valid); @@ -269,13 +269,10 @@ void AboutSigninInternals::NotifyObservers() { FROM_HERE_WITH_EXPLICIT_FUNCTION( "422460 AboutSigninInternals::NotifyObservers 0.5")); - scoped_ptr<base::DictionaryValue> signin_status_value = - signin_status_.ToValue(account_tracker_, - signin_manager_, - signin_error_controller_, - token_service_, - cookie_manager_service_, - product_version); + std::unique_ptr<base::DictionaryValue> signin_status_value = + signin_status_.ToValue(account_tracker_, signin_manager_, + signin_error_controller_, token_service_, + cookie_manager_service_, product_version); // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is // fixed. @@ -288,7 +285,7 @@ void AboutSigninInternals::NotifyObservers() { OnSigninStateChanged(signin_status_value.get())); } -scoped_ptr<base::DictionaryValue> AboutSigninInternals::GetSigninStatus() { +std::unique_ptr<base::DictionaryValue> AboutSigninInternals::GetSigninStatus() { return signin_status_.ToValue( account_tracker_, signin_manager_, signin_error_controller_, token_service_, cookie_manager_service_, client_->GetProductVersion()); @@ -430,7 +427,8 @@ bool AboutSigninInternals::TokenInfo::LessThan(const TokenInfo* a, void AboutSigninInternals::TokenInfo::Invalidate() { removed_ = true; } base::DictionaryValue* AboutSigninInternals::TokenInfo::ToValue() const { - scoped_ptr<base::DictionaryValue> token_info(new base::DictionaryValue()); + std::unique_ptr<base::DictionaryValue> token_info( + new base::DictionaryValue()); token_info->SetString("service", consumer_id); std::string scopes_str; @@ -496,7 +494,8 @@ AboutSigninInternals::TokenInfo* AboutSigninInternals::SigninStatus::FindToken( return NULL; } -scoped_ptr<base::DictionaryValue> AboutSigninInternals::SigninStatus::ToValue( +std::unique_ptr<base::DictionaryValue> +AboutSigninInternals::SigninStatus::ToValue( AccountTrackerService* account_tracker, SigninManagerBase* signin_manager, SigninErrorController* signin_error_controller, @@ -509,7 +508,8 @@ scoped_ptr<base::DictionaryValue> AboutSigninInternals::SigninStatus::ToValue( FROM_HERE_WITH_EXPLICIT_FUNCTION( "422460 AboutSigninInternals::SigninStatus::ToValue1")); - scoped_ptr<base::DictionaryValue> signin_status(new base::DictionaryValue()); + std::unique_ptr<base::DictionaryValue> signin_status( + new base::DictionaryValue()); base::ListValue* signin_info = new base::ListValue(); signin_status->Set("signin_info", signin_info); diff --git a/chromium/components/signin/core/browser/about_signin_internals.h b/chromium/components/signin/core/browser/about_signin_internals.h index a7c3ff86c63..43cd96079cd 100644 --- a/chromium/components/signin/core/browser/about_signin_internals.h +++ b/chromium/components/signin/core/browser/about_signin_internals.h @@ -6,11 +6,11 @@ #define COMPONENTS_SIGNIN_CORE_BROWSER_ABOUT_SIGNIN_INTERNALS_H_ #include <map> +#include <memory> #include <string> #include "base/macros.h" #include "base/memory/linked_ptr.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/values.h" #include "components/keyed_service/core/keyed_service.h" @@ -94,7 +94,7 @@ class AboutSigninInternals // [ List of {"name": "foo-name", "token" : "foo-token", // "status": "foo_stat", "time" : "foo_time"} elems] // } - scoped_ptr<base::DictionaryValue> GetSigninStatus(); + std::unique_ptr<base::DictionaryValue> GetSigninStatus(); // GaiaCookieManagerService::Observer implementations. void OnGaiaAccountsInCookieUpdated( @@ -157,7 +157,7 @@ class AboutSigninInternals // "status" : request status} elems] // }], // } - scoped_ptr<base::DictionaryValue> ToValue( + std::unique_ptr<base::DictionaryValue> ToValue( AccountTrackerService* account_tracker, SigninManagerBase* signin_manager, SigninErrorController* signin_error_controller, diff --git a/chromium/components/signin/core/browser/account_fetcher_service.cc b/chromium/components/signin/core/browser/account_fetcher_service.cc index 0c8fe58a654..caade390d7d 100644 --- a/chromium/components/signin/core/browser/account_fetcher_service.cc +++ b/chromium/components/signin/core/browser/account_fetcher_service.cc @@ -203,7 +203,7 @@ void AccountFetcherService::StartFetchingUserInfo( if (!ContainsKey(user_info_requests_, account_id)) { DVLOG(1) << "StartFetching " << account_id; - scoped_ptr<AccountInfoFetcher> fetcher(new AccountInfoFetcher( + std::unique_ptr<AccountInfoFetcher> fetcher(new AccountInfoFetcher( token_service_, signin_client_->GetURLRequestContext(), this, account_id)); user_info_requests_.set(account_id, std::move(fetcher)); @@ -261,7 +261,7 @@ void AccountFetcherService::SendRefreshTokenAnnotationRequest( if (IsRefreshTokenDeviceIdExperimentEnabled() || base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableRefreshTokenAnnotationRequest)) { - scoped_ptr<RefreshTokenAnnotationRequest> request = + std::unique_ptr<RefreshTokenAnnotationRequest> request = RefreshTokenAnnotationRequest::SendIfNeeded( signin_client_->GetPrefs(), token_service_, signin_client_, signin_client_->GetURLRequestContext(), account_id, @@ -283,7 +283,7 @@ void AccountFetcherService::RefreshTokenAnnotationRequestDone( void AccountFetcherService::OnUserInfoFetchSuccess( const std::string& account_id, - scoped_ptr<base::DictionaryValue> user_info) { + std::unique_ptr<base::DictionaryValue> user_info) { account_tracker_service_->SetAccountStateFromUserInfo(account_id, user_info.get()); user_info_requests_.erase(account_id); diff --git a/chromium/components/signin/core/browser/account_fetcher_service.h b/chromium/components/signin/core/browser/account_fetcher_service.h index 6cbb0808f38..0f3e57515e8 100644 --- a/chromium/components/signin/core/browser/account_fetcher_service.h +++ b/chromium/components/signin/core/browser/account_fetcher_service.h @@ -7,6 +7,8 @@ #include <stdint.h> +#include <memory> + #include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" #include "base/threading/non_thread_safe.h" @@ -110,7 +112,7 @@ class AccountFetcherService : public KeyedService, // Called by AccountInfoFetcher. void OnUserInfoFetchSuccess(const std::string& account_id, - scoped_ptr<base::DictionaryValue> user_info); + std::unique_ptr<base::DictionaryValue> user_info); void OnUserInfoFetchFailure(const std::string& account_id); AccountTrackerService* account_tracker_service_; // Not owned. @@ -127,13 +129,14 @@ class AccountFetcherService : public KeyedService, bool scheduled_refresh_enabled_; std::string child_request_account_id_; - scoped_ptr<ChildAccountInfoFetcher> child_info_request_; + std::unique_ptr<ChildAccountInfoFetcher> child_info_request_; // Holds references to account info fetchers keyed by account_id. - base::ScopedPtrHashMap<std::string, scoped_ptr<AccountInfoFetcher>> + base::ScopedPtrHashMap<std::string, std::unique_ptr<AccountInfoFetcher>> user_info_requests_; // Holds references to refresh token annotation requests keyed by account_id. - base::ScopedPtrHashMap<std::string, scoped_ptr<RefreshTokenAnnotationRequest>> + base::ScopedPtrHashMap<std::string, + std::unique_ptr<RefreshTokenAnnotationRequest>> refresh_token_annotation_requests_; DISALLOW_COPY_AND_ASSIGN(AccountFetcherService); diff --git a/chromium/components/signin/core/browser/account_info_fetcher.cc b/chromium/components/signin/core/browser/account_info_fetcher.cc index ea680099a58..75575bd5a5b 100644 --- a/chromium/components/signin/core/browser/account_info_fetcher.cc +++ b/chromium/components/signin/core/browser/account_info_fetcher.cc @@ -61,7 +61,7 @@ void AccountInfoFetcher::OnGetTokenFailure( } void AccountInfoFetcher::OnGetUserInfoResponse( - scoped_ptr<base::DictionaryValue> user_info) { + std::unique_ptr<base::DictionaryValue> user_info) { TRACE_EVENT_ASYNC_STEP_PAST1("AccountFetcherService", "AccountIdFetcher", this, "OnGetUserInfoResponse", "account_id", account_id_); diff --git a/chromium/components/signin/core/browser/account_info_fetcher.h b/chromium/components/signin/core/browser/account_info_fetcher.h index b47a9760511..071b790f944 100644 --- a/chromium/components/signin/core/browser/account_info_fetcher.h +++ b/chromium/components/signin/core/browser/account_info_fetcher.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_INFO_FETCHER_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_ACCOUNT_INFO_FETCHER_H_ +#include <memory> + #include "base/macros.h" #include "google_apis/gaia/gaia_auth_consumer.h" #include "google_apis/gaia/gaia_oauth_client.h" @@ -42,7 +44,7 @@ class AccountInfoFetcher : public OAuth2TokenService::Consumer, // gaia::GaiaOAuthClient::Delegate implementation. void OnGetUserInfoResponse( - scoped_ptr<base::DictionaryValue> user_info) override; + std::unique_ptr<base::DictionaryValue> user_info) override; void OnOAuthError() override; void OnNetworkError(int response_code) override; @@ -52,8 +54,8 @@ class AccountInfoFetcher : public OAuth2TokenService::Consumer, AccountFetcherService* service_; const std::string account_id_; - scoped_ptr<OAuth2TokenService::Request> login_token_request_; - scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; + std::unique_ptr<OAuth2TokenService::Request> login_token_request_; + std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; DISALLOW_COPY_AND_ASSIGN(AccountInfoFetcher); }; diff --git a/chromium/components/signin/core/browser/account_reconcilor.cc b/chromium/components/signin/core/browser/account_reconcilor.cc index 89f073fdbe6..7c9c7f2333e 100644 --- a/chromium/components/signin/core/browser/account_reconcilor.cc +++ b/chromium/components/signin/core/browser/account_reconcilor.cc @@ -14,7 +14,7 @@ #include "base/logging.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_client.h" diff --git a/chromium/components/signin/core/browser/account_reconcilor.h b/chromium/components/signin/core/browser/account_reconcilor.h index 2c9660c575a..7a9fc392fb3 100644 --- a/chromium/components/signin/core/browser/account_reconcilor.h +++ b/chromium/components/signin/core/browser/account_reconcilor.h @@ -6,6 +6,7 @@ #include <deque> #include <functional> +#include <memory> #include <set> #include <string> #include <utility> @@ -15,7 +16,6 @@ #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "components/content_settings/core/browser/content_settings_observer.h" #include "components/content_settings/core/common/content_settings_pattern.h" diff --git a/chromium/components/signin/core/browser/account_tracker_service_unittest.cc b/chromium/components/signin/core/browser/account_tracker_service_unittest.cc index 1a60908744a..27ac5bcc5e6 100644 --- a/chromium/components/signin/core/browser/account_tracker_service_unittest.cc +++ b/chromium/components/signin/core/browser/account_tracker_service_unittest.cc @@ -334,11 +334,11 @@ class AccountTrackerServiceTest : public testing::Test { base::MessageLoopForIO message_loop_; net::TestURLFetcherFactory test_fetcher_factory_; - scoped_ptr<FakeOAuth2TokenService> fake_oauth2_token_service_; + std::unique_ptr<FakeOAuth2TokenService> fake_oauth2_token_service_; TestingPrefServiceSimple pref_service_; - scoped_ptr<AccountFetcherService> account_fetcher_; - scoped_ptr<AccountTrackerService> account_tracker_; - scoped_ptr<TestSigninClient> signin_client_; + std::unique_ptr<AccountFetcherService> account_fetcher_; + std::unique_ptr<AccountTrackerService> account_tracker_; + std::unique_ptr<TestSigninClient> signin_client_; }; void AccountTrackerServiceTest::ReturnOAuthUrlFetchResults( @@ -916,7 +916,7 @@ TEST_F(AccountTrackerServiceTest, MigrateAccountIdToGaiaId) { dict->SetString("email", base::UTF8ToUTF16(email_beta)); dict->SetString("gaia", base::UTF8ToUTF16(gaia_beta)); - scoped_ptr<TestSigninClient> client; + std::unique_ptr<TestSigninClient> client; client.reset(new TestSigninClient(&pref)); tracker.Initialize(client.get()); @@ -968,7 +968,7 @@ TEST_F(AccountTrackerServiceTest, CanNotMigrateAccountIdToGaiaId) { dict->SetString("email", base::UTF8ToUTF16(email_beta)); dict->SetString("gaia", base::UTF8ToUTF16(std::string())); - scoped_ptr<TestSigninClient> client; + std::unique_ptr<TestSigninClient> client; client.reset(new TestSigninClient(&pref)); tracker.Initialize(client.get()); @@ -1027,7 +1027,7 @@ TEST_F(AccountTrackerServiceTest, GaiaIdMigrationCrashInTheMiddle) { dict->SetString("email", base::UTF8ToUTF16(email_alpha)); dict->SetString("gaia", base::UTF8ToUTF16(gaia_alpha)); - scoped_ptr<TestSigninClient> client; + std::unique_ptr<TestSigninClient> client; client.reset(new TestSigninClient(&pref)); tracker.Initialize(client.get()); diff --git a/chromium/components/signin/core/browser/child_account_info_fetcher_impl.h b/chromium/components/signin/core/browser/child_account_info_fetcher_impl.h index 33ceae47637..b6c9c91cacc 100644 --- a/chromium/components/signin/core/browser/child_account_info_fetcher_impl.h +++ b/chromium/components/signin/core/browser/child_account_info_fetcher_impl.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_CHILD_ACCOUNT_INFO_FETCHER_IMPL_H_ +#include <memory> + #include "base/macros.h" #include "base/threading/thread_checker.h" #include "base/timer/timer.h" @@ -63,8 +65,8 @@ class ChildAccountInfoFetcherImpl : public ChildAccountInfoFetcher, base::OneShotTimer timer_; net::BackoffEntry backoff_; - scoped_ptr<OAuth2TokenService::Request> login_token_request_; - scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; + std::unique_ptr<OAuth2TokenService::Request> login_token_request_; + std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; bool fetch_in_progress_; base::ThreadChecker thread_checker_; diff --git a/chromium/components/signin/core/browser/device_activity_fetcher.h b/chromium/components/signin/core/browser/device_activity_fetcher.h index a9ff2f5a400..f91e7dfc672 100644 --- a/chromium/components/signin/core/browser/device_activity_fetcher.h +++ b/chromium/components/signin/core/browser/device_activity_fetcher.h @@ -5,11 +5,11 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_DEVICE_ACTVITIY_FETCHER_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_DEVICE_ACTVITIY_FETCHER_H_ +#include <memory> #include <string> #include <vector> #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "google_apis/gaia/gaia_auth_consumer.h" @@ -60,9 +60,9 @@ class DeviceActivityFetcher : public GaiaAuthConsumer, void StartFetchingListDevices(); // Gaia fetcher used for acquiring an access token. - scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; + std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; // URL Fetcher used for calling List Devices. - scoped_ptr<net::URLFetcher> url_fetcher_; + std::unique_ptr<net::URLFetcher> url_fetcher_; // If either fetcher fails, retry with exponential backoff. net::BackoffEntry fetcher_backoff_; diff --git a/chromium/components/signin/core/browser/fake_account_fetcher_service.h b/chromium/components/signin/core/browser/fake_account_fetcher_service.h index 73d68f21c4d..3e1d6de5cb5 100644 --- a/chromium/components/signin/core/browser/fake_account_fetcher_service.h +++ b/chromium/components/signin/core/browser/fake_account_fetcher_service.h @@ -5,8 +5,9 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_FAKE_ACCOUNT_FETCHER_SERVICE_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_FAKE_ACCOUNT_FETCHER_SERVICE_H_ +#include <memory> + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/signin/core/browser/account_fetcher_service.h" class KeyedService; diff --git a/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc b/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc index 6ad2458dd04..876e8063f5c 100644 --- a/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc +++ b/chromium/components/signin/core/browser/fake_profile_oauth2_token_service.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/single_thread_task_runner.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "google_apis/gaia/fake_oauth2_token_service_delegate.h" FakeProfileOAuth2TokenService::PendingRequest::PendingRequest() {} diff --git a/chromium/components/signin/core/browser/fake_signin_manager.cc b/chromium/components/signin/core/browser/fake_signin_manager.cc index 2071eea078b..a4912d5fd22 100644 --- a/chromium/components/signin/core/browser/fake_signin_manager.cc +++ b/chromium/components/signin/core/browser/fake_signin_manager.cc @@ -17,6 +17,10 @@ FakeSigninManagerBase::FakeSigninManagerBase( FakeSigninManagerBase::~FakeSigninManagerBase() {} +void FakeSigninManagerBase::SignIn(const std::string& account_id) { + SetAuthenticatedAccountId(account_id); +} + #if !defined(OS_CHROMEOS) FakeSigninManager::FakeSigninManager( diff --git a/chromium/components/signin/core/browser/fake_signin_manager.h b/chromium/components/signin/core/browser/fake_signin_manager.h index 1b957c5f32e..83b2728e189 100644 --- a/chromium/components/signin/core/browser/fake_signin_manager.h +++ b/chromium/components/signin/core/browser/fake_signin_manager.h @@ -5,10 +5,10 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_FAKE_SIGNIN_MANAGER_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_FAKE_SIGNIN_MANAGER_H_ +#include <memory> #include <string> #include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/browser/signin_metrics.h" @@ -23,6 +23,8 @@ class FakeSigninManagerBase : public SigninManagerBase { FakeSigninManagerBase(SigninClient* client, AccountTrackerService* account_tracker_service); ~FakeSigninManagerBase() override; + + void SignIn(const std::string& account_id); }; #if !defined(OS_CHROMEOS) diff --git a/chromium/components/signin/core/browser/gaia_cookie_manager_service.cc b/chromium/components/signin/core/browser/gaia_cookie_manager_service.cc index 9ed37994b0b..19f3f6d42d2 100644 --- a/chromium/components/signin/core/browser/gaia_cookie_manager_service.cc +++ b/chromium/components/signin/core/browser/gaia_cookie_manager_service.cc @@ -154,7 +154,7 @@ void GaiaCookieManagerService::ExternalCcResultFetcher:: OnGetCheckConnectionInfoSuccess(const std::string& data) { helper_->fetcher_backoff_.InformOfRequest(true); gaia_auth_fetcher_timer_.Stop(); - scoped_ptr<base::Value> value = base::JSONReader::Read(data); + std::unique_ptr<base::Value> value = base::JSONReader::Read(data); const base::ListValue* list; if (!value || !value->GetAsList(&list)) { CleanupTransientState(); @@ -201,10 +201,10 @@ void GaiaCookieManagerService::ExternalCcResultFetcher:: GetCheckConnectionInfoCompleted(false); } -scoped_ptr<net::URLFetcher> +std::unique_ptr<net::URLFetcher> GaiaCookieManagerService::ExternalCcResultFetcher::CreateFetcher( const GURL& url) { - scoped_ptr<net::URLFetcher> fetcher = + std::unique_ptr<net::URLFetcher> fetcher = net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); fetcher->SetRequestContext(helper_->request_context()); fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | diff --git a/chromium/components/signin/core/browser/gaia_cookie_manager_service.h b/chromium/components/signin/core/browser/gaia_cookie_manager_service.h index 17506a9f77d..60ba2e0f018 100644 --- a/chromium/components/signin/core/browser/gaia_cookie_manager_service.h +++ b/chromium/components/signin/core/browser/gaia_cookie_manager_service.h @@ -129,7 +129,7 @@ class GaiaCookieManagerService : public KeyedService, const GoogleServiceAuthError& error) override; // Creates and initializes a URL fetcher for doing a connection check. - scoped_ptr<net::URLFetcher> CreateFetcher(const GURL& url); + std::unique_ptr<net::URLFetcher> CreateFetcher(const GURL& url); // Overridden from URLFetcherDelgate. void OnURLFetchComplete(const net::URLFetcher* source) override; @@ -254,8 +254,8 @@ class GaiaCookieManagerService : public KeyedService, OAuth2TokenService* token_service_; SigninClient* signin_client_; - scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; - scoped_ptr<UbertokenFetcher> uber_token_fetcher_; + std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; + std::unique_ptr<UbertokenFetcher> uber_token_fetcher_; ExternalCcResultFetcher external_cc_result_fetcher_; // If the GaiaAuthFetcher or URLFetcher fails, retry with exponential backoff @@ -271,7 +271,7 @@ class GaiaCookieManagerService : public KeyedService, std::string access_token_; // Subscription to be called whenever the GAIA cookies change. - scoped_ptr<SigninClient::CookieChangedSubscription> + std::unique_ptr<SigninClient::CookieChangedSubscription> cookie_changed_subscription_; // A worklist for this class. Stores any pending requests that couldn't be diff --git a/chromium/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc b/chromium/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc index bd0bff9af12..9787144b1ca 100644 --- a/chromium/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc +++ b/chromium/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc @@ -2,23 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/signin/core/browser/gaia_cookie_manager_service.h" + #include <algorithm> +#include <memory> #include <string> #include <vector> #include "base/location.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/test/histogram_tester.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" #include "components/signin/core/browser/account_tracker_service.h" -#include "components/signin/core/browser/gaia_cookie_manager_service.h" #include "components/signin/core/browser/test_signin_client.h" #include "components/signin/core/common/signin_pref_names.h" #include "google_apis/gaia/fake_oauth2_token_service.h" @@ -161,7 +162,7 @@ class GaiaCookieManagerServiceTest : public testing::Test { GoogleServiceAuthError error_; GoogleServiceAuthError canceled_; TestingPrefServiceSimple pref_service_; - scoped_ptr<TestSigninClient> signin_client_; + std::unique_ptr<TestSigninClient> signin_client_; }; } // namespace diff --git a/chromium/components/signin/core/browser/refresh_token_annotation_request.cc b/chromium/components/signin/core/browser/refresh_token_annotation_request.cc index edcb3a651a3..191dab8ebf4 100644 --- a/chromium/components/signin/core/browser/refresh_token_annotation_request.cc +++ b/chromium/components/signin/core/browser/refresh_token_annotation_request.cc @@ -9,7 +9,7 @@ #include "base/rand_util.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/prefs/pref_service.h" #include "components/signin/core/browser/signin_client.h" @@ -45,7 +45,7 @@ RefreshTokenAnnotationRequest::~RefreshTokenAnnotationRequest() { } // static -scoped_ptr<RefreshTokenAnnotationRequest> +std::unique_ptr<RefreshTokenAnnotationRequest> RefreshTokenAnnotationRequest::SendIfNeeded( PrefService* pref_service, OAuth2TokenService* token_service, @@ -53,7 +53,7 @@ RefreshTokenAnnotationRequest::SendIfNeeded( const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, const std::string& account_id, const base::Closure& request_callback) { - scoped_ptr<RefreshTokenAnnotationRequest> request; + std::unique_ptr<RefreshTokenAnnotationRequest> request; if (!ShouldSendNow(pref_service)) return request; diff --git a/chromium/components/signin/core/browser/refresh_token_annotation_request.h b/chromium/components/signin/core/browser/refresh_token_annotation_request.h index a2766974b79..483830bfea4 100644 --- a/chromium/components/signin/core/browser/refresh_token_annotation_request.h +++ b/chromium/components/signin/core/browser/refresh_token_annotation_request.h @@ -5,6 +5,8 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ +#include <memory> + #include "base/callback.h" #include "base/gtest_prod_util.h" #include "base/macros.h" @@ -37,7 +39,7 @@ class RefreshTokenAnnotationRequest : public base::NonThreadSafe, // cancelled and callback will not be posted. // // If SendIfNeeded returns nullptr then callback will not be posted. - static scoped_ptr<RefreshTokenAnnotationRequest> SendIfNeeded( + static std::unique_ptr<RefreshTokenAnnotationRequest> SendIfNeeded( PrefService* pref_service, OAuth2TokenService* token_service, SigninClient* signin_client, @@ -80,7 +82,7 @@ class RefreshTokenAnnotationRequest : public base::NonThreadSafe, std::string client_id_; base::Closure request_callback_; - scoped_ptr<OAuth2TokenService::Request> access_token_request_; + std::unique_ptr<OAuth2TokenService::Request> access_token_request_; DISALLOW_COPY_AND_ASSIGN(RefreshTokenAnnotationRequest); }; diff --git a/chromium/components/signin/core/browser/signin_client.h b/chromium/components/signin/core/browser/signin_client.h index e239bb168a8..99b37c49fbb 100644 --- a/chromium/components/signin/core/browser/signin_client.h +++ b/chromium/components/signin/core/browser/signin_client.h @@ -81,7 +81,7 @@ class SigninClient : public KeyedService { // changes. // Note that |callback| will always be called on the thread that // |AddCookieChangedCallback| was called on. - virtual scoped_ptr<CookieChangedSubscription> AddCookieChangedCallback( + virtual std::unique_ptr<CookieChangedSubscription> AddCookieChangedCallback( const GURL& url, const std::string& name, const net::CookieStore::CookieChangedCallback& callback) = 0; diff --git a/chromium/components/signin/core/browser/signin_cookie_changed_subscription.cc b/chromium/components/signin/core/browser/signin_cookie_changed_subscription.cc index 212e3ea1885..bfcfde49dcf 100644 --- a/chromium/components/signin/core/browser/signin_cookie_changed_subscription.cc +++ b/chromium/components/signin/core/browser/signin_cookie_changed_subscription.cc @@ -4,7 +4,7 @@ #include "components/signin/core/browser/signin_cookie_changed_subscription.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "net/cookies/cookie_store.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" diff --git a/chromium/components/signin/core/browser/signin_cookie_changed_subscription.h b/chromium/components/signin/core/browser/signin_cookie_changed_subscription.h index 5120ab9c3cd..e0ad83c5fce 100644 --- a/chromium/components/signin/core/browser/signin_cookie_changed_subscription.h +++ b/chromium/components/signin/core/browser/signin_cookie_changed_subscription.h @@ -29,7 +29,7 @@ class SigninCookieChangedSubscription private: // Holder of a cookie store cookie changed subscription. struct SubscriptionHolder { - scoped_ptr<net::CookieStore::CookieChangedSubscription> subscription; + std::unique_ptr<net::CookieStore::CookieChangedSubscription> subscription; SubscriptionHolder(); ~SubscriptionHolder(); }; @@ -65,7 +65,7 @@ class SigninCookieChangedSubscription // The holder of a cookie changed subscription. Must be destroyed on the // network thread. - scoped_ptr<SubscriptionHolder> subscription_holder_io_; + std::unique_ptr<SubscriptionHolder> subscription_holder_io_; // Callback to be run on cookie changed events. net::CookieStore::CookieChangedCallback callback_; diff --git a/chromium/components/signin/core/browser/signin_error_controller_unittest.cc b/chromium/components/signin/core/browser/signin_error_controller_unittest.cc index e73167301ba..d0cffdd0912 100644 --- a/chromium/components/signin/core/browser/signin_error_controller_unittest.cc +++ b/chromium/components/signin/core/browser/signin_error_controller_unittest.cc @@ -7,9 +7,9 @@ #include <stddef.h> #include <functional> +#include <memory> #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/signin/core/browser/fake_auth_status_provider.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,11 +22,11 @@ class SigninErrorControllerTest : public testing::Test { error_controller_.reset(new SigninErrorController()); } - scoped_ptr<SigninErrorController> error_controller_; + std::unique_ptr<SigninErrorController> error_controller_; }; TEST_F(SigninErrorControllerTest, NoErrorAuthStatusProviders) { - scoped_ptr<FakeAuthStatusProvider> provider; + std::unique_ptr<FakeAuthStatusProvider> provider; // No providers. ASSERT_FALSE(error_controller_->HasError()); @@ -41,8 +41,8 @@ TEST_F(SigninErrorControllerTest, NoErrorAuthStatusProviders) { } TEST_F(SigninErrorControllerTest, ErrorAuthStatusProvider) { - scoped_ptr<FakeAuthStatusProvider> provider; - scoped_ptr<FakeAuthStatusProvider> error_provider; + std::unique_ptr<FakeAuthStatusProvider> provider; + std::unique_ptr<FakeAuthStatusProvider> error_provider; provider.reset(new FakeAuthStatusProvider(error_controller_.get())); ASSERT_FALSE(error_controller_->HasError()); @@ -63,9 +63,9 @@ TEST_F(SigninErrorControllerTest, ErrorAuthStatusProvider) { } TEST_F(SigninErrorControllerTest, AuthStatusProviderErrorTransition) { - scoped_ptr<FakeAuthStatusProvider> provider0( + std::unique_ptr<FakeAuthStatusProvider> provider0( new FakeAuthStatusProvider(error_controller_.get())); - scoped_ptr<FakeAuthStatusProvider> provider1( + std::unique_ptr<FakeAuthStatusProvider> provider1( new FakeAuthStatusProvider(error_controller_.get())); ASSERT_FALSE(error_controller_->HasError()); @@ -93,9 +93,9 @@ TEST_F(SigninErrorControllerTest, AuthStatusProviderErrorTransition) { } TEST_F(SigninErrorControllerTest, AuthStatusProviderAccountTransition) { - scoped_ptr<FakeAuthStatusProvider> provider0( + std::unique_ptr<FakeAuthStatusProvider> provider0( new FakeAuthStatusProvider(error_controller_.get())); - scoped_ptr<FakeAuthStatusProvider> provider1( + std::unique_ptr<FakeAuthStatusProvider> provider1( new FakeAuthStatusProvider(error_controller_.get())); ASSERT_FALSE(error_controller_->HasError()); @@ -184,9 +184,9 @@ TEST_F(SigninErrorControllerTest, AuthStatusEnumerateAllErrors) { // Verify that existing error is not replaced by new error. TEST_F(SigninErrorControllerTest, AuthStatusChange) { - scoped_ptr<FakeAuthStatusProvider> fake_provider0( + std::unique_ptr<FakeAuthStatusProvider> fake_provider0( new FakeAuthStatusProvider(error_controller_.get())); - scoped_ptr<FakeAuthStatusProvider> fake_provider1( + std::unique_ptr<FakeAuthStatusProvider> fake_provider1( new FakeAuthStatusProvider(error_controller_.get())); // If there are multiple providers in the provider set... diff --git a/chromium/components/signin/core/browser/signin_internals_util.h b/chromium/components/signin/core/browser/signin_internals_util.h index ae1ce5685c8..3dda94c9af2 100644 --- a/chromium/components/signin/core/browser/signin_internals_util.h +++ b/chromium/components/signin/core/browser/signin_internals_util.h @@ -8,9 +8,9 @@ #include <stddef.h> #include <map> +#include <memory> #include <string> -#include "base/memory/scoped_ptr.h" #include "base/values.h" namespace signin_internals_util { diff --git a/chromium/components/signin/core/browser/signin_investigator.cc b/chromium/components/signin/core/browser/signin_investigator.cc index 994a936c1f8..83961de5aaf 100644 --- a/chromium/components/signin/core/browser/signin_investigator.cc +++ b/chromium/components/signin/core/browser/signin_investigator.cc @@ -28,7 +28,7 @@ SigninInvestigator::SigninInvestigator(const std::string& current_email, current_id_(current_id), provider_(provider) { DCHECK(!current_email_.empty()); - DCHECK(!current_id_.empty()); + DCHECK(provider); } SigninInvestigator::~SigninInvestigator() {} diff --git a/chromium/components/signin/core/browser/signin_investigator_unittest.cc b/chromium/components/signin/core/browser/signin_investigator_unittest.cc index 0f5d25fff90..c031865167a 100644 --- a/chromium/components/signin/core/browser/signin_investigator_unittest.cc +++ b/chromium/components/signin/core/browser/signin_investigator_unittest.cc @@ -42,10 +42,16 @@ class SigninInvestigatorTest : public testing::Test { const std::string& id, bool equals_expectated, AccountEquality histogram_expected) { - base::HistogramTester histogram_tester; FakeProvider provider(email, id); SigninInvestigator investigator(kSameEmail, kSameId, &provider); - bool equals_actual = investigator.AreAccountsEqualWithFallback(); + AssertAccountEquality(&investigator, equals_expectated, histogram_expected); + } + + void AssertAccountEquality(SigninInvestigator* investigator, + bool equals_expectated, + AccountEquality histogram_expected) { + base::HistogramTester histogram_tester; + bool equals_actual = investigator->AreAccountsEqualWithFallback(); ASSERT_EQ(equals_expectated, equals_actual); histogram_tester.ExpectUniqueSample( "Signin.AccountEquality", static_cast<int>(histogram_expected), 1); @@ -93,6 +99,18 @@ TEST_F(SigninInvestigatorTest, EqualityDifferentEmailFallback) { AccountEquality::EMAIL_FALLBACK); } +TEST_F(SigninInvestigatorTest, EqualitySameEmailFallbackEmptyCurrentId) { + FakeProvider provider(kSameEmail, kDifferentId); + SigninInvestigator investigator(kSameEmail, kEmptyId, &provider); + AssertAccountEquality(&investigator, true, AccountEquality::EMAIL_FALLBACK); +} + +TEST_F(SigninInvestigatorTest, EqualityDifferentEmailFallbackEmptyCurrentId) { + FakeProvider provider(kDifferentId, kDifferentId); + SigninInvestigator investigator(kSameEmail, kEmptyId, &provider); + AssertAccountEquality(&investigator, false, AccountEquality::EMAIL_FALLBACK); +} + TEST_F(SigninInvestigatorTest, InvestigateSameAccount) { AssertInvestigatedScenario(kSameEmail, kSameId, InvestigatedScenario::SAME_ACCOUNT); diff --git a/chromium/components/signin/core/browser/signin_manager.h b/chromium/components/signin/core/browser/signin_manager.h index d539db73590..f9b6be7b2b2 100644 --- a/chromium/components/signin/core/browser/signin_manager.h +++ b/chromium/components/signin/core/browser/signin_manager.h @@ -16,7 +16,6 @@ #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_H_ #if defined(OS_CHROMEOS) -// On Chrome OS, SigninManagerBase is all that exists. #include "components/signin/core/browser/signin_manager_base.h" #else @@ -28,7 +27,6 @@ #include "base/gtest_prod_util.h" #include "base/logging.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "build/build_config.h" #include "components/keyed_service/core/keyed_service.h" diff --git a/chromium/components/signin/core/browser/signin_manager_base.h b/chromium/components/signin/core/browser/signin_manager_base.h index b4786d698bc..ddf20d85567 100644 --- a/chromium/components/signin/core/browser/signin_manager_base.h +++ b/chromium/components/signin/core/browser/signin_manager_base.h @@ -23,12 +23,12 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_BASE_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_MANAGER_BASE_H_ +#include <memory> #include <string> #include "base/compiler_specific.h" #include "base/logging.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "components/keyed_service/core/keyed_service.h" #include "components/prefs/pref_change_registrar.h" @@ -93,17 +93,13 @@ class SigninManagerBase : public KeyedService { AccountInfo GetAuthenticatedAccountInfo() const; // If a user has previously signed in (and has not signed out), this returns - // the account id. Otherwise, it returns an empty string. This id can be used - // to uniquely identify an account, so for example can be used as a key to - // map accounts to data. - // - // TODO(rogerta): eventually the account id should be an obfuscated gaia id. - // For now though, this function returns the same value as - // GetAuthenticatedAccountInfo().email since lots of code assumes the unique - // id for an account is the username. For code that needs a unique id to - // represent the connected account, call this method. Example: the - // AccountStatusMap type in MutableProfileOAuth2TokenService. For code that - // needs to know the normalized email address of the connected account, use + // the account id. Otherwise, it returns an empty string. This id is the + // G+/Focus obfuscated gaia id of the user. It can be used to uniquely + // identify an account, so for example as a key to map accounts to data. For + // code that needs a unique id to represent the connected account, call this + // method. Example: the AccountStatusMap type in + // MutableProfileOAuth2TokenService. For code that needs to know the + // normalized email address of the connected account, use // GetAuthenticatedAccountInfo().email. Example: to show the string "Signed // in as XXX" in the hotdog menu. const std::string& GetAuthenticatedAccountId() const; diff --git a/chromium/components/signin/core/browser/signin_status_metrics_provider.cc b/chromium/components/signin/core/browser/signin_status_metrics_provider.cc index 5552192bab8..e656df1a0a5 100644 --- a/chromium/components/signin/core/browser/signin_status_metrics_provider.cc +++ b/chromium/components/signin/core/browser/signin_status_metrics_provider.cc @@ -10,7 +10,7 @@ #include "base/location.h" #include "base/metrics/histogram.h" #include "base/single_thread_task_runner.h" -#include "base/thread_task_runner_handle.h" +#include "base/threading/thread_task_runner_handle.h" #include "components/signin/core/browser/signin_manager.h" namespace { @@ -35,7 +35,7 @@ void RecordComputeSigninStatusHistogram(ComputeSigninStatus status) { } // namespace SigninStatusMetricsProvider::SigninStatusMetricsProvider( - scoped_ptr<SigninStatusMetricsProviderDelegate> delegate, + std::unique_ptr<SigninStatusMetricsProviderDelegate> delegate, bool is_test) : delegate_(std::move(delegate)), scoped_observer_(this), @@ -67,7 +67,7 @@ void SigninStatusMetricsProvider::ProvideGeneralMetrics( // static SigninStatusMetricsProvider* SigninStatusMetricsProvider::CreateInstance( - scoped_ptr<SigninStatusMetricsProviderDelegate> delegate) { + std::unique_ptr<SigninStatusMetricsProviderDelegate> delegate) { return new SigninStatusMetricsProvider(std::move(delegate), false); } diff --git a/chromium/components/signin/core/browser/signin_status_metrics_provider.h b/chromium/components/signin/core/browser/signin_status_metrics_provider.h index f6c16fdd830..859363ea813 100644 --- a/chromium/components/signin/core/browser/signin_status_metrics_provider.h +++ b/chromium/components/signin/core/browser/signin_status_metrics_provider.h @@ -7,9 +7,10 @@ #include <stddef.h> +#include <memory> + #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" #include "build/build_config.h" @@ -37,7 +38,7 @@ class SigninStatusMetricsProvider : public SigninStatusMetricsProviderBase, // Factory method, creates a new instance of this class. static SigninStatusMetricsProvider* CreateInstance( - scoped_ptr<SigninStatusMetricsProviderDelegate> delegate); + std::unique_ptr<SigninStatusMetricsProviderDelegate> delegate); // Update the sign-in status when a SigninManager is created. void OnSigninManagerCreated(SigninManagerBase* manager); @@ -64,7 +65,7 @@ class SigninStatusMetricsProvider : public SigninStatusMetricsProviderBase, // purpose, this class's instance should be created through the static // CreateInstance() method. SigninStatusMetricsProvider( - scoped_ptr<SigninStatusMetricsProviderDelegate> delegate, + std::unique_ptr<SigninStatusMetricsProviderDelegate> delegate, bool is_test); // SigninManagerBase::Observer: @@ -87,7 +88,7 @@ class SigninStatusMetricsProvider : public SigninStatusMetricsProviderBase, // Compute current sign-in status of all opened profiles. void ComputeCurrentSigninStatus(); - scoped_ptr<SigninStatusMetricsProviderDelegate> delegate_; + std::unique_ptr<SigninStatusMetricsProviderDelegate> delegate_; // Used to track the SigninManagers that this instance is observing so that // this instance can be removed as an observer on its destruction. diff --git a/chromium/components/signin/core/browser/signin_tracker.h b/chromium/components/signin/core/browser/signin_tracker.h index 493f7f58916..8592d027572 100644 --- a/chromium/components/signin/core/browser/signin_tracker.h +++ b/chromium/components/signin/core/browser/signin_tracker.h @@ -5,8 +5,9 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_TRACKER_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_TRACKER_H_ +#include <memory> + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/signin/core/browser/gaia_cookie_manager_service.h" #include "components/signin/core/browser/signin_manager.h" #include "google_apis/gaia/google_service_auth_error.h" diff --git a/chromium/components/signin/core/browser/test_signin_client.cc b/chromium/components/signin/core/browser/test_signin_client.cc index 2f2083778b5..cef73eb2435 100644 --- a/chromium/components/signin/core/browser/test_signin_client.cc +++ b/chromium/components/signin/core/browser/test_signin_client.cc @@ -5,7 +5,8 @@ #include "components/signin/core/browser/test_signin_client.h" #include "base/logging.h" -#include "base/thread_task_runner_handle.h" +#include "base/memory/ptr_util.h" +#include "base/threading/thread_task_runner_handle.h" #include "components/signin/core/browser/webdata/token_service_table.h" #include "components/webdata/common/web_data_service_base.h" #include "components/webdata/common/web_database_service.h" @@ -57,7 +58,7 @@ void TestSigninClient::LoadTokenDatabase() { scoped_refptr<WebDatabaseService> web_database = new WebDatabaseService(path, base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get()); - web_database->AddTable(scoped_ptr<WebDatabaseTable>(new TokenServiceTable())); + web_database->AddTable(base::WrapUnique(new TokenServiceTable())); web_database->LoadDatabase(); database_ = new TokenWebData(web_database, base::ThreadTaskRunnerHandle::Get(), @@ -70,13 +71,12 @@ bool TestSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() { return true; } -scoped_ptr<SigninClient::CookieChangedSubscription> +std::unique_ptr<SigninClient::CookieChangedSubscription> TestSigninClient::AddCookieChangedCallback( const GURL& url, const std::string& name, const net::CookieStore::CookieChangedCallback& callback) { - return scoped_ptr<SigninClient::CookieChangedSubscription>( - new SigninClient::CookieChangedSubscription); + return base::WrapUnique(new SigninClient::CookieChangedSubscription); } bool TestSigninClient::IsFirstRun() const { diff --git a/chromium/components/signin/core/browser/test_signin_client.h b/chromium/components/signin/core/browser/test_signin_client.h index dd54eda0db2..a97233bc301 100644 --- a/chromium/components/signin/core/browser/test_signin_client.h +++ b/chromium/components/signin/core/browser/test_signin_client.h @@ -5,11 +5,12 @@ #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_TEST_SIGNIN_CLIENT_H_ #define COMPONENTS_SIGNIN_CORE_BROWSER_TEST_SIGNIN_CLIENT_H_ +#include <memory> + #include "base/compiler_specific.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "components/signin/core/browser/signin_client.h" #include "net/url_request/url_request_test_util.h" @@ -67,7 +68,8 @@ class TestSigninClient : public SigninClient { // Registers |callback| and returns the subscription. // Note that |callback| will never be called. - scoped_ptr<SigninClient::CookieChangedSubscription> AddCookieChangedCallback( + std::unique_ptr<SigninClient::CookieChangedSubscription> + AddCookieChangedCallback( const GURL& url, const std::string& name, const net::CookieStore::CookieChangedCallback& callback) override; diff --git a/chromium/components/signin/core/browser/webdata/token_service_table_unittest.cc b/chromium/components/signin/core/browser/webdata/token_service_table_unittest.cc index fbb7346037d..b6b1e7a910e 100644 --- a/chromium/components/signin/core/browser/webdata/token_service_table_unittest.cc +++ b/chromium/components/signin/core/browser/webdata/token_service_table_unittest.cc @@ -35,8 +35,9 @@ class TokenServiceTableTest : public testing::Test { base::FilePath file_; base::ScopedTempDir temp_dir_; - scoped_ptr<TokenServiceTable> table_; - scoped_ptr<WebDatabase> db_; + std::unique_ptr<TokenServiceTable> table_; + std::unique_ptr<WebDatabase> db_; + private: DISALLOW_COPY_AND_ASSIGN(TokenServiceTableTest); }; diff --git a/chromium/components/signin/core/browser/webdata/token_web_data.cc b/chromium/components/signin/core/browser/webdata/token_web_data.cc index 147b1fa5bd9..679333f9c99 100644 --- a/chromium/components/signin/core/browser/webdata/token_web_data.cc +++ b/chromium/components/signin/core/browser/webdata/token_web_data.cc @@ -5,6 +5,7 @@ #include "components/signin/core/browser/webdata/token_web_data.h" #include "base/bind.h" +#include "base/memory/ptr_util.h" #include "base/memory/ref_counted_delete_on_message_loop.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" @@ -46,11 +47,11 @@ class TokenWebDataBackend return WebDatabase::COMMIT_NOT_NEEDED; } - scoped_ptr<WDTypedResult> GetAllTokens(WebDatabase* db) { + std::unique_ptr<WDTypedResult> GetAllTokens(WebDatabase* db) { std::map<std::string, std::string> map; TokenServiceTable::FromWebDatabase(db)->GetAllTokens(&map); - return scoped_ptr<WDTypedResult>( - new WDResult<std::map<std::string, std::string> >(TOKEN_RESULT, map)); + return base::WrapUnique( + new WDResult<std::map<std::string, std::string>>(TOKEN_RESULT, map)); } protected: diff --git a/chromium/components/signin/ios/browser/account_consistency_service.h b/chromium/components/signin/ios/browser/account_consistency_service.h index f6f7b80666a..45d650bef02 100644 --- a/chromium/components/signin/ios/browser/account_consistency_service.h +++ b/chromium/components/signin/ios/browser/account_consistency_service.h @@ -7,13 +7,13 @@ #include <deque> #include <map> +#include <memory> #include <set> #include <string> #include "base/mac/scoped_nsobject.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/keyed_service/core/keyed_service.h" @@ -184,7 +184,7 @@ class AccountConsistencyService : public KeyedService, // Handlers reacting on GAIA responses with the X-Chrome-Manage-Accounts // header set. - std::map<web::WebState*, scoped_ptr<web::WebStatePolicyDecider>> + std::map<web::WebState*, std::unique_ptr<web::WebStatePolicyDecider>> web_state_handlers_; DISALLOW_COPY_AND_ASSIGN(AccountConsistencyService); diff --git a/chromium/components/signin/ios/browser/account_consistency_service_unittest.mm b/chromium/components/signin/ios/browser/account_consistency_service_unittest.mm index 9cec4a25e39..984a802ead7 100644 --- a/chromium/components/signin/ios/browser/account_consistency_service_unittest.mm +++ b/chromium/components/signin/ios/browser/account_consistency_service_unittest.mm @@ -2,10 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "components/signin/ios/browser/account_consistency_service.h" + #import <WebKit/WebKit.h> +#include <memory> + #import "base/mac/scoped_nsobject.h" -#include "base/memory/scoped_ptr.h" #include "components/pref_registry/testing_pref_service_syncable.h" #include "components/signin/core/browser/account_reconcilor.h" #include "components/signin/core/browser/account_tracker_service.h" @@ -13,7 +16,6 @@ #include "components/signin/core/browser/gaia_cookie_manager_service.h" #include "components/signin/core/browser/test_signin_client.h" #include "components/signin/core/common/signin_pref_names.h" -#include "components/signin/ios/browser/account_consistency_service.h" #include "google_apis/gaia/gaia_constants.h" #include "ios/web/public/test/test_browser_state.h" #include "ios/web/public/test/test_web_state.h" @@ -204,10 +206,10 @@ class AccountConsistencyServiceTest : public PlatformTest { TestWebState web_state_; // AccountConsistencyService being tested. Actually a // FakeAccountConsistencyService to be able to use a mock web view. - scoped_ptr<AccountConsistencyService> account_consistency_service_; - scoped_ptr<TestSigninClient> signin_client_; - scoped_ptr<FakeSigninManager> signin_manager_; - scoped_ptr<MockGaiaCookieManagerService> gaia_cookie_manager_service_; + std::unique_ptr<AccountConsistencyService> account_consistency_service_; + std::unique_ptr<TestSigninClient> signin_client_; + std::unique_ptr<FakeSigninManager> signin_manager_; + std::unique_ptr<MockGaiaCookieManagerService> gaia_cookie_manager_service_; scoped_refptr<HostContentSettingsMap> settings_map_; scoped_refptr<content_settings::CookieSettings> cookie_settings_; }; diff --git a/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.h b/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.h index ea98809e165..d262a28fa3f 100644 --- a/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.h +++ b/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.h @@ -25,6 +25,9 @@ class FakeProfileOAuth2TokenServiceIOSDelegate OAuth2AccessTokenConsumer* consumer) override; bool RefreshTokenIsAvailable(const std::string& account_id) const override; + bool RefreshTokenHasError(const std::string& account_id) const override; + void UpdateAuthError(const std::string& account_id, + const GoogleServiceAuthError& error) override; std::vector<std::string> GetAccounts() override; void RevokeAllCredentials() override; @@ -49,6 +52,8 @@ class FakeProfileOAuth2TokenServiceIOSDelegate // Maps account ids to their refresh token strings. std::map<std::string, std::string> refresh_tokens_; + // Maps account ids to their auth errors. + std::map<std::string, GoogleServiceAuthError> auth_errors_; DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenServiceIOSDelegate); }; diff --git a/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.mm b/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.mm index e5933d4b655..73224fe285d 100644 --- a/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.mm +++ b/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_delegate.mm @@ -38,6 +38,21 @@ bool FakeProfileOAuth2TokenServiceIOSDelegate::RefreshTokenIsAvailable( return !GetRefreshToken(account_id).empty(); } +bool FakeProfileOAuth2TokenServiceIOSDelegate::RefreshTokenHasError( + const std::string& account_id) const { + DCHECK(thread_checker_.CalledOnValidThread()); + auto it = auth_errors_.find(account_id); + return it != auth_errors_.end() && IsError(it->second); +} + +void FakeProfileOAuth2TokenServiceIOSDelegate::UpdateAuthError( + const std::string& account_id, + const GoogleServiceAuthError& error) { + DCHECK(thread_checker_.CalledOnValidThread()); + auth_errors_.erase(account_id); + auth_errors_.emplace(account_id, error); +} + std::string FakeProfileOAuth2TokenServiceIOSDelegate::GetRefreshToken( const std::string& account_id) const { std::map<std::string, std::string>::const_iterator it = @@ -101,9 +116,12 @@ void FakeProfileOAuth2TokenServiceIOSDelegate::IssueRefreshTokenForUser( ScopedBatchChange batch(this); if (token.empty()) { refresh_tokens_.erase(account_id); + auth_errors_.erase(account_id); FireRefreshTokenRevoked(account_id); } else { refresh_tokens_[account_id] = token; + auth_errors_.emplace(account_id, + GoogleServiceAuthError(GoogleServiceAuthError::NONE)); FireRefreshTokenAvailable(account_id); } } diff --git a/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_provider.h b/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_provider.h index 31e5a754fa7..84e8f8ebd29 100644 --- a/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_provider.h +++ b/chromium/components/signin/ios/browser/fake_profile_oauth2_token_service_ios_provider.h @@ -5,12 +5,12 @@ #ifndef IOS_TEST_MOCK_PROFILE_OAUTH2_TOKEN_SERVICE_PROVIDER_IOS_H_ #define IOS_TEST_MOCK_PROFILE_OAUTH2_TOKEN_SERVICE_PROVIDER_IOS_H_ +#include <memory> #include <string> #include <utility> #include <vector> #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/signin/ios/browser/profile_oauth2_token_service_ios_provider.h" // Mock class of ProfileOAuth2TokenServiceIOSProvider for testing. diff --git a/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm b/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm index 379e216b29c..aaee0a2656c 100644 --- a/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm +++ b/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm @@ -6,13 +6,13 @@ #include <Foundation/Foundation.h> +#include <memory> #include <set> #include <string> #include <vector> #include "base/bind.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "base/strings/sys_string_conversions.h" diff --git a/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm b/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm index 364a3d4db3b..c93afa05e6f 100644 --- a/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm +++ b/chromium/components/signin/ios/browser/profile_oauth2_token_service_ios_delegate_unittest.mm @@ -108,7 +108,7 @@ class ProfileOAuth2TokenServiceIOSDelegateTest AccountTrackerService account_tracker_; SigninErrorController signin_error_controller_; FakeProfileOAuth2TokenServiceIOSProvider fake_provider_; - scoped_ptr<ProfileOAuth2TokenServiceIOSDelegate> oauth2_delegate_; + std::unique_ptr<ProfileOAuth2TokenServiceIOSDelegate> oauth2_delegate_; TestingOAuth2TokenServiceConsumer consumer_; int token_available_count_; int token_revoked_count_; @@ -240,7 +240,7 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest, StartRequestSuccess) { ResetObserverCounts(); std::vector<std::string> scopes; scopes.push_back("scope"); - scoped_ptr<OAuth2AccessTokenFetcher> fetcher1( + std::unique_ptr<OAuth2AccessTokenFetcher> fetcher1( oauth2_delegate_->CreateAccessTokenFetcher( GetAccountId(account1), oauth2_delegate_->GetRequestContext(), this)); fetcher1->Start("foo", "bar", scopes); @@ -263,7 +263,7 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest, StartRequestFailure) { ResetObserverCounts(); std::vector<std::string> scopes; scopes.push_back("scope"); - scoped_ptr<OAuth2AccessTokenFetcher> fetcher1( + std::unique_ptr<OAuth2AccessTokenFetcher> fetcher1( oauth2_delegate_->CreateAccessTokenFetcher( GetAccountId(account1), oauth2_delegate_->GetRequestContext(), this)); fetcher1->Start("foo", "bar", scopes); |