Commit be006a8c authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Remove SyncCredentials::scope_set

It's always set to the same value, and it's never actually read (apart
from some DCHECKs).
This also uncovered lots of IWYU violations which this CL fixes.

Bug: none
Change-Id: Idf98478d8fcf81f65ab42b7b9561de0ceff701dc
Reviewed-on: https://chromium-review.googlesource.com/c/1276505
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599242}
parent fc684d65
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "components/sync/engine/test_engine_components_factory.h" #include "components/sync/engine/test_engine_components_factory.h"
#include "components/sync/protocol/sync.pb.h" #include "components/sync/protocol/sync.pb.h"
#include "components/sync/syncable/test_user_share.h" #include "components/sync/syncable/test_user_share.h"
#include "google_apis/gaia/gaia_constants.h"
#include "services/network/test/test_network_connection_tracker.h" #include "services/network/test/test_network_connection_tracker.h"
using syncer::SyncBackendHostImpl; using syncer::SyncBackendHostImpl;
...@@ -85,7 +84,6 @@ void SyncEngineForProfileSyncTest::Initialize(InitParams params) { ...@@ -85,7 +84,6 @@ void SyncEngineForProfileSyncTest::Initialize(InitParams params) {
network::TestNetworkConnectionTracker::GetInstance()); network::TestNetworkConnectionTracker::GetInstance());
params.credentials.email = "testuser@gmail.com"; params.credentials.email = "testuser@gmail.com";
params.credentials.sync_token = "token"; params.credentials.sync_token = "token";
params.credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope);
params.restored_key_for_bootstrapping.clear(); params.restored_key_for_bootstrapping.clear();
// It'd be nice if we avoided creating the EngineComponentsFactory in the // It'd be nice if we avoided creating the EngineComponentsFactory in the
......
...@@ -135,7 +135,6 @@ syncer::SyncCredentials SyncAuthManager::GetCredentials() const { ...@@ -135,7 +135,6 @@ syncer::SyncCredentials SyncAuthManager::GetCredentials() const {
credentials.account_id = account_info.account_id; credentials.account_id = account_info.account_id;
credentials.email = account_info.email; credentials.email = account_info.email;
credentials.sync_token = access_token_; credentials.sync_token = access_token_;
credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope);
return credentials; return credentials;
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
#include "components/sync/model/change_processor.h" #include "components/sync/model/change_processor.h"
#include "components/sync/model/data_type_error_handler.h" #include "components/sync/model/data_type_error_handler.h"
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "components/sync_preferences/pref_service_syncable.h" #include "components/sync_preferences/pref_service_syncable.h"
#include "components/sync_preferences/testing_pref_service_syncable.h" #include "components/sync_preferences/testing_pref_service_syncable.h"
#include "google/cacheinvalidation/include/types.h" #include "google/cacheinvalidation/include/types.h"
#include "google_apis/gaia/gaia_constants.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/test/test_network_connection_tracker.h" #include "services/network/test/test_network_connection_tracker.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
...@@ -184,7 +183,6 @@ class SyncEngineTest : public testing::Test { ...@@ -184,7 +183,6 @@ class SyncEngineTest : public testing::Test {
credentials_.account_id = "user@example.com"; credentials_.account_id = "user@example.com";
credentials_.email = "user@example.com"; credentials_.email = "user@example.com";
credentials_.sync_token = "sync_token"; credentials_.sync_token = "sync_token";
credentials_.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope);
fake_manager_factory_ = std::make_unique<FakeSyncManagerFactory>( fake_manager_factory_ = std::make_unique<FakeSyncManagerFactory>(
&fake_manager_, network::TestNetworkConnectionTracker::GetInstance()); &fake_manager_, network::TestNetworkConnectionTracker::GetInstance());
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <string> #include <string>
#include "google_apis/gaia/oauth2_token_service.h"
namespace syncer { namespace syncer {
// Contains everything needed to talk to and identify a user account. // Contains everything needed to talk to and identify a user account.
...@@ -25,9 +23,6 @@ struct SyncCredentials { ...@@ -25,9 +23,6 @@ struct SyncCredentials {
// The raw authentication token's bytes. // The raw authentication token's bytes.
std::string sync_token; std::string sync_token;
// The set of scopes to use when talking to sync server.
OAuth2TokenService::ScopeSet scope_set;
}; };
} // namespace syncer } // namespace syncer
......
...@@ -99,8 +99,8 @@ class SyncEngine : public ModelTypeConfigurer { ...@@ -99,8 +99,8 @@ class SyncEngine : public ModelTypeConfigurer {
virtual void TriggerRefresh(const ModelTypeSet& types) = 0; virtual void TriggerRefresh(const ModelTypeSet& types) = 0;
// Updates the engine's SyncCredentials. The credentials must be fully // Updates the engine's SyncCredentials. The credentials must be fully
// specified (account ID, sync token and scope). To invalidate the credentials // specified (account ID, email, and sync token). To invalidate the
// use InvalisateCredentials() instead. // credentials, use InvalidateCredentials() instead.
virtual void UpdateCredentials(const SyncCredentials& credentials) = 0; virtual void UpdateCredentials(const SyncCredentials& credentials) = 0;
// Invalidates the SyncCredentials. // Invalidates the SyncCredentials.
......
...@@ -31,8 +31,7 @@ ...@@ -31,8 +31,7 @@
#include "components/sync/engine/sync_status.h" #include "components/sync/engine/sync_status.h"
#include "components/sync/protocol/sync_protocol_error.h" #include "components/sync/protocol/sync_protocol_error.h"
#include "components/sync/syncable/change_record.h" #include "components/sync/syncable/change_record.h"
#include "url/gurl.h"
class GURL;
namespace base { namespace base {
namespace trace_event { namespace trace_event {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "components/sync/engine_impl/cycle/debug_info_getter.h" #include "components/sync/engine_impl/cycle/debug_info_getter.h"
#include "components/sync/engine_impl/model_type_registry.h" #include "components/sync/engine_impl/model_type_registry.h"
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "components/sync/base/model_type.h" #include "components/sync/base/model_type.h"
#include "components/sync/engine/cycle/type_debug_info_observer.h" #include "components/sync/engine/cycle/type_debug_info_observer.h"
#include "components/sync/engine/model_safe_worker.h" #include "components/sync/engine/model_safe_worker.h"
......
...@@ -201,7 +201,6 @@ void SyncManagerImpl::Init(InitArgs* args) { ...@@ -201,7 +201,6 @@ void SyncManagerImpl::Init(InitArgs* args) {
DCHECK(!args->long_poll_interval.is_zero()); DCHECK(!args->long_poll_interval.is_zero());
if (!args->enable_local_sync_backend) { if (!args->enable_local_sync_backend) {
DCHECK(!args->credentials.account_id.empty()); DCHECK(!args->credentials.account_id.empty());
DCHECK(!args->credentials.scope_set.empty());
} }
DCHECK(args->cancelation_signal); DCHECK(args->cancelation_signal);
DVLOG(1) << "SyncManager starting Init..."; DVLOG(1) << "SyncManager starting Init...";
...@@ -472,7 +471,6 @@ void SyncManagerImpl::UpdateCredentials(const SyncCredentials& credentials) { ...@@ -472,7 +471,6 @@ void SyncManagerImpl::UpdateCredentials(const SyncCredentials& credentials) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(initialized_); DCHECK(initialized_);
DCHECK(!credentials.account_id.empty()); DCHECK(!credentials.account_id.empty());
DCHECK(!credentials.scope_set.empty());
cycle_context_->set_account_name(credentials.email); cycle_context_->set_account_name(credentials.email);
observing_network_connectivity_changes_ = true; observing_network_connectivity_changes_ = true;
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#include "components/sync/test/engine/fake_model_worker.h" #include "components/sync/test/engine/fake_model_worker.h"
#include "components/sync/test/engine/fake_sync_scheduler.h" #include "components/sync/test/engine/fake_sync_scheduler.h"
#include "components/sync/test/engine/test_id_factory.h" #include "components/sync/test/engine/test_id_factory.h"
#include "google_apis/gaia/gaia_constants.h"
#include "services/network/test/test_network_connection_tracker.h" #include "services/network/test/test_network_connection_tracker.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -936,9 +935,6 @@ class SyncManagerTest : public testing::Test, ...@@ -936,9 +935,6 @@ class SyncManagerTest : public testing::Test,
credentials.account_id = "foo@bar.com"; credentials.account_id = "foo@bar.com";
credentials.email = "foo@bar.com"; credentials.email = "foo@bar.com";
credentials.sync_token = "sometoken"; credentials.sync_token = "sometoken";
OAuth2TokenService::ScopeSet scope_set;
scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope);
credentials.scope_set = scope_set;
sync_manager_.AddObserver(&manager_observer_); sync_manager_.AddObserver(&manager_observer_);
EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)) EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _))
......
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