diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 17:03:55 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 17:03:55 +0000 |
commit | da54623fa168c0fee6d8e117dbe841fe921f1f59 (patch) | |
tree | a2fe93cf968558b14e3dcb181a74155e15e0cfc6 /google_apis | |
parent | ba16cce0d6c6c4ece3abf0630a9e6c6a4de3be72 (diff) | |
download | chromium_src-da54623fa168c0fee6d8e117dbe841fe921f1f59.zip chromium_src-da54623fa168c0fee6d8e117dbe841fe921f1f59.tar.gz chromium_src-da54623fa168c0fee6d8e117dbe841fe921f1f59.tar.bz2 |
Move IdentityProvider usage from GCMDriverDesktop to GCMProfileService
This is the 1st step towards removing sign-in enforcement for GCM.
We also remove the logic to pass account IDs to check-in request
since it seems to work fine without them and TokenService::GetAccounts
returns the empty list.
BUG=384041
TEST=existing and new tests
R=bartfab@chromium.org, fgorski@chromium.org, zea@chromium.org
TBR=jochen@chromium.org, rogerta@chromium.org
Review URL: https://codereview.chromium.org/330733002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277789 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/BUILD.gn | 9 | ||||
-rw-r--r-- | google_apis/gaia/dummy_identity_provider.cc | 93 | ||||
-rw-r--r-- | google_apis/gaia/dummy_identity_provider.h | 39 | ||||
-rw-r--r-- | google_apis/gcm/engine/checkin_request.cc | 9 | ||||
-rw-r--r-- | google_apis/gcm/engine/checkin_request.h | 4 | ||||
-rw-r--r-- | google_apis/gcm/engine/checkin_request_unittest.cc | 6 | ||||
-rw-r--r-- | google_apis/gcm/tools/mcs_probe.cc | 2 | ||||
-rw-r--r-- | google_apis/google_apis.gyp | 8 |
8 files changed, 1 insertions, 169 deletions
diff --git a/google_apis/BUILD.gn b/google_apis/BUILD.gn index 06877c7..6dbeab1 100644 --- a/google_apis/BUILD.gn +++ b/google_apis/BUILD.gn @@ -109,8 +109,6 @@ source_set("google_apis") { "drive/task_util.h", "drive/time_util.cc", "drive/time_util.h", - "gaia/dummy_identity_provider.cc", - "gaia/dummy_identity_provider.h", "gaia/gaia_auth_consumer.cc", "gaia/gaia_auth_consumer.h", "gaia/gaia_auth_fetcher.cc", @@ -169,13 +167,6 @@ source_set("google_apis") { } else { sources += [ "cup/client_update_protocol_nss.cc" ] } - - if (is_chromeos || is_android) { - sources -= [ - "gaia/dummy_identity_provider.cc", - "gaia/dummy_identity_provider.h", - ] - } } source_set("test_support") { diff --git a/google_apis/gaia/dummy_identity_provider.cc b/google_apis/gaia/dummy_identity_provider.cc deleted file mode 100644 index 5099175..0000000 --- a/google_apis/gaia/dummy_identity_provider.cc +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "google_apis/gaia/dummy_identity_provider.h" - -#include <string> - -#include "google_apis/gaia/oauth2_token_service.h" - -class DummyIdentityProvider::DummyOAuth2TokenService - : public OAuth2TokenService { - public: - DummyOAuth2TokenService(); - virtual ~DummyOAuth2TokenService(); - - // OAuth2TokenService: - virtual bool RefreshTokenIsAvailable( - const std::string& account_id) const OVERRIDE; - virtual void FetchOAuth2Token(RequestImpl* request, - const std::string& account_id, - net::URLRequestContextGetter* getter, - const std::string& client_id, - const std::string& client_secret, - const ScopeSet& scopes) OVERRIDE; - virtual OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( - const std::string& account_id, - net::URLRequestContextGetter* getter, - OAuth2AccessTokenConsumer* consumer) OVERRIDE; - - private: - virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; - - DISALLOW_COPY_AND_ASSIGN(DummyOAuth2TokenService); -}; - - -DummyIdentityProvider::DummyOAuth2TokenService::DummyOAuth2TokenService() { -} - -DummyIdentityProvider::DummyOAuth2TokenService::~DummyOAuth2TokenService() { -} - -bool DummyIdentityProvider::DummyOAuth2TokenService::RefreshTokenIsAvailable( - const std::string& account_id) const { - return false; -} - -void DummyIdentityProvider::DummyOAuth2TokenService::FetchOAuth2Token( - RequestImpl* request, - const std::string& account_id, - net::URLRequestContextGetter* getter, - const std::string& client_id, - const std::string& client_secret, - const ScopeSet& scopes) { - // Ignore the fetch request. -} - -OAuth2AccessTokenFetcher* -DummyIdentityProvider::DummyOAuth2TokenService::CreateAccessTokenFetcher( - const std::string& account_id, - net::URLRequestContextGetter* getter, - OAuth2AccessTokenConsumer* consumer) { - return NULL; -} - -net::URLRequestContextGetter* -DummyIdentityProvider::DummyOAuth2TokenService::GetRequestContext() { - return NULL; -} - -DummyIdentityProvider::DummyIdentityProvider() - : oauth2_token_service_(new DummyOAuth2TokenService) { -} - -DummyIdentityProvider::~DummyIdentityProvider() { -} - -std::string DummyIdentityProvider::GetActiveUsername() { - return std::string(); -} - -std::string DummyIdentityProvider::GetActiveAccountId() { - return std::string(); -} - -OAuth2TokenService* DummyIdentityProvider::GetTokenService() { - return oauth2_token_service_.get(); -} - -bool DummyIdentityProvider::RequestLogin() { - return false; -} diff --git a/google_apis/gaia/dummy_identity_provider.h b/google_apis/gaia/dummy_identity_provider.h deleted file mode 100644 index 38624a9..0000000 --- a/google_apis/gaia/dummy_identity_provider.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GOOGLE_APIS_GAIA_DUMMY_IDENTITY_PROVIDER_H_ -#define GOOGLE_APIS_GAIA_DUMMY_IDENTITY_PROVIDER_H_ - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "google_apis/gaia/identity_provider.h" - -// GCMDriverDesktop depends on IdentityProvider as it was originally meant to -// work for signed-in users only. This dependency is being removed. While it is -// still present, DummyIdentityProvider will be used for the browser-global -// GCMDriver instance. The DummyIdentityProvider never has any active user or -// tokens. -// TODO(bartfab,jianli): Remove this class when GCMDriverDesktop no longer -// depends on IdentityService. -class DummyIdentityProvider : public IdentityProvider { - public: - DummyIdentityProvider(); - virtual ~DummyIdentityProvider(); - - // IdentityProvider: - virtual std::string GetActiveUsername() OVERRIDE; - virtual std::string GetActiveAccountId() OVERRIDE; - virtual OAuth2TokenService* GetTokenService() OVERRIDE; - virtual bool RequestLogin() OVERRIDE; - - private: - class DummyOAuth2TokenService; - - scoped_ptr<DummyOAuth2TokenService> oauth2_token_service_; - - DISALLOW_COPY_AND_ASSIGN(DummyIdentityProvider); -}; - -#endif // GOOGLE_APIS_GAIA_FAKE_IDENTITY_PROVIDER_H_ diff --git a/google_apis/gcm/engine/checkin_request.cc b/google_apis/gcm/engine/checkin_request.cc index e7490e5..a555847 100644 --- a/google_apis/gcm/engine/checkin_request.cc +++ b/google_apis/gcm/engine/checkin_request.cc @@ -81,12 +81,10 @@ CheckinRequest::RequestInfo::RequestInfo( uint64 android_id, uint64 security_token, const std::string& settings_digest, - const std::vector<std::string>& account_ids, const checkin_proto::ChromeBuildProto& chrome_build_proto) : android_id(android_id), security_token(security_token), settings_digest(settings_digest), - account_ids(account_ids), chrome_build_proto(chrome_build_proto) { } @@ -129,13 +127,6 @@ void CheckinRequest::Start() { checkin->set_type(checkin_proto::DEVICE_CHROME_BROWSER); #endif - for (std::vector<std::string>::const_iterator iter = - request_info_.account_ids.begin(); - iter != request_info_.account_ids.end(); - ++iter) { - request.add_account_cookie("[" + *iter + "]"); - } - std::string upload_data; CHECK(request.SerializeToString(&upload_data)); diff --git a/google_apis/gcm/engine/checkin_request.h b/google_apis/gcm/engine/checkin_request.h index 9253aac..ae4a7d4 100644 --- a/google_apis/gcm/engine/checkin_request.h +++ b/google_apis/gcm/engine/checkin_request.h @@ -6,7 +6,6 @@ #define GOOGLE_APIS_GCM_ENGINE_CHECKIN_REQUEST_H_ #include <string> -#include <vector> #include "base/basictypes.h" #include "base/callback.h" @@ -43,7 +42,6 @@ class GCM_EXPORT CheckinRequest : public net::URLFetcherDelegate { RequestInfo(uint64 android_id, uint64 security_token, const std::string& settings_digest, - const std::vector<std::string>& account_ids, const checkin_proto::ChromeBuildProto& chrome_build_proto); ~RequestInfo(); @@ -53,8 +51,6 @@ class GCM_EXPORT CheckinRequest : public net::URLFetcherDelegate { uint64 security_token; // Digest of GServices settings on the device. std::string settings_digest; - // Account IDs of GAIA accounts related to this device. - std::vector<std::string> account_ids; // Information of the Chrome build of this device. checkin_proto::ChromeBuildProto chrome_build_proto; }; diff --git a/google_apis/gcm/engine/checkin_request_unittest.cc b/google_apis/gcm/engine/checkin_request_unittest.cc index 4fea361..12e9a60 100644 --- a/google_apis/gcm/engine/checkin_request_unittest.cc +++ b/google_apis/gcm/engine/checkin_request_unittest.cc @@ -3,7 +3,6 @@ // found in the LICENSE file. #include <string> -#include <vector> #include "google_apis/gcm/engine/checkin_request.h" #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" @@ -90,7 +89,6 @@ class CheckinRequestTest : public testing::Test { net::TestURLFetcherFactory url_fetcher_factory_; scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; checkin_proto::ChromeBuildProto chrome_build_proto_; - std::vector<std::string> account_ids_; scoped_ptr<CheckinRequest> request_; FakeGCMStatsRecorder recorder_; }; @@ -102,7 +100,6 @@ CheckinRequestTest::CheckinRequestTest() checkin_device_type_(0), url_request_context_getter_(new net::TestURLRequestContextGetter( message_loop_.message_loop_proxy())) { - account_ids_.push_back("account_id"); } CheckinRequestTest::~CheckinRequestTest() {} @@ -129,7 +126,6 @@ void CheckinRequestTest::CreateRequest(uint64 android_id, android_id, security_token, kSettingsDigest, - account_ids_, chrome_build_proto_); // Then create a request with that protobuf and specified android_id, // security_token. @@ -212,8 +208,6 @@ TEST_F(CheckinRequestTest, FetcherDataAndURL) { #endif EXPECT_EQ(kSettingsDigest, request_proto.digest()); - EXPECT_EQ(1, request_proto.account_cookie_size()); - EXPECT_EQ("[account_id]", request_proto.account_cookie(0)); } TEST_F(CheckinRequestTest, ResponseBodyEmpty) { diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc index 9bac74c..1bb0bc1 100644 --- a/google_apis/gcm/tools/mcs_probe.cc +++ b/google_apis/gcm/tools/mcs_probe.cc @@ -432,7 +432,7 @@ void MCSProbe::CheckIn() { chrome_build_proto.set_chrome_version(kChromeVersion); CheckinRequest::RequestInfo request_info( - 0, 0, std::string(), std::vector<std::string>(), chrome_build_proto); + 0, 0, std::string(), chrome_build_proto); checkin_request_.reset(new CheckinRequest( GServicesSettings::DefaultCheckinURL(), diff --git a/google_apis/google_apis.gyp b/google_apis/google_apis.gyp index 0d99026..a3dbb03 100644 --- a/google_apis/google_apis.gyp +++ b/google_apis/google_apis.gyp @@ -59,12 +59,6 @@ 'cup/client_update_protocol_openssl.cc', ], }], - ['chromeos==1 or OS == "android"', { - 'sources!': [ - 'gaia/dummy_identity_provider.cc', - 'gaia/dummy_identity_provider.h', - ] - }], ], 'sources': [ 'cup/client_update_protocol.cc', @@ -101,8 +95,6 @@ 'drive/task_util.h', 'drive/time_util.cc', 'drive/time_util.h', - 'gaia/dummy_identity_provider.cc', - 'gaia/dummy_identity_provider.h', 'gaia/gaia_auth_consumer.cc', 'gaia/gaia_auth_consumer.h', 'gaia/gaia_auth_fetcher.cc', |