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

Side by Side Diff: chrome/browser/ui/webui/options/sync_setup_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/options/sync_setup_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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 args.SetBoolean("encryptAllData", service->IsEncryptEverythingEnabled()); 886 args.SetBoolean("encryptAllData", service->IsEncryptEverythingEnabled());
887 args.SetBoolean("encryptAllDataAllowed", 887 args.SetBoolean("encryptAllDataAllowed",
888 service->IsEncryptEverythingAllowed()); 888 service->IsEncryptEverythingAllowed());
889 889
890 // We call IsPassphraseRequired() here, instead of calling 890 // We call IsPassphraseRequired() here, instead of calling
891 // IsPassphraseRequiredForDecryption(), because we want to show the passphrase 891 // IsPassphraseRequiredForDecryption(), because we want to show the passphrase
892 // UI even if no encrypted data types are enabled. 892 // UI even if no encrypted data types are enabled.
893 args.SetBoolean("showPassphrase", service->IsPassphraseRequired()); 893 args.SetBoolean("showPassphrase", service->IsPassphraseRequired());
894 894
895 // To distinguish between FROZEN_IMPLICIT_PASSPHRASE and CUSTOM_PASSPHRASE 895 // To distinguish between FROZEN_IMPLICIT_PASSPHRASE and CUSTOM_PASSPHRASE
896 // we only set usePassphrase for CUSTOM_PASSPHRASE. 896 // we only set usePassphrase for PassphraseType::CUSTOM_PASSPHRASE.
897 args.SetBoolean("usePassphrase", 897 args.SetBoolean("usePassphrase",
898 service->GetPassphraseType() == syncer::CUSTOM_PASSPHRASE); 898 service->GetPassphraseType() ==
899 syncer::PassphraseType::CUSTOM_PASSPHRASE);
899 base::Time passphrase_time = service->GetExplicitPassphraseTime(); 900 base::Time passphrase_time = service->GetExplicitPassphraseTime();
900 syncer::PassphraseType passphrase_type = service->GetPassphraseType(); 901 syncer::PassphraseType passphrase_type = service->GetPassphraseType();
901 if (!passphrase_time.is_null()) { 902 if (!passphrase_time.is_null()) {
902 base::string16 passphrase_time_str = 903 base::string16 passphrase_time_str =
903 base::TimeFormatShortDate(passphrase_time); 904 base::TimeFormatShortDate(passphrase_time);
904 args.SetString( 905 args.SetString(
905 "enterPassphraseBody", 906 "enterPassphraseBody",
906 GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE, 907 GetStringFUTF16(IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE,
907 passphrase_time_str)); 908 passphrase_time_str));
908 args.SetString( 909 args.SetString(
909 "enterGooglePassphraseBody", 910 "enterGooglePassphraseBody",
910 GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE, 911 GetStringFUTF16(IDS_SYNC_ENTER_GOOGLE_PASSPHRASE_BODY_WITH_DATE,
911 passphrase_time_str)); 912 passphrase_time_str));
912 switch (passphrase_type) { 913 switch (passphrase_type) {
913 case syncer::FROZEN_IMPLICIT_PASSPHRASE: 914 case syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE:
914 args.SetString( 915 args.SetString(
915 "fullEncryptionBody", 916 "fullEncryptionBody",
916 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE, 917 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_GOOGLE_WITH_DATE,
917 passphrase_time_str)); 918 passphrase_time_str));
918 break; 919 break;
919 case syncer::CUSTOM_PASSPHRASE: 920 case syncer::PassphraseType::CUSTOM_PASSPHRASE:
920 args.SetString( 921 args.SetString(
921 "fullEncryptionBody", 922 "fullEncryptionBody",
922 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE, 923 GetStringFUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE,
923 passphrase_time_str)); 924 passphrase_time_str));
924 break; 925 break;
925 default: 926 default:
926 args.SetString( 927 args.SetString(
927 "fullEncryptionBody", 928 "fullEncryptionBody",
928 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); 929 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM));
929 break; 930 break;
930 } 931 }
931 } else if (passphrase_type == syncer::CUSTOM_PASSPHRASE) { 932 } else if (passphrase_type == syncer::PassphraseType::CUSTOM_PASSPHRASE) {
932 args.SetString( 933 args.SetString(
933 "fullEncryptionBody", 934 "fullEncryptionBody",
934 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM)); 935 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM));
935 } else { 936 } else {
936 args.SetString( 937 args.SetString(
937 "fullEncryptionBody", 938 "fullEncryptionBody",
938 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_DATA)); 939 GetStringUTF16(IDS_SYNC_FULL_ENCRYPTION_DATA));
939 } 940 }
940 941
941 base::StringValue page("configure"); 942 base::StringValue page("configure");
942 web_ui()->CallJavascriptFunctionUnsafe("SyncSetupOverlay.showSyncSetupPage", 943 web_ui()->CallJavascriptFunctionUnsafe("SyncSetupOverlay.showSyncSetupPage",
943 page, args); 944 page, args);
944 945
945 // Make sure the tab used for the Gaia sign in does not cover the settings 946 // Make sure the tab used for the Gaia sign in does not cover the settings
946 // tab. 947 // tab.
947 FocusUI(); 948 FocusUI();
948 } 949 }
949 950
950 LoginUIService* SyncSetupHandler::GetLoginUIService() const { 951 LoginUIService* SyncSetupHandler::GetLoginUIService() const {
951 return LoginUIServiceFactory::GetForProfile(GetProfile()); 952 return LoginUIServiceFactory::GetForProfile(GetProfile());
952 } 953 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_android.cc ('k') | chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698