| Index: chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
|
| diff --git a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
|
| index 4ae2a93a032d00d45fd7be6c265a580912642cd3..6949c0b935540b1b21ffa0f48d420231fb4969d6 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
|
| +++ b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h
|
| @@ -8,6 +8,8 @@
|
| #include "base/macros.h"
|
| #include "chrome/browser/chromeos/login/screens/encryption_migration_screen_view.h"
|
| #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
|
| +#include "chromeos/login/auth/user_context.h"
|
| +#include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h"
|
|
|
| namespace chromeos {
|
|
|
| @@ -18,20 +20,58 @@ class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView,
|
| EncryptionMigrationScreenHandler();
|
| ~EncryptionMigrationScreenHandler() override;
|
|
|
| - // EncryptionMigrationScreenView:
|
| + // EncryptionMigrationScreenView implementation:
|
| void Show() override;
|
| void Hide() override;
|
| void SetDelegate(Delegate* delegate) override;
|
| + void SetUserContext(const UserContext& user_context) override;
|
|
|
| - // BaseScreenHandler:
|
| + // BaseScreenHandler implementation:
|
| void DeclareLocalizedValues(
|
| ::login::LocalizedValuesBuilder* builder) override;
|
| void Initialize() override;
|
|
|
| private:
|
| + // Enumeration for the migration state. These values must be kept in sync with
|
| + // EncryptionMigrationUIState in JS code.
|
| + enum UIState {
|
| + INITIAL = 0,
|
| + MIGRATING = 1,
|
| + MIGRATION_SUCCEEDED = 2,
|
| + MIGRATION_FAILED = 3
|
| + };
|
| +
|
| + // WebUIMessageHandler implementation:
|
| + void RegisterMessages() override;
|
| +
|
| + // Handlers for JS API callbacks.
|
| + void HandleStartMigration();
|
| + void HandleRequestRestart();
|
| +
|
| + // Updates UI state.
|
| + void UpdateUIState(UIState state);
|
| +
|
| + // Requests cryptohome to start encryption migration.
|
| + void StartMigration();
|
| +
|
| + // Handlers for cryptohome API callbacks.
|
| + void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status,
|
| + uint64_t current,
|
| + uint64_t total);
|
| + void OnMigrationRequested(bool success);
|
| +
|
| Delegate* delegate_ = nullptr;
|
| bool show_on_init_ = false;
|
|
|
| + // The current UI state which should be refrected in the web UI.
|
| + UIState current_ui_state_ = INITIAL;
|
| +
|
| + // The current user's UserContext, which is used to request the migration to
|
| + // cryptohome.
|
| + UserContext user_context_;
|
| +
|
| + base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler);
|
| };
|
|
|
|
|