Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: chrome/browser/ui/webui/settings/people_handler.cc

Issue 2279713002: Make PassphraseType a "enum class" instead of "enum". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix java Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/settings/people_handler.h" 5 #include "chrome/browser/ui/webui/settings/people_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 pref_service->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled)); 817 pref_service->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled));
818 args.SetBoolean("encryptAllData", service->IsEncryptEverythingEnabled()); 818 args.SetBoolean("encryptAllData", service->IsEncryptEverythingEnabled());
819 args.SetBoolean("encryptAllDataAllowed", 819 args.SetBoolean("encryptAllDataAllowed",
820 service->IsEncryptEverythingAllowed()); 820 service->IsEncryptEverythingAllowed());
821 821
822 // We call IsPassphraseRequired() here, instead of calling 822 // We call IsPassphraseRequired() here, instead of calling
823 // IsPassphraseRequiredForDecryption(), because we want to show the passphrase 823 // IsPassphraseRequiredForDecryption(), because we want to show the passphrase
824 // UI even if no encrypted data types are enabled. 824 // UI even if no encrypted data types are enabled.
825 args.SetBoolean("passphraseRequired", service->IsPassphraseRequired()); 825 args.SetBoolean("passphraseRequired", service->IsPassphraseRequired());
826 826
827 // To distinguish between FROZEN_IMPLICIT_PASSPHRASE and CUSTOM_PASSPHRASE 827 // To distinguish between PassphraseType::FROZEN_IMPLICIT_PASSPHRASE and
828 // we only set passphraseTypeIsCustom for CUSTOM_PASSPHRASE. 828 // PassphraseType::CUSTOM_PASSPHRASE
829 // we only set passphraseTypeIsCustom for PassphraseType::CUSTOM_PASSPHRASE.
829 args.SetBoolean("passphraseTypeIsCustom", 830 args.SetBoolean("passphraseTypeIsCustom",
830 service->GetPassphraseType() == syncer::CUSTOM_PASSPHRASE); 831 service->GetPassphraseType() ==
832 syncer::PassphraseType::CUSTOM_PASSPHRASE);
831 base::Time passphrase_time = service->GetExplicitPassphraseTime(); 833 base::Time passphrase_time = service->GetExplicitPassphraseTime();
832 syncer::PassphraseType passphrase_type = service->GetPassphraseType(); 834 syncer::PassphraseType passphrase_type = service->GetPassphraseType();
833 if (!passphrase_time.is_null()) { 835 if (!passphrase_time.is_null()) {
834 base::string16 passphrase_time_str = 836 base::string16 passphrase_time_str =
835 base::TimeFormatShortDate(passphrase_time); 837 base::TimeFormatShortDate(passphrase_time);
836 args.SetString("enterPassphraseBody", 838 args.SetString("enterPassphraseBody",
837 GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE, 839 GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE,
838 passphrase_time_str)); 840 passphrase_time_str));
839 args.SetString( 841 args.SetString(
840 "enterGooglePassphraseBody", 842 "enterGooglePassphraseBody",
841 GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, 843 GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE,
842 passphrase_time_str)); 844 passphrase_time_str));
843 switch (passphrase_type) { 845 switch (passphrase_type) {
844 case syncer::FROZEN_IMPLICIT_PASSPHRASE: 846 case syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE:
845 args.SetString( 847 args.SetString(
846 "fullEncryptionBody", 848 "fullEncryptionBody",
847 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE, 849 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE,
848 passphrase_time_str)); 850 passphrase_time_str));
849 break; 851 break;
850 case syncer::CUSTOM_PASSPHRASE: 852 case syncer::PassphraseType::CUSTOM_PASSPHRASE:
851 args.SetString( 853 args.SetString(
852 "fullEncryptionBody", 854 "fullEncryptionBody",
853 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE, 855 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE,
854 passphrase_time_str)); 856 passphrase_time_str));
855 break; 857 break;
856 default: 858 default:
857 args.SetString("fullEncryptionBody", 859 args.SetString("fullEncryptionBody",
858 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); 860 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM));
859 break; 861 break;
860 } 862 }
861 } else if (passphrase_type == syncer::CUSTOM_PASSPHRASE) { 863 } else if (passphrase_type == syncer::PassphraseType::CUSTOM_PASSPHRASE) {
862 args.SetString("fullEncryptionBody", 864 args.SetString("fullEncryptionBody",
863 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); 865 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM));
864 } else { 866 } else {
865 args.SetString("fullEncryptionBody", 867 args.SetString("fullEncryptionBody",
866 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_DATA)); 868 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_DATA));
867 } 869 }
868 870
869 CallJavascriptFunction("cr.webUIListenerCallback", 871 CallJavascriptFunction("cr.webUIListenerCallback",
870 base::StringValue("sync-prefs-changed"), args); 872 base::StringValue("sync-prefs-changed"), args);
871 } 873 }
(...skipping 22 matching lines...) Expand all
894 base::FilePath profile_file_path = profile_->GetPath(); 896 base::FilePath profile_file_path = profile_->GetPath();
895 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); 897 ProfileMetrics::LogProfileSyncSignIn(profile_file_path);
896 898
897 // We're done configuring, so notify ProfileSyncService that it is OK to 899 // We're done configuring, so notify ProfileSyncService that it is OK to
898 // start syncing. 900 // start syncing.
899 sync_blocker_.reset(); 901 sync_blocker_.reset();
900 service->SetFirstSetupComplete(); 902 service->SetFirstSetupComplete();
901 } 903 }
902 904
903 } // namespace settings 905 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698