diff options
author | maxbogue <maxbogue@chromium.org> | 2015-09-10 10:40:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-10 17:41:08 +0000 |
commit | 81abdf24465d84e2304b8245d2f51400436ce2e8 (patch) | |
tree | 9872305f73fb33564a11f50de9b0239e3a703974 | |
parent | 50d1b1c62972353fe25772fd22e6fb317ebc80f9 (diff) | |
download | chromium_src-81abdf24465d84e2304b8245d2f51400436ce2e8.zip chromium_src-81abdf24465d84e2304b8245d2f51400436ce2e8.tar.gz chromium_src-81abdf24465d84e2304b8245d2f51400436ce2e8.tar.bz2 |
[Sync] Clean up PSS boolean getters for consistency.
When cleaning up ProfileSyncServiceAndroid I noticed these inconsistencies
but it seemed like PSS was the one that should be changed, not PSSA.
Renames:
- EncryptEverythingEnabled -> IsEncryptEverythingEnabled
- EncryptEverythingAllowed -> IsEncryptEverythingAllowed
- FirstSetupInProgress -> IsFirstSetupInProgress
- backend_initialized -> IsBackendInitialized
- setup_in_progress -> IsSetupInProgress
BUG=497518
TBR=rogerta,stevenjb,pam,sdefresne
Review URL: https://codereview.chromium.org/1321903005
Cr-Commit-Position: refs/heads/master@{#348178}
40 files changed, 192 insertions, 191 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java index 643206e..e9bff28 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java @@ -108,8 +108,8 @@ public class PassphraseTypeDialogFragment extends DialogFragment implements CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent); PassphraseType positionType = getType(position); PassphraseType currentType = getCurrentTypeFromArguments(); - Set<PassphraseType> allowedTypes = currentType.getAllowedTypes( - getEncryptEverythingAllowedFromArguments()); + Set<PassphraseType> allowedTypes = + currentType.getAllowedTypes(getIsEncryptEverythingAllowedFromArguments()); // Set the item to checked it if it is the currently selected encryption type. view.setChecked(positionType == currentType); @@ -126,16 +126,16 @@ public class PassphraseTypeDialogFragment extends DialogFragment implements private static final String ARG_PASSPHRASE_TIME = "arg_passphrase_time"; - private static final String ARG_ENCRYPT_EVERYTHING_ALLOWED = "arg_encrypt_everything_allowed"; + private static final String ARG_IS_ENCRYPT_EVERYTHING_ALLOWED = + "arg_is_encrypt_everything_allowed"; - static PassphraseTypeDialogFragment create(PassphraseType currentType, - long passphraseTime, - boolean encryptEverythingAllowed) { + static PassphraseTypeDialogFragment create( + PassphraseType currentType, long passphraseTime, boolean isEncryptEverythingAllowed) { PassphraseTypeDialogFragment dialog = new PassphraseTypeDialogFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_CURRENT_TYPE, currentType); args.putLong(ARG_PASSPHRASE_TIME, passphraseTime); - args.putBoolean(ARG_ENCRYPT_EVERYTHING_ALLOWED, encryptEverythingAllowed); + args.putBoolean(ARG_IS_ENCRYPT_EVERYTHING_ALLOWED, isEncryptEverythingAllowed); dialog.setArguments(args); return dialog; } @@ -173,8 +173,8 @@ public class PassphraseTypeDialogFragment extends DialogFragment implements // We know this conversion from long to int is safe, because it represents very small // enum values. PassphraseType type = PassphraseType.fromInternalValue((int) typeId); - boolean encryptEverythingAllowed = getEncryptEverythingAllowedFromArguments(); - if (currentType.getAllowedTypes(encryptEverythingAllowed).contains(type)) { + boolean isEncryptEverythingAllowed = getIsEncryptEverythingAllowedFromArguments(); + if (currentType.getAllowedTypes(isEncryptEverythingAllowed).contains(type)) { if (typeId != currentType.internalValue()) { Listener listener = (Listener) getTargetFragment(); listener.onPassphraseTypeSelected(type); @@ -198,7 +198,7 @@ public class PassphraseTypeDialogFragment extends DialogFragment implements return df.format(new Date(passphraseTime)); } - private boolean getEncryptEverythingAllowedFromArguments() { - return getArguments().getBoolean(ARG_ENCRYPT_EVERYTHING_ALLOWED); + private boolean getIsEncryptEverythingAllowedFromArguments() { + return getArguments().getBoolean(ARG_IS_ENCRYPT_EVERYTHING_ALLOWED); } } diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc index 0388ca0..a98d262 100644 --- a/chrome/browser/chromeos/extensions/input_method_api.cc +++ b/chrome/browser/chromeos/extensions/input_method_api.cc @@ -166,7 +166,7 @@ ExtensionFunction::ResponseAction GetEncryptSyncEnabledFunction::Run() { if (!profile_sync_service) return RespondNow(Error("Sync service is not ready for current profile.")); scoped_ptr<base::Value> ret(new base::FundamentalValue( - profile_sync_service->EncryptEverythingEnabled())); + profile_sync_service->IsEncryptEverythingEnabled())); return RespondNow(OneArgument(ret.Pass())); #endif } diff --git a/chrome/browser/signin/signin_ui_util.cc b/chrome/browser/signin/signin_ui_util.cc index bab391d..0c5f96c 100644 --- a/chrome/browser/signin/signin_ui_util.cc +++ b/chrome/browser/signin/signin_ui_util.cc @@ -84,7 +84,7 @@ base::string16 GetSigninMenuLabel(Profile* profile) { // Even if the user is signed in, don't display the "signed in as..." // label if we're still setting up sync. - if (!service || !service->FirstSetupInProgress()) { + if (!service || !service->IsFirstSetupInProgress()) { std::string username; SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfileIfExists(profile); diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc index 74f18d1..cdf6367 100644 --- a/chrome/browser/supervised_user/supervised_user_service.cc +++ b/chrome/browser/supervised_user/supervised_user_service.cc @@ -422,7 +422,7 @@ bool SupervisedUserService::IncludesSyncSessionsType() const { void SupervisedUserService::OnStateChanged() { ProfileSyncService* service = ProfileSyncServiceFactory::GetForProfile(profile_); - if (waiting_for_sync_initialization_ && service->backend_initialized() && + if (waiting_for_sync_initialization_ && service->IsBackendInitialized() && service->backend_mode() == ProfileSyncService::SYNC) { waiting_for_sync_initialization_ = false; service->RemoveObserver(this); @@ -454,7 +454,7 @@ void SupervisedUserService::FinishSetupSyncWhenReady() { // Continue in FinishSetupSync() once the Sync backend has been initialized. ProfileSyncService* service = ProfileSyncServiceFactory::GetForProfile(profile_); - if (service->backend_initialized() && + if (service->IsBackendInitialized() && service->backend_mode() == ProfileSyncService::SYNC) { FinishSetupSync(); } else { @@ -466,7 +466,7 @@ void SupervisedUserService::FinishSetupSyncWhenReady() { void SupervisedUserService::FinishSetupSync() { ProfileSyncService* service = ProfileSyncServiceFactory::GetForProfile(profile_); - DCHECK(service->backend_initialized()); + DCHECK(service->IsBackendInitialized()); DCHECK(service->backend_mode() == ProfileSyncService::SYNC); // Sync nothing (except types which are set via GetPreferredDataTypes). diff --git a/chrome/browser/sync/glue/history_delete_directives_data_type_controller.cc b/chrome/browser/sync/glue/history_delete_directives_data_type_controller.cc index 455993d..846d7ee 100644 --- a/chrome/browser/sync/glue/history_delete_directives_data_type_controller.cc +++ b/chrome/browser/sync/glue/history_delete_directives_data_type_controller.cc @@ -29,7 +29,7 @@ HistoryDeleteDirectivesDataTypeController:: } bool HistoryDeleteDirectivesDataTypeController::ReadyForStart() const { - return !sync_client_->GetSyncService()->EncryptEverythingEnabled(); + return !sync_client_->GetSyncService()->IsEncryptEverythingEnabled(); } bool HistoryDeleteDirectivesDataTypeController::StartModels() { diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index ffcb4d1..89499f6 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -387,7 +387,7 @@ void ProfileSyncService::Initialize() { } void ProfileSyncService::TrySyncDatatypePrefRecovery() { - DCHECK(!backend_initialized()); + DCHECK(!IsBackendInitialized()); if (!HasSyncSetupCompleted()) return; @@ -1073,7 +1073,7 @@ void ProfileSyncService::PostBackendInitialization() { UpdateLastSyncedTime(); } - if (startup_controller_->auto_start_enabled() && !FirstSetupInProgress()) { + if (startup_controller_->auto_start_enabled() && !IsFirstSetupInProgress()) { // Backend is initialized but we're not in sync setup, so this must be an // autostart - mark our sync setup as completed and we'll start syncing // below. @@ -1086,7 +1086,7 @@ void ProfileSyncService::PostBackendInitialization() { if (HasSyncSetupCompleted()) { ConfigureDataTypeManager(); } else { - DCHECK(FirstSetupInProgress()); + DCHECK(IsFirstSetupInProgress()); } NotifyObservers(); @@ -1359,7 +1359,7 @@ void ProfileSyncService::OnActionableError(const SyncProtocolError& error) { // TODO(lipalani) : if setup in progress we want to display these // actions in the popup. The current experience might not be optimal for // the user. We just dismiss the dialog. - if (startup_controller_->setup_in_progress()) { + if (startup_controller_->IsSetupInProgress()) { RequestStop(CLEAR_DATA); expect_sync_configuration_aborted_ = true; } @@ -1635,8 +1635,8 @@ bool ProfileSyncService::auto_start_enabled() const { return startup_controller_->auto_start_enabled(); } -bool ProfileSyncService::setup_in_progress() const { - return startup_controller_->setup_in_progress(); +bool ProfileSyncService::IsSetupInProgress() const { + return startup_controller_->IsSetupInProgress(); } bool ProfileSyncService::QueryDetailedSyncStatus( @@ -1656,17 +1656,17 @@ const AuthError& ProfileSyncService::GetAuthError() const { return last_auth_error_; } -bool ProfileSyncService::FirstSetupInProgress() const { - return !HasSyncSetupCompleted() && startup_controller_->setup_in_progress(); +bool ProfileSyncService::IsFirstSetupInProgress() const { + return !HasSyncSetupCompleted() && startup_controller_->IsSetupInProgress(); } void ProfileSyncService::SetSetupInProgress(bool setup_in_progress) { // This method is a no-op if |setup_in_progress_| remains unchanged. - if (startup_controller_->setup_in_progress() == setup_in_progress) + if (startup_controller_->IsSetupInProgress() == setup_in_progress) return; startup_controller_->set_setup_in_progress(setup_in_progress); - if (!setup_in_progress && backend_initialized()) + if (!setup_in_progress && IsBackendInitialized()) ReconfigureDatatypeManager(); NotifyObservers(); } @@ -1685,7 +1685,7 @@ bool ProfileSyncService::IsSignedIn() const { return !signin_->GetAccountIdToUse().empty(); } -bool ProfileSyncService::backend_initialized() const { +bool ProfileSyncService::IsBackendInitialized() const { return backend_initialized_; } @@ -1894,7 +1894,7 @@ void ProfileSyncService::ConfigureDataTypeManager() { // start syncing data until the user is done configuring encryption options, // etc. ReconfigureDatatypeManager() will get called again once the UI calls // SetSetupInProgress(false). - if (backend_mode_ == SYNC && startup_controller_->setup_in_progress()) + if (backend_mode_ == SYNC && startup_controller_->IsSetupInProgress()) return; bool restart = false; @@ -2079,7 +2079,7 @@ void ProfileSyncService::ConsumeCachedPassphraseIfPossible() { // If no cached passphrase, or sync backend hasn't started up yet, just exit. // If the backend isn't running yet, OnBackendInitialized() will call this // method again after the backend starts up. - if (cached_passphrase_.empty() || !backend_initialized()) + if (cached_passphrase_.empty() || !IsBackendInitialized()) return; // Backend is up and running, so we can consume the cached passphrase. @@ -2129,7 +2129,7 @@ void ProfileSyncService::RequestAccessToken() { void ProfileSyncService::SetEncryptionPassphrase(const std::string& passphrase, PassphraseType type) { // This should only be called when the backend has been initialized. - DCHECK(backend_initialized()); + DCHECK(IsBackendInitialized()); DCHECK(!(type == IMPLICIT && IsUsingSecondaryPassphrase())) << "Data is already encrypted using an explicit passphrase"; DCHECK(!(type == EXPLICIT && @@ -2164,22 +2164,22 @@ bool ProfileSyncService::SetDecryptionPassphrase( } } -bool ProfileSyncService::EncryptEverythingAllowed() const { +bool ProfileSyncService::IsEncryptEverythingAllowed() const { return encrypt_everything_allowed_; } void ProfileSyncService::SetEncryptEverythingAllowed(bool allowed) { - DCHECK(allowed || !backend_initialized() || !EncryptEverythingEnabled()); + DCHECK(allowed || !IsBackendInitialized() || !IsEncryptEverythingEnabled()); encrypt_everything_allowed_ = allowed; } void ProfileSyncService::EnableEncryptEverything() { - DCHECK(EncryptEverythingAllowed()); + DCHECK(IsEncryptEverythingAllowed()); - // Tests override backend_initialized() to always return true, so we + // Tests override IsBackendInitialized() to always return true, so we // must check that instead of |backend_initialized_|. // TODO(akalin): Fix the above. :/ - DCHECK(backend_initialized()); + DCHECK(IsBackendInitialized()); // TODO(atwilson): Persist the encryption_pending_ flag to address the various // problems around cancelling encryption in the background (crbug.com/119649). if (!encrypt_everything_) @@ -2193,7 +2193,7 @@ bool ProfileSyncService::encryption_pending() const { return encryption_pending_; } -bool ProfileSyncService::EncryptEverythingEnabled() const { +bool ProfileSyncService::IsEncryptEverythingEnabled() const { DCHECK(backend_initialized_); return encrypt_everything_ || encryption_pending_; } @@ -2227,7 +2227,7 @@ void ProfileSyncService::GoogleSigninSucceeded(const std::string& account_id, #if defined(OS_CHROMEOS) RefreshSpareBootstrapToken(password); #endif - if (!backend_initialized() || GetAuthError().state() != AuthError::NONE) { + if (!IsBackendInitialized() || GetAuthError().state() != AuthError::NONE) { // Track the fact that we're still waiting for auth to complete. is_auth_in_progress_ = true; } diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 1099ef3..e46164c 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -151,7 +151,7 @@ class EncryptedData; // * GetPreferredDataTypes() // * GetActiveDataTypes() // * IsUsingSecondaryPassphrase() -// * EncryptEverythingEnabled() +// * IsEncryptEverythingEnabled() // * IsPassphraseRequired()/IsPassphraseRequiredForDecryption() // // The "sync everything" state cannot be read from ProfileSyncService, but @@ -260,19 +260,19 @@ class ProfileSyncService : public sync_driver::SyncService, void OnUserChoseDatatypes(bool sync_everything, syncer::ModelTypeSet chosen_types) override; void SetSyncSetupCompleted() override; - bool FirstSetupInProgress() const override; + bool IsFirstSetupInProgress() const override; void SetSetupInProgress(bool setup_in_progress) override; - bool setup_in_progress() const override; + bool IsSetupInProgress() const override; bool ConfigurationDone() const override; const GoogleServiceAuthError& GetAuthError() const override; bool HasUnrecoverableError() const override; - bool backend_initialized() const override; + bool IsBackendInitialized() const override; sync_driver::OpenTabsUIDelegate* GetOpenTabsUIDelegate() override; bool IsPassphraseRequiredForDecryption() const override; base::Time GetExplicitPassphraseTime() const override; bool IsUsingSecondaryPassphrase() const override; void EnableEncryptEverything() override; - bool EncryptEverythingEnabled() const override; + bool IsEncryptEverythingEnabled() const override; void SetEncryptionPassphrase(const std::string& passphrase, PassphraseType type) override; bool SetDecryptionPassphrase(const std::string& passphrase) override @@ -451,7 +451,7 @@ class ProfileSyncService : public sync_driver::SyncService, const std::string& message) override; // The functions below (until ActivateDataType()) should only be - // called if backend_initialized() is true. + // called if IsBackendInitialized() is true. // TODO(akalin): These two functions are used only by // ProfileSyncServiceHarness. Figure out a different way to expose @@ -506,7 +506,7 @@ class ProfileSyncService : public sync_driver::SyncService, // Returns true if encrypting all the sync data is allowed. If this method // returns false, EnableEncryptEverything() should not be called. - virtual bool EncryptEverythingAllowed() const; + virtual bool IsEncryptEverythingAllowed() const; // Sets whether encrypting all the sync data is allowed or not. virtual void SetEncryptEverythingAllowed(bool allowed); diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc index abf87e5..1c0d48e 100644 --- a/chrome/browser/sync/profile_sync_service_android.cc +++ b/chrome/browser/sync/profile_sync_service_android.cc @@ -183,24 +183,24 @@ jint ProfileSyncServiceAndroid::GetAuthError(JNIEnv* env, jobject) { jboolean ProfileSyncServiceAndroid::IsEncryptEverythingEnabled( JNIEnv* env, jobject) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - return sync_service_->EncryptEverythingEnabled(); + return sync_service_->IsEncryptEverythingEnabled(); } jboolean ProfileSyncServiceAndroid::IsSyncInitialized(JNIEnv* env, jobject) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - return sync_service_->backend_initialized(); + return sync_service_->IsBackendInitialized(); } jboolean ProfileSyncServiceAndroid::IsFirstSetupInProgress( JNIEnv* env, jobject) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - return sync_service_->FirstSetupInProgress(); + return sync_service_->IsFirstSetupInProgress(); } jboolean ProfileSyncServiceAndroid::IsEncryptEverythingAllowed( JNIEnv* env, jobject obj) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - return sync_service_->EncryptEverythingAllowed(); + return sync_service_->IsEncryptEverythingAllowed(); } jboolean ProfileSyncServiceAndroid::IsPassphraseRequired(JNIEnv* env, jobject) { diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h index ef26aee..55c44b1 100644 --- a/chrome/browser/sync/profile_sync_service_mock.h +++ b/chrome/browser/sync/profile_sync_service_mock.h @@ -72,8 +72,8 @@ class ProfileSyncServiceMock : public ProfileSyncService { MOCK_METHOD0(GetJsController, base::WeakPtr<syncer::JsController>()); MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool()); - MOCK_CONST_METHOD0(EncryptEverythingAllowed, bool()); - MOCK_CONST_METHOD0(EncryptEverythingEnabled, bool()); + MOCK_CONST_METHOD0(IsEncryptEverythingAllowed, bool()); + MOCK_CONST_METHOD0(IsEncryptEverythingEnabled, bool()); MOCK_METHOD0(EnableEncryptEverything, void()); MOCK_METHOD1(ChangePreferredDataTypes, @@ -87,11 +87,11 @@ class ProfileSyncServiceMock : public ProfileSyncService { MOCK_METHOD1(QueryDetailedSyncStatus, bool(browser_sync::SyncBackendHost::Status* result)); MOCK_CONST_METHOD0(GetAuthError, const GoogleServiceAuthError&()); - MOCK_CONST_METHOD0(FirstSetupInProgress, bool()); + MOCK_CONST_METHOD0(IsFirstSetupInProgress, bool()); MOCK_CONST_METHOD0(GetLastSyncedTimeString, base::string16()); MOCK_CONST_METHOD0(HasUnrecoverableError, bool()); MOCK_CONST_METHOD0(IsSyncActive, bool()); - MOCK_CONST_METHOD0(backend_initialized, bool()); + MOCK_CONST_METHOD0(IsBackendInitialized, bool()); MOCK_CONST_METHOD0(IsSyncRequested, bool()); MOCK_CONST_METHOD0(waiting_for_auth, bool()); MOCK_METHOD1(OnActionableError, void(const syncer::SyncProtocolError&)); diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index cc504aa..64f8127 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -104,7 +104,7 @@ class TestSyncServiceObserver : public sync_driver::SyncServiceObserver { explicit TestSyncServiceObserver(ProfileSyncService* service) : service_(service), first_setup_in_progress_(false) {} void OnStateChanged() override { - first_setup_in_progress_ = service_->FirstSetupInProgress(); + first_setup_in_progress_ = service_->IsFirstSetupInProgress(); } bool first_setup_in_progress() const { return first_setup_in_progress_; } private: diff --git a/chrome/browser/sync/startup_controller.h b/chrome/browser/sync/startup_controller.h index 54ca430..ba7eceb 100644 --- a/chrome/browser/sync/startup_controller.h +++ b/chrome/browser/sync/startup_controller.h @@ -63,7 +63,7 @@ class StartupController { void Reset(const syncer::ModelTypeSet registered_types); void set_setup_in_progress(bool in_progress); - bool setup_in_progress() const { return setup_in_progress_; } + bool IsSetupInProgress() const { return setup_in_progress_; } bool auto_start_enabled() const { return auto_start_enabled_; } base::Time start_backend_time() const { return start_backend_time_; } std::string GetBackendInitializationStateString() const; diff --git a/chrome/browser/sync/startup_controller_unittest.cc b/chrome/browser/sync/startup_controller_unittest.cc index a601759..3148f84 100644 --- a/chrome/browser/sync/startup_controller_unittest.cc +++ b/chrome/browser/sync/startup_controller_unittest.cc @@ -255,7 +255,7 @@ TEST_F(StartupControllerTest, ResetDuringSetup) { controller()->Reset(syncer::UserTypes()); // From the UI's point of view, setup is still in progress. - EXPECT_TRUE(controller()->setup_in_progress()); + EXPECT_TRUE(controller()->IsSetupInProgress()); } } // namespace browser_sync diff --git a/chrome/browser/sync/sync_startup_tracker.cc b/chrome/browser/sync/sync_startup_tracker.cc index b33732c..00d166d8 100644 --- a/chrome/browser/sync/sync_startup_tracker.cc +++ b/chrome/browser/sync/sync_startup_tracker.cc @@ -62,7 +62,7 @@ SyncStartupTracker::SyncServiceState SyncStartupTracker::GetSyncServiceState( } // If the sync backend has started up, notify the callback. - if (service->backend_initialized()) + if (service->IsBackendInitialized()) return SYNC_STARTUP_COMPLETE; // If the sync service has some kind of error, report to the user. diff --git a/chrome/browser/sync/sync_startup_tracker_unittest.cc b/chrome/browser/sync/sync_startup_tracker_unittest.cc index 597e654..cd49e63 100644 --- a/chrome/browser/sync/sync_startup_tracker_unittest.cc +++ b/chrome/browser/sync/sync_startup_tracker_unittest.cc @@ -52,7 +52,7 @@ class SyncStartupTrackerTest : public testing::Test { void SetupNonInitializedPSS() { EXPECT_CALL(*mock_pss_, GetAuthError()) .WillRepeatedly(ReturnRef(no_error_)); - EXPECT_CALL(*mock_pss_, backend_initialized()) + EXPECT_CALL(*mock_pss_, IsBackendInitialized()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) .WillRepeatedly(Return(false)); @@ -67,7 +67,7 @@ class SyncStartupTrackerTest : public testing::Test { }; TEST_F(SyncStartupTrackerTest, SyncAlreadyInitialized) { - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(true)); EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); EXPECT_CALL(observer_, SyncStartupCompleted()); SyncStartupTracker tracker(profile_.get(), &observer_); @@ -76,7 +76,7 @@ TEST_F(SyncStartupTrackerTest, SyncAlreadyInitialized) { TEST_F(SyncStartupTrackerTest, SyncNotSignedIn) { // Make sure that we get a SyncStartupFailed() callback if sync is not logged // in. - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); EXPECT_CALL(observer_, SyncStartupFailed()); SyncStartupTracker tracker(profile_.get(), &observer_); @@ -85,7 +85,7 @@ TEST_F(SyncStartupTrackerTest, SyncNotSignedIn) { TEST_F(SyncStartupTrackerTest, SyncAuthError) { // Make sure that we get a SyncStartupFailed() callback if sync gets an auth // error. - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); @@ -102,7 +102,7 @@ TEST_F(SyncStartupTrackerTest, SyncDelayedInitialization) { SyncStartupTracker tracker(profile_.get(), &observer_); Mock::VerifyAndClearExpectations(&observer_); // Now, mark the PSS as initialized. - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(true)); EXPECT_CALL(observer_, SyncStartupCompleted()); tracker.OnStateChanged(); } @@ -117,7 +117,7 @@ TEST_F(SyncStartupTrackerTest, SyncDelayedAuthError) { Mock::VerifyAndClearExpectations(mock_pss_); // Now, mark the PSS as having an auth error. - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); @@ -136,7 +136,7 @@ TEST_F(SyncStartupTrackerTest, SyncDelayedUnrecoverableError) { Mock::VerifyAndClearExpectations(mock_pss_); // Now, mark the PSS as having an unrecoverable error. - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index 3945ff8..ca2e8ec 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc @@ -238,7 +238,7 @@ MessageType GetStatusInfo(ProfileSyncService* service, } else { // Either show auth error information with a link to re-login, auth in prog, // or provide a link to continue with setup. - if (service->FirstSetupInProgress()) { + if (service->IsFirstSetupInProgress()) { result_type = PRE_SYNCED; ProfileSyncService::Status status; service->QueryDetailedSyncStatus(&status); diff --git a/chrome/browser/sync/sync_ui_util_unittest.cc b/chrome/browser/sync/sync_ui_util_unittest.cc index bc81776..39912ad 100644 --- a/chrome/browser/sync/sync_ui_util_unittest.cc +++ b/chrome/browser/sync/sync_ui_util_unittest.cc @@ -213,7 +213,7 @@ void GetDistinctCase(ProfileSyncServiceMock& service, case STATUS_CASE_SETUP_IN_PROGRESS: { EXPECT_CALL(service, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); - EXPECT_CALL(service, FirstSetupInProgress()) + EXPECT_CALL(service, IsFirstSetupInProgress()) .WillRepeatedly(Return(true)); browser_sync::SyncBackendHost::Status status; EXPECT_CALL(service, QueryDetailedSyncStatus(_)) @@ -224,7 +224,7 @@ void GetDistinctCase(ProfileSyncServiceMock& service, case STATUS_CASE_SETUP_ERROR: { EXPECT_CALL(service, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); - EXPECT_CALL(service, FirstSetupInProgress()) + EXPECT_CALL(service, IsFirstSetupInProgress()) .WillRepeatedly(Return(false)); EXPECT_CALL(service, HasUnrecoverableError()) .WillRepeatedly(Return(true)); diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc index 2f4b4b0..1e39457 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc @@ -58,7 +58,7 @@ class BackendInitializeChecker : public SingleClientStatusChangeChecker { bool IsExitConditionSatisfied() override { if (service()->backend_mode() != ProfileSyncService::SYNC) return false; - if (service()->backend_initialized()) + if (service()->IsBackendInitialized()) return true; // Backend initialization is blocked by an auth error. if (HasAuthError(service())) @@ -255,7 +255,7 @@ bool ProfileSyncServiceHarness::AwaitBackendInitialization() { return false; } - if (!service()->backend_initialized()) { + if (!service()->IsBackendInitialized()) { LOG(ERROR) << "Service backend not initialized."; return false; } @@ -305,7 +305,7 @@ std::string ProfileSyncServiceHarness::GenerateFakeOAuth2RefreshTokenString() { } bool ProfileSyncServiceHarness::IsSyncDisabled() const { - return !service()->setup_in_progress() && + return !service()->IsSetupInProgress() && !service()->HasSyncSetupCompleted(); } diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.h b/chrome/browser/sync/test/integration/profile_sync_service_harness.h index 6c8f792..8a3dba4 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.h +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.h @@ -76,7 +76,7 @@ class ProfileSyncServiceHarness { // Blocks the caller until the sync backend is initialized or some end state // (e.g., auth error) is reached. Returns true if and only if the backend - // initialized successfully. See ProfileSyncService's backend_initialized() + // initialized successfully. See ProfileSyncService's IsBackendInitialized() // method for the definition of backend initialization. bool AwaitBackendInitialization(); diff --git a/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc b/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc index d06a480..c90101d 100644 --- a/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc +++ b/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc @@ -15,7 +15,7 @@ namespace { // Returns true if this service is disabled. bool IsSyncDisabled(ProfileSyncService* service) { - return !service->setup_in_progress() && !service->HasSyncSetupCompleted(); + return !service->IsSetupInProgress() && !service->HasSyncSetupCompleted(); } // Returns true if these services have matching progress markers. diff --git a/chrome/browser/sync/test/integration/sync_errors_test.cc b/chrome/browser/sync/test/integration/sync_errors_test.cc index 12d19c6..ab4a965 100644 --- a/chrome/browser/sync/test/integration/sync_errors_test.cc +++ b/chrome/browser/sync/test/integration/sync_errors_test.cc @@ -29,7 +29,7 @@ class SyncDisabledChecker : public SingleClientStatusChangeChecker { : SingleClientStatusChangeChecker(service) {} bool IsExitConditionSatisfied() override { - return !service()->setup_in_progress() && + return !service()->IsSetupInProgress() && !service()->HasSyncSetupCompleted(); } diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 0fff27b..138bfef 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -124,7 +124,8 @@ class SyncServerStatusChecker : public net::URLFetcherDelegate { }; bool IsEncryptionComplete(const ProfileSyncService* service) { - return service->EncryptEverythingEnabled() && !service->encryption_pending(); + return service->IsEncryptEverythingEnabled() && + !service->encryption_pending(); } // Helper class to wait for encryption to complete. diff --git a/chrome/browser/ui/sync/one_click_signin_sync_observer.cc b/chrome/browser/ui/sync/one_click_signin_sync_observer.cc index ff8169e..9e79c31 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_observer.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_observer.cc @@ -73,7 +73,7 @@ void OneClickSigninSyncObserver::OnStateChanged() { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&CloseTab, base::Unretained(web_contents()))); } else { - if (sync_service->FirstSetupInProgress()) { + if (sync_service->IsFirstSetupInProgress()) { // Sync setup has not completed yet. Wait for it to complete. return; } diff --git a/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc b/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc index b07d6ff..2cab4fc 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_observer_unittest.cc @@ -54,7 +54,7 @@ class OneClickTestProfileSyncService : public TestProfileSyncService { new OneClickTestProfileSyncService(static_cast<Profile*>(profile))); } - bool FirstSetupInProgress() const override { + bool IsFirstSetupInProgress() const override { return first_setup_in_progress_; } diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 5daf70e..1a458ca 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -1512,7 +1512,7 @@ BrowserOptionsHandler::GetSyncStateDictionary() { sync_status->SetBoolean("setupCompleted", service && service->HasSyncSetupCompleted()); sync_status->SetBoolean("setupInProgress", - service && !service->IsManaged() && service->FirstSetupInProgress()); + service && !service->IsManaged() && service->IsFirstSetupInProgress()); base::string16 status_label; base::string16 link_label; diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.cc b/chrome/browser/ui/webui/options/sync_setup_handler.cc index dc4c065..a2f8469 100644 --- a/chrome/browser/ui/webui/options/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/options/sync_setup_handler.cc @@ -457,7 +457,7 @@ void SyncSetupHandler::SyncStartupFailed() { void SyncSetupHandler::SyncStartupCompleted() { ProfileSyncService* service = GetSyncService(); - DCHECK(service->backend_initialized()); + DCHECK(service->IsBackendInitialized()); // Stop a timer to handle timeout in waiting for checking network connection. backend_start_timer_.reset(); @@ -501,7 +501,7 @@ void SyncSetupHandler::HandleConfigure(const base::ListValue* args) { // If the sync engine has shutdown for some reason, just close the sync // dialog. - if (!service || !service->backend_initialized()) { + if (!service || !service->IsBackendInitialized()) { CloseUI(); return; } @@ -522,7 +522,7 @@ void SyncSetupHandler::HandleConfigure(const base::ListValue* args) { // Don't allow "encrypt all" if the ProfileSyncService doesn't allow it. // The UI is hidden, but the user may have enabled it e.g. by fiddling with // the web inspector. - if (!service->EncryptEverythingAllowed()) + if (!service->IsEncryptEverythingAllowed()) configuration.encrypt_all = false; // Note: Data encryption will not occur until configuration is complete @@ -697,7 +697,7 @@ void SyncSetupHandler::CloseSyncSetup() { // Sign out the user on desktop Chrome if they click cancel during // initial setup. // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. - if (sync_service->FirstSetupInProgress()) { + if (sync_service->IsFirstSetupInProgress()) { SigninManagerFactory::GetForProfile(GetProfile())->SignOut( signin_metrics::ABORT_SIGNIN); } @@ -803,7 +803,7 @@ void SyncSetupHandler::DisplayConfigureSync(bool passphrase_failed) { GetProfile())->IsAuthenticated()); ProfileSyncService* service = GetSyncService(); DCHECK(service); - if (!service->backend_initialized()) { + if (!service->IsBackendInitialized()) { service->RequestStart(); // See if it's even possible to bring up the sync backend - if not @@ -825,8 +825,8 @@ void SyncSetupHandler::DisplayConfigureSync(bool passphrase_failed) { // longer need a SyncStartupTracker. sync_startup_tracker_.reset(); configuring_sync_ = true; - DCHECK(service->backend_initialized()) << - "Cannot configure sync until the sync backend is initialized"; + DCHECK(service->IsBackendInitialized()) + << "Cannot configure sync until the sync backend is initialized"; // Setup args for the sync configure screen: // syncAllDataTypes: true if the user wants to sync everything @@ -860,8 +860,9 @@ void SyncSetupHandler::DisplayConfigureSync(bool passphrase_failed) { args.SetBoolean("passphraseFailed", passphrase_failed); args.SetBoolean("syncAllDataTypes", sync_prefs.HasKeepEverythingSynced()); args.SetBoolean("syncNothing", false); // Always false during initial setup. - args.SetBoolean("encryptAllData", service->EncryptEverythingEnabled()); - args.SetBoolean("encryptAllDataAllowed", service->EncryptEverythingAllowed()); + args.SetBoolean("encryptAllData", service->IsEncryptEverythingEnabled()); + args.SetBoolean("encryptAllDataAllowed", + service->IsEncryptEverythingAllowed()); // We call IsPassphraseRequired() here, instead of calling // IsPassphraseRequiredForDecryption(), because we want to show the passphrase diff --git a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc index 1af7560..233d473 100644 --- a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc +++ b/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc @@ -214,23 +214,24 @@ class SyncSetupHandlerTest : public testing::Test { // Setup the expectations for calls made when displaying the config page. void SetDefaultExpectationsForConfigPage() { EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_pss_, GetRegisteredDataTypes()). - WillRepeatedly(Return(GetAllTypes())); - EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()). - WillRepeatedly(Return(GetAllTypes())); - EXPECT_CALL(*mock_pss_, GetActiveDataTypes()). - WillRepeatedly(Return(GetAllTypes())); - EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). - WillRepeatedly(Return(true)); - EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()). - WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, GetRegisteredDataTypes()) + .WillRepeatedly(Return(GetAllTypes())); + EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()) + .WillRepeatedly(Return(GetAllTypes())); + EXPECT_CALL(*mock_pss_, GetActiveDataTypes()) + .WillRepeatedly(Return(GetAllTypes())); + EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) + .WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, IsEncryptEverythingEnabled()) + .WillRepeatedly(Return(false)); } void SetupInitializedProfileSyncService() { // An initialized ProfileSyncService will have already completed sync setup // and will have an initialized sync backend. ASSERT_TRUE(mock_signin_->IsInitialized()); - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()) + .WillRepeatedly(Return(true)); } void ExpectConfig() { @@ -362,7 +363,7 @@ TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); // We're simulating a user setting up sync, which would cause the backend to // kick off initialization, but not download user data types. The sync @@ -389,8 +390,7 @@ TEST_F(SyncSetupHandlerTest, .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); // Sync backend is stopped initially, and will start up. - EXPECT_CALL(*mock_pss_, backend_initialized()) - .WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); SetDefaultExpectationsForConfigPage(); handler_->OpenSyncSetup(); @@ -407,8 +407,7 @@ TEST_F(SyncSetupHandlerTest, Mock::VerifyAndClearExpectations(mock_pss_); // Now, act as if the ProfileSyncService has started up. SetDefaultExpectationsForConfigPage(); - EXPECT_CALL(*mock_pss_, backend_initialized()) - .WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(true)); error_ = GoogleServiceAuthError::AuthErrorNone(); EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); NotifySyncListeners(); @@ -441,7 +440,7 @@ TEST_F(SyncSetupHandlerTest, EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); - EXPECT_CALL(*mock_pss_, backend_initialized()) + EXPECT_CALL(*mock_pss_, IsBackendInitialized()) .WillOnce(Return(false)) .WillRepeatedly(Return(true)); SetDefaultExpectationsForConfigPage(); @@ -467,7 +466,7 @@ TEST_F(SyncSetupHandlerTest, EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) .WillRepeatedly(Return(false)); error_ = GoogleServiceAuthError::AuthErrorNone(); - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); handler_->OpenSyncSetup(); const content::TestWebUI::CallData& data = *web_ui_.call_data()[0]; @@ -577,7 +576,7 @@ TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) { .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(false)); - EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()) + EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) .WillRepeatedly(Return(true)); SetupInitializedProfileSyncService(); EXPECT_CALL(*mock_pss_, EnableEncryptEverything()); @@ -780,7 +779,7 @@ TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) .WillRepeatedly(Return(false)); - EXPECT_CALL(*mock_pss_, backend_initialized()).WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsBackendInitialized()).WillRepeatedly(Return(false)); #if defined(OS_CHROMEOS) // On ChromeOS, auth errors are ignored - instead we just try to start the @@ -939,8 +938,8 @@ TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAll) { .WillRepeatedly(Return(false)); SetupInitializedProfileSyncService(); SetDefaultExpectationsForConfigPage(); - EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()). - WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_pss_, IsEncryptEverythingEnabled()) + .WillRepeatedly(Return(true)); // This should display the sync setup dialog (not login). handler_->OpenSyncSetup(); @@ -959,8 +958,8 @@ TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAllDisallowed) { .WillRepeatedly(Return(false)); SetupInitializedProfileSyncService(); SetDefaultExpectationsForConfigPage(); - EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). - WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) + .WillRepeatedly(Return(false)); // This should display the sync setup dialog (not login). handler_->OpenSyncSetup(); @@ -983,8 +982,8 @@ TEST_F(SyncSetupHandlerTest, TurnOnEncryptAllDisallowed) { EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(false)); SetupInitializedProfileSyncService(); - EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). - WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) + .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); handler_->HandleConfigure(&list_args); diff --git a/components/precache/content/precache_manager.cc b/components/precache/content/precache_manager.cc index 9fc6aa8..3e91b920 100644 --- a/components/precache/content/precache_manager.cc +++ b/components/precache/content/precache_manager.cc @@ -92,7 +92,7 @@ bool PrecacheManager::IsPrecachingAllowed() const { } PrecacheManager::AllowedType PrecacheManager::PrecachingAllowed() const { - if (!(sync_service_ && sync_service_->backend_initialized())) + if (!(sync_service_ && sync_service_->IsBackendInitialized())) return AllowedType::PENDING; // SyncService delegates to SyncPrefs, which must be called on the UI thread. diff --git a/components/sync_driver/fake_sync_service.cc b/components/sync_driver/fake_sync_service.cc index 2635f37..7f7c260c 100644 --- a/components/sync_driver/fake_sync_service.cc +++ b/components/sync_driver/fake_sync_service.cc @@ -69,14 +69,14 @@ void FakeSyncService::OnUserChoseDatatypes(bool sync_everything, void FakeSyncService::SetSyncSetupCompleted() { } -bool FakeSyncService::FirstSetupInProgress() const { +bool FakeSyncService::IsFirstSetupInProgress() const { return false; } void FakeSyncService::SetSetupInProgress(bool setup_in_progress) { } -bool FakeSyncService::setup_in_progress() const { +bool FakeSyncService::IsSetupInProgress() const { return false; } @@ -92,7 +92,7 @@ bool FakeSyncService::HasUnrecoverableError() const { return false; } -bool FakeSyncService::backend_initialized() const { +bool FakeSyncService::IsBackendInitialized() const { return false; } @@ -115,7 +115,7 @@ bool FakeSyncService::IsUsingSecondaryPassphrase() const { void FakeSyncService::EnableEncryptEverything() { } -bool FakeSyncService::EncryptEverythingEnabled() const { +bool FakeSyncService::IsEncryptEverythingEnabled() const { return false; } diff --git a/components/sync_driver/fake_sync_service.h b/components/sync_driver/fake_sync_service.h index 436487e..a714222 100644 --- a/components/sync_driver/fake_sync_service.h +++ b/components/sync_driver/fake_sync_service.h @@ -40,19 +40,19 @@ class FakeSyncService : public sync_driver::SyncService { void OnUserChoseDatatypes(bool sync_everything, syncer::ModelTypeSet chosen_types) override; void SetSyncSetupCompleted() override; - bool FirstSetupInProgress() const override; + bool IsFirstSetupInProgress() const override; void SetSetupInProgress(bool setup_in_progress) override; - bool setup_in_progress() const override; + bool IsSetupInProgress() const override; bool ConfigurationDone() const override; const GoogleServiceAuthError& GetAuthError() const override; bool HasUnrecoverableError() const override; - bool backend_initialized() const override; + bool IsBackendInitialized() const override; OpenTabsUIDelegate* GetOpenTabsUIDelegate() override; bool IsPassphraseRequiredForDecryption() const override; base::Time GetExplicitPassphraseTime() const override; bool IsUsingSecondaryPassphrase() const override; void EnableEncryptEverything() override; - bool EncryptEverythingEnabled() const override; + bool IsEncryptEverythingEnabled() const override; void SetEncryptionPassphrase(const std::string& passphrase, PassphraseType type) override; bool SetDecryptionPassphrase(const std::string& passphrase) override; diff --git a/components/sync_driver/sync_service.h b/components/sync_driver/sync_service.h index 56fe2bc..5e30509 100644 --- a/components/sync_driver/sync_service.h +++ b/components/sync_driver/sync_service.h @@ -156,7 +156,7 @@ class SyncService : public DataTypeEncryptionHandler { // if the user is customizing sync after already completing setup once). // SyncService uses this to determine if it's OK to start syncing, or if the // user is still setting up the initial sync configuration. - virtual bool FirstSetupInProgress() const = 0; + virtual bool IsFirstSetupInProgress() const = 0; // Called by the UI to notify the SyncService that UI is visible so it will // not start syncing. This tells sync whether it's safe to start downloading @@ -169,7 +169,7 @@ class SyncService : public DataTypeEncryptionHandler { virtual void SetSetupInProgress(bool setup_in_progress) = 0; // Used by tests. - virtual bool setup_in_progress() const = 0; + virtual bool IsSetupInProgress() const = 0; // Whether the data types active for the current mode have finished // configuration. @@ -181,7 +181,7 @@ class SyncService : public DataTypeEncryptionHandler { // Returns true if the SyncBackendHost has told us it's ready to accept // changes. This should only be used for sync's internal configuration logic // (such as deciding when to prompt for an encryption passphrase). - virtual bool backend_initialized() const = 0; + virtual bool IsBackendInitialized() const = 0; // Return the active OpenTabsUIDelegate. If sessions is not enabled or not // currently syncing, returns nullptr. @@ -205,7 +205,7 @@ class SyncService : public DataTypeEncryptionHandler { virtual void EnableEncryptEverything() = 0; // Returns true if we are currently set to encrypt all the sync data. - virtual bool EncryptEverythingEnabled() const = 0; + virtual bool IsEncryptEverythingEnabled() const = 0; // Asynchronously sets the passphrase to |passphrase| for encryption. |type| // specifies whether the passphrase is a custom passphrase or the GAIA diff --git a/ios/chrome/browser/sync/sync_setup_service.cc b/ios/chrome/browser/sync/sync_setup_service.cc index bc446ab..9e91e34 100644 --- a/ios/chrome/browser/sync/sync_setup_service.cc +++ b/ios/chrome/browser/sync/sync_setup_service.cc @@ -171,7 +171,7 @@ void SyncSetupService::PrepareForFirstSyncSetup() { } void SyncSetupService::CommitChanges() { - if (sync_service_->FirstSetupInProgress()) { + if (sync_service_->IsFirstSetupInProgress()) { // Turn on the sync setup completed flag only if the user did not turn sync // off. if (sync_service_->CanSyncStart()) { @@ -183,7 +183,7 @@ void SyncSetupService::CommitChanges() { } bool SyncSetupService::HasUncommittedChanges() { - return sync_service_->setup_in_progress(); + return sync_service_->IsSetupInProgress(); } void SyncSetupService::SetSyncEnabledWithoutChangingDatatypes( diff --git a/sync/android/java/src/org/chromium/sync/PassphraseType.java b/sync/android/java/src/org/chromium/sync/PassphraseType.java index 8ef3d5a..8aa5879 100644 --- a/sync/android/java/src/org/chromium/sync/PassphraseType.java +++ b/sync/android/java/src/org/chromium/sync/PassphraseType.java @@ -74,15 +74,15 @@ public enum PassphraseType implements Parcelable { /** * Get the types that are allowed to be enabled from the current type. * - * @param encryptEverythingAllowed Whether encrypting all data is allowed. + * @param isEncryptEverythingAllowed Whether encrypting all data is allowed. */ - public Set<PassphraseType> getAllowedTypes(boolean encryptEverythingAllowed) { + public Set<PassphraseType> getAllowedTypes(boolean isEncryptEverythingAllowed) { Set<PassphraseType> allowedTypes = new HashSet<>(); switch (this) { case IMPLICIT_PASSPHRASE: // Intentional fall through. case KEYSTORE_PASSPHRASE: allowedTypes.add(this); - if (encryptEverythingAllowed) { + if (isEncryptEverythingAllowed) { allowedTypes.add(CUSTOM_PASSPHRASE); } break; diff --git a/sync/internal_api/public/sync_encryption_handler.h b/sync/internal_api/public/sync_encryption_handler.h index 0e7edc5..9dd497d 100644 --- a/sync/internal_api/public/sync_encryption_handler.h +++ b/sync/internal_api/public/sync_encryption_handler.h @@ -184,7 +184,7 @@ class SYNC_EXPORT SyncEncryptionHandler { // Whether encryption of all datatypes is enabled. If false, only sensitive // types are encrypted. - virtual bool EncryptEverythingEnabled() const = 0; + virtual bool IsEncryptEverythingEnabled() const = 0; // Returns the current state of the passphrase needed to decrypt the // bag of encryption keys in the nigori node. diff --git a/sync/internal_api/sync_encryption_handler_impl.cc b/sync/internal_api/sync_encryption_handler_impl.cc index 50f0ed1..b408065 100644 --- a/sync/internal_api/sync_encryption_handler_impl.cc +++ b/sync/internal_api/sync_encryption_handler_impl.cc @@ -636,7 +636,7 @@ void SyncEncryptionHandlerImpl::EnableEncryptEverything() { ReEncryptEverything(&trans); } -bool SyncEncryptionHandlerImpl::EncryptEverythingEnabled() const { +bool SyncEncryptionHandlerImpl::IsEncryptEverythingEnabled() const { DCHECK(thread_checker_.CalledOnValidThread()); return encrypt_everything_; } diff --git a/sync/internal_api/sync_encryption_handler_impl.h b/sync/internal_api/sync_encryption_handler_impl.h index b621484..1335ed6 100644 --- a/sync/internal_api/sync_encryption_handler_impl.h +++ b/sync/internal_api/sync_encryption_handler_impl.h @@ -65,7 +65,7 @@ class SYNC_EXPORT_PRIVATE SyncEncryptionHandlerImpl bool is_explicit) override; void SetDecryptionPassphrase(const std::string& passphrase) override; void EnableEncryptEverything() override; - bool EncryptEverythingEnabled() const override; + bool IsEncryptEverythingEnabled() const override; PassphraseType GetPassphraseType() const override; // NigoriHandler implementation. diff --git a/sync/internal_api/sync_encryption_handler_impl_unittest.cc b/sync/internal_api/sync_encryption_handler_impl_unittest.cc index c25571b..1f18a08 100644 --- a/sync/internal_api/sync_encryption_handler_impl_unittest.cc +++ b/sync/internal_api/sync_encryption_handler_impl_unittest.cc @@ -267,7 +267,7 @@ class SyncEncryptionHandlerImplTest : public ::testing::Test { encryption_handler()->Init(); EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); } @@ -298,7 +298,7 @@ class SyncEncryptionHandlerImplTest : public ::testing::Test { encryption_handler()->Init(); EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), CUSTOM_PASSPHRASE); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); } @@ -333,7 +333,7 @@ class SyncEncryptionHandlerImplTest : public ::testing::Test { encryption_handler()->Init(); EXPECT_FALSE(encryption_handler()->MigratedToKeystore()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), passphrase_type); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); } @@ -452,7 +452,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EncryptEverythingExplicit) { OnEncryptedTypesChanged( HasModelTypes(EncryptableUserTypes()), true)); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); EXPECT_TRUE(encrypted_types.Equals( @@ -465,7 +465,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EncryptEverythingExplicit) { trans.GetWrappedTrans()); } - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); EXPECT_TRUE(encrypted_types.HasAll(EncryptableUserTypes())); @@ -489,7 +489,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EncryptEverythingImplicit) { OnEncryptedTypesChanged( HasModelTypes(EncryptableUserTypes()), true)); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); EXPECT_TRUE(encrypted_types.Equals( @@ -502,7 +502,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EncryptEverythingImplicit) { trans.GetWrappedTrans()); } - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); EXPECT_TRUE(encrypted_types.HasAll(EncryptableUserTypes())); @@ -534,7 +534,7 @@ TEST_F(SyncEncryptionHandlerImplTest, UnknownSensitiveTypes) { OnEncryptedTypesChanged( HasModelTypes(expected_encrypted_types), false)); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); EXPECT_TRUE(encrypted_types.Equals( @@ -547,7 +547,7 @@ TEST_F(SyncEncryptionHandlerImplTest, UnknownSensitiveTypes) { trans.GetWrappedTrans()); } - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); EXPECT_TRUE(encrypted_types.Equals( ModelTypeSet(BOOKMARKS, PASSWORDS, WIFI_CREDENTIALS))); @@ -635,7 +635,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveOldNigori) { GetCryptographer()->CanDecryptUsingDefaultKey( nigori.encryption_keybag())); } - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); } // Ensure setting the keystore key works, updates the bootstrap token, and @@ -907,7 +907,7 @@ TEST_F(SyncEncryptionHandlerImplTest, MigrateOnKeystoreKeyAvailableImplicit) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_EQ(KEYSTORE_PASSPHRASE, encryption_handler()->GetPassphraseType()); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(KEYSTORE_PASSPHRASE, kCurKey); } @@ -958,7 +958,7 @@ TEST_F(SyncEncryptionHandlerImplTest, const base::Time migration_time = encryption_handler()->migration_time(); EXPECT_EQ(FROZEN_IMPLICIT_PASSPHRASE, encryption_handler()->GetPassphraseType()); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(FROZEN_IMPLICIT_PASSPHRASE, kCurKey); // We need the passphrase bootstrap token, but OnBootstrapTokenUpdated(_, @@ -1028,7 +1028,7 @@ TEST_F(SyncEncryptionHandlerImplTest, const base::Time migration_time = encryption_handler()->migration_time(); EXPECT_EQ(CUSTOM_PASSPHRASE, encryption_handler()->GetPassphraseType()); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(CUSTOM_PASSPHRASE, kCurKey); VerifyRestoreAfterCustomPassphrase(TimeToProtoTime(migration_time), kCurKey, @@ -1087,7 +1087,7 @@ TEST_F(SyncEncryptionHandlerImplTest, const base::Time migration_time = encryption_handler()->migration_time(); EXPECT_EQ(CUSTOM_PASSPHRASE, encryption_handler()->GetPassphraseType()); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(CUSTOM_PASSPHRASE, kCurKey); VerifyRestoreAfterCustomPassphrase(TimeToProtoTime(migration_time), kCurKey, @@ -1150,7 +1150,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveMigratedNigoriKeystorePass) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(1, KEYSTORE_PASSPHRASE, kCurKey); // Check that the cryptographer still encrypts with the current key. @@ -1218,7 +1218,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveMigratedNigoriFrozenImplicitPass) { EXPECT_EQ(FROZEN_IMPLICIT_PASSPHRASE, encryption_handler()->GetPassphraseType()); EXPECT_TRUE(GetCryptographer()->has_pending_keys()); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); @@ -1296,7 +1296,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveMigratedNigoriCustomPass) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_EQ(CUSTOM_PASSPHRASE, encryption_handler()->GetPassphraseType()); EXPECT_TRUE(GetCryptographer()->has_pending_keys()); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); @@ -1364,7 +1364,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveUnmigratedNigoriAfterMigration) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), CUSTOM_PASSPHRASE); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(migration_time, CUSTOM_PASSPHRASE, kCurKey); { @@ -1404,7 +1404,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveUnmigratedNigoriAfterMigration) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), CUSTOM_PASSPHRASE); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(1, CUSTOM_PASSPHRASE, kCurKey); // We need the passphrase bootstrap token, but OnBootstrapTokenUpdated(_, @@ -1455,7 +1455,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveOldMigratedNigori) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), CUSTOM_PASSPHRASE); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(1, CUSTOM_PASSPHRASE, kCurKey); { @@ -1502,7 +1502,7 @@ TEST_F(SyncEncryptionHandlerImplTest, ReceiveOldMigratedNigori) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), CUSTOM_PASSPHRASE); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(migration_time, CUSTOM_PASSPHRASE, kCurKey); // We need the passphrase bootstrap token, but OnBootstrapTokenUpdated(_, @@ -1561,7 +1561,7 @@ TEST_F(SyncEncryptionHandlerImplTest, SetKeystoreAfterReceivingMigratedNigori) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->has_pending_keys()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); EXPECT_CALL(*observer(), OnPassphraseAccepted()); @@ -1581,7 +1581,7 @@ TEST_F(SyncEncryptionHandlerImplTest, SetKeystoreAfterReceivingMigratedNigori) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(1, KEYSTORE_PASSPHRASE, kCurKey); // Check that the cryptographer still encrypts with the current key. @@ -1651,7 +1651,7 @@ TEST_F(SyncEncryptionHandlerImplTest, SetCustomPassAfterMigration) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); const char kNewKey[] = "new_key"; @@ -1679,7 +1679,7 @@ TEST_F(SyncEncryptionHandlerImplTest, SetCustomPassAfterMigration) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), CUSTOM_PASSPHRASE); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); EXPECT_FALSE(encryption_handler()->custom_passphrase_time().is_null()); VerifyMigratedNigoriWithTimestamp(migration_time, CUSTOM_PASSPHRASE, kNewKey); @@ -1760,7 +1760,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->has_pending_keys()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); EXPECT_CALL(*observer(), @@ -1773,7 +1773,7 @@ TEST_F(SyncEncryptionHandlerImplTest, OnEncryptionComplete()); encryption_handler()->SetDecryptionPassphrase(kOldKey); EXPECT_TRUE(GetCryptographer()->is_ready()); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); const char kNewKey[] = "new_key"; @@ -1798,7 +1798,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), CUSTOM_PASSPHRASE); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); EXPECT_FALSE(encryption_handler()->custom_passphrase_time().is_null()); VerifyMigratedNigoriWithTimestamp(migration_time, CUSTOM_PASSPHRASE, kNewKey); @@ -1878,7 +1878,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->has_pending_keys()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); EXPECT_CALL(*observer(), @@ -1891,7 +1891,7 @@ TEST_F(SyncEncryptionHandlerImplTest, OnEncryptionComplete()); encryption_handler()->SetDecryptionPassphrase(kOldKey); EXPECT_TRUE(GetCryptographer()->is_ready()); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); // Should get dropped on the floor silently. @@ -1900,7 +1900,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(1, KEYSTORE_PASSPHRASE, kOldKey); // Check that the cryptographer can decrypt the old key. @@ -1973,7 +1973,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->has_pending_keys()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); Mock::VerifyAndClearExpectations(observer()); EXPECT_CALL(*observer(), @@ -2007,7 +2007,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(FROZEN_IMPLICIT_PASSPHRASE, encryption_handler()->GetPassphraseType()); - EXPECT_TRUE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_TRUE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigoriWithTimestamp(1, FROZEN_IMPLICIT_PASSPHRASE, kCurKey); // Check that the cryptographer is encrypting using the frozen current key. @@ -2053,7 +2053,7 @@ TEST_F(SyncEncryptionHandlerImplTest, OnEncryptionComplete()); encryption_handler()->Init(); EXPECT_TRUE(GetCryptographer()->is_ready()); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); { EXPECT_CALL(*observer(), @@ -2100,7 +2100,7 @@ TEST_F(SyncEncryptionHandlerImplTest, EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(KEYSTORE_PASSPHRASE, kCurKey); } @@ -2156,7 +2156,7 @@ TEST_F(SyncEncryptionHandlerImplTest, RotateKeysGaiaDefault) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(KEYSTORE_PASSPHRASE, kKeystoreKey); } @@ -2210,7 +2210,7 @@ TEST_F(SyncEncryptionHandlerImplTest, RotateKeysKeystoreDefault) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(KEYSTORE_PASSPHRASE, kKeystoreKey); } @@ -2293,7 +2293,7 @@ TEST_F(SyncEncryptionHandlerImplTest, RotateKeysGaiaDefaultOnInit) { EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); EXPECT_TRUE(GetCryptographer()->is_ready()); EXPECT_EQ(encryption_handler()->GetPassphraseType(), KEYSTORE_PASSPHRASE); - EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); + EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); VerifyMigratedNigori(KEYSTORE_PASSPHRASE, kKeystoreKey); } diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc index 6aee8e3..04b97b5 100644 --- a/sync/internal_api/sync_manager_impl_unittest.cc +++ b/sync/internal_api/sync_manager_impl_unittest.cc @@ -1046,8 +1046,8 @@ class SyncManagerTest : public testing::Test, // Returns true if we are currently encrypting all sync data. May // be called on any thread. - bool EncryptEverythingEnabledForTest() { - return sync_manager_.GetEncryptionHandler()->EncryptEverythingEnabled(); + bool IsEncryptEverythingEnabledForTest() { + return sync_manager_.GetEncryptionHandler()->IsEncryptEverythingEnabled(); } // Gets the set of encrypted types from the cryptographer @@ -1161,7 +1161,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) { const ModelTypeSet encrypted_types = GetEncryptedTypes(); EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -1190,7 +1190,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionNotReady) { const ModelTypeSet encrypted_types = GetEncryptedTypes(); EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); // Hardcoded. - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); } // Attempt to refresh encryption when nigori is empty. @@ -1206,7 +1206,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) { const ModelTypeSet encrypted_types = GetEncryptedTypes(); EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); // Hardcoded. - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -1228,7 +1228,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithNoData) { HasModelTypes(EncryptableUserTypes()), true)); EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); sync_manager_.GetEncryptionHandler()->EnableEncryptEverything(); - EXPECT_TRUE(EncryptEverythingEnabledForTest()); + EXPECT_TRUE(IsEncryptEverythingEnabledForTest()); } TEST_F(SyncManagerTest, EncryptDataTypesWithData) { @@ -1279,7 +1279,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { HasModelTypes(EncryptableUserTypes()), true)); EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); sync_manager_.GetEncryptionHandler()->EnableEncryptEverything(); - EXPECT_TRUE(EncryptEverythingEnabledForTest()); + EXPECT_TRUE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); EXPECT_TRUE(GetEncryptedTypesWithTrans(&trans).Equals( @@ -1304,7 +1304,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); ExpectPassphraseAcceptance(); SetCustomPassphraseAndCheck("new_passphrase"); - EXPECT_TRUE(EncryptEverythingEnabledForTest()); + EXPECT_TRUE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); EXPECT_TRUE(GetEncryptedTypesWithTrans(&trans).Equals( @@ -1341,7 +1341,7 @@ TEST_F(SyncManagerTest, SetInitialGaiaPass) { OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); ExpectPassphraseAcceptance(); SetImplicitPassphraseAndCheck("new_passphrase"); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); @@ -1370,7 +1370,7 @@ TEST_F(SyncManagerTest, UpdateGaiaPass) { OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); ExpectPassphraseAcceptance(); SetImplicitPassphraseAndCheck("new_passphrase"); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1412,7 +1412,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) { OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); ExpectPassphraseAcceptance(); SetCustomPassphraseAndCheck("new_passphrase"); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1464,7 +1464,7 @@ TEST_F(SyncManagerTest, SupplyPendingGAIAPass) { sync_manager_.GetEncryptionHandler()->SetDecryptionPassphrase("passphrase2"); EXPECT_EQ(IMPLICIT_PASSPHRASE, sync_manager_.GetEncryptionHandler()->GetPassphraseType()); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1517,7 +1517,7 @@ TEST_F(SyncManagerTest, SupplyPendingOldGAIAPass) { EXPECT_CALL(encryption_observer_, OnPassphraseRequired(_,_)); EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_)); SetImplicitPassphraseAndCheck("new_gaia"); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); testing::Mock::VerifyAndClearExpectations(&encryption_observer_); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -1590,7 +1590,7 @@ TEST_F(SyncManagerTest, SupplyPendingExplicitPass) { sync_manager_.GetEncryptionHandler()->SetDecryptionPassphrase("explicit"); EXPECT_EQ(CUSTOM_PASSPHRASE, sync_manager_.GetEncryptionHandler()->GetPassphraseType()); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1628,7 +1628,7 @@ TEST_F(SyncManagerTest, SupplyPendingGAIAPassUserProvided) { OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); ExpectPassphraseAcceptance(); SetImplicitPassphraseAndCheck("passphrase"); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1655,7 +1655,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) { OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); ExpectPassphraseAcceptance(); SetCustomPassphraseAndCheck("new_passphrase"); - EXPECT_FALSE(EncryptEverythingEnabledForTest()); + EXPECT_FALSE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode password_node(&trans); @@ -1744,7 +1744,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { HasModelTypes(EncryptableUserTypes()), true)); EXPECT_CALL(encryption_observer_, OnEncryptionComplete()); sync_manager_.GetEncryptionHandler()->EnableEncryptEverything(); - EXPECT_TRUE(EncryptEverythingEnabledForTest()); + EXPECT_TRUE(IsEncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); diff --git a/sync/internal_api/sync_rollback_manager_base.cc b/sync/internal_api/sync_rollback_manager_base.cc index ab2d97e..0134422 100644 --- a/sync/internal_api/sync_rollback_manager_base.cc +++ b/sync/internal_api/sync_rollback_manager_base.cc @@ -26,7 +26,7 @@ class DummyEntryptionHandler : public syncer::SyncEncryptionHandler { bool is_explicit) override {} void SetDecryptionPassphrase(const std::string& passphrase) override {} void EnableEncryptEverything() override {} - bool EncryptEverythingEnabled() const override { return false; } + bool IsEncryptEverythingEnabled() const override { return false; } syncer::PassphraseType GetPassphraseType() const override { return syncer::KEYSTORE_PASSPHRASE; } diff --git a/sync/test/fake_sync_encryption_handler.cc b/sync/test/fake_sync_encryption_handler.cc index 3a60b07..d524e60 100644 --- a/sync/test/fake_sync_encryption_handler.cc +++ b/sync/test/fake_sync_encryption_handler.cc @@ -118,7 +118,7 @@ void FakeSyncEncryptionHandler::EnableEncryptEverything() { OnEncryptedTypesChanged(encrypted_types_, encrypt_everything_)); } -bool FakeSyncEncryptionHandler::EncryptEverythingEnabled() const { +bool FakeSyncEncryptionHandler::IsEncryptEverythingEnabled() const { return encrypt_everything_; } diff --git a/sync/test/fake_sync_encryption_handler.h b/sync/test/fake_sync_encryption_handler.h index c3ba20d..7853947 100644 --- a/sync/test/fake_sync_encryption_handler.h +++ b/sync/test/fake_sync_encryption_handler.h @@ -36,7 +36,7 @@ class FakeSyncEncryptionHandler : public SyncEncryptionHandler, bool is_explicit) override; void SetDecryptionPassphrase(const std::string& passphrase) override; void EnableEncryptEverything() override; - bool EncryptEverythingEnabled() const override; + bool IsEncryptEverythingEnabled() const override; PassphraseType GetPassphraseType() const override; // NigoriHandler implemenation. |