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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 665223007: Add a flag to ProfileSyncService that says whether encrypting all data is allowed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years, 1 month 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/sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/sync_setup_handler.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 args.SetBoolean(key_name + "Enforced", enforced_types.Has(sync_type)); 368 args.SetBoolean(key_name + "Enforced", enforced_types.Has(sync_type));
369 // TODO(treib): How do we want to handle pref groups, i.e. when only some of 369 // TODO(treib): How do we want to handle pref groups, i.e. when only some of
370 // the sync types behind a checkbox are force-enabled? crbug.com/403326 370 // the sync types behind a checkbox are force-enabled? crbug.com/403326
371 } 371 }
372 sync_driver::SyncPrefs sync_prefs(GetProfile()->GetPrefs()); 372 sync_driver::SyncPrefs sync_prefs(GetProfile()->GetPrefs());
373 args.SetBoolean("passphraseFailed", passphrase_failed); 373 args.SetBoolean("passphraseFailed", passphrase_failed);
374 args.SetBoolean("showSyncEverythingPage", !show_advanced); 374 args.SetBoolean("showSyncEverythingPage", !show_advanced);
375 args.SetBoolean("syncAllDataTypes", sync_prefs.HasKeepEverythingSynced()); 375 args.SetBoolean("syncAllDataTypes", sync_prefs.HasKeepEverythingSynced());
376 args.SetBoolean("syncNothing", false); // Always false during initial setup. 376 args.SetBoolean("syncNothing", false); // Always false during initial setup.
377 args.SetBoolean("encryptAllData", service->EncryptEverythingEnabled()); 377 args.SetBoolean("encryptAllData", service->EncryptEverythingEnabled());
378 args.SetBoolean("isSupervised", GetProfile()->IsSupervised()); 378 args.SetBoolean("encryptAllDataAllowed", service->EncryptEverythingAllowed());
379 379
380 // We call IsPassphraseRequired() here, instead of calling 380 // We call IsPassphraseRequired() here, instead of calling
381 // IsPassphraseRequiredForDecryption(), because we want to show the passphrase 381 // IsPassphraseRequiredForDecryption(), because we want to show the passphrase
382 // UI even if no encrypted data types are enabled. 382 // UI even if no encrypted data types are enabled.
383 args.SetBoolean("showPassphrase", service->IsPassphraseRequired()); 383 args.SetBoolean("showPassphrase", service->IsPassphraseRequired());
384 384
385 // To distinguish between FROZEN_IMPLICIT_PASSPHRASE and CUSTOM_PASSPHRASE 385 // To distinguish between FROZEN_IMPLICIT_PASSPHRASE and CUSTOM_PASSPHRASE
386 // we only set usePassphrase for CUSTOM_PASSPHRASE. 386 // we only set usePassphrase for CUSTOM_PASSPHRASE.
387 args.SetBoolean("usePassphrase", 387 args.SetBoolean("usePassphrase",
388 service->GetPassphraseType() == syncer::CUSTOM_PASSPHRASE); 388 service->GetPassphraseType() == syncer::CUSTOM_PASSPHRASE);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // suppresses sync startup in addition to disabling it. 675 // suppresses sync startup in addition to disabling it.
676 if (configuration.sync_nothing) { 676 if (configuration.sync_nothing) {
677 ProfileSyncService::SyncEvent( 677 ProfileSyncService::SyncEvent(
678 ProfileSyncService::STOP_FROM_ADVANCED_DIALOG); 678 ProfileSyncService::STOP_FROM_ADVANCED_DIALOG);
679 CloseUI(); 679 CloseUI();
680 service->StopSyncingPermanently(); 680 service->StopSyncingPermanently();
681 service->SetSetupInProgress(false); 681 service->SetSetupInProgress(false);
682 return; 682 return;
683 } 683 }
684 684
685 // Don't allow supervised users to enable "encrypt all". The UI is hidden, 685 // Don't allow "encrypt all" if the ProfileSyncService doesn't allow it.
686 // but the user may have enabled it e.g. by fiddling with the web inspector. 686 // The UI is hidden, but the user may have enabled it e.g. by fiddling with
687 if (GetProfile()->IsSupervised()) 687 // the web inspector.
688 if (!service->EncryptEverythingAllowed())
688 configuration.encrypt_all = false; 689 configuration.encrypt_all = false;
689 690
690 // Note: Data encryption will not occur until configuration is complete 691 // Note: Data encryption will not occur until configuration is complete
691 // (when the PSS receives its CONFIGURE_DONE notification from the sync 692 // (when the PSS receives its CONFIGURE_DONE notification from the sync
692 // backend), so the user still has a chance to cancel out of the operation 693 // backend), so the user still has a chance to cancel out of the operation
693 // if (for example) some kind of passphrase error is encountered. 694 // if (for example) some kind of passphrase error is encountered.
694 if (configuration.encrypt_all) 695 if (configuration.encrypt_all)
695 service->EnableEncryptEverything(); 696 service->EnableEncryptEverything();
696 697
697 bool passphrase_failed = false; 698 bool passphrase_failed = false;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 959
959 LoginUIService* service = GetLoginUIService(); 960 LoginUIService* service = GetLoginUIService();
960 DCHECK(service); 961 DCHECK(service);
961 service->current_login_ui()->FocusUI(); 962 service->current_login_ui()->FocusUI();
962 return true; 963 return true;
963 } 964 }
964 965
965 LoginUIService* SyncSetupHandler::GetLoginUIService() const { 966 LoginUIService* SyncSetupHandler::GetLoginUIService() const {
966 return LoginUIServiceFactory::GetForProfile(GetProfile()); 967 return LoginUIServiceFactory::GetForProfile(GetProfile());
967 } 968 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/sync_setup_handler.h ('k') | chrome/browser/ui/webui/sync_setup_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698