| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HANDL
ER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HANDL
ER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HANDL
ER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HANDL
ER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/chromeos/login/screens/encryption_migration_screen_view
.h" | 9 #include "chrome/browser/chromeos/login/screens/encryption_migration_screen_view
.h" |
| 10 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 10 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 11 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 11 #include "chromeos/dbus/power_manager_client.h" | 12 #include "chromeos/dbus/power_manager_client.h" |
| 12 #include "chromeos/login/auth/user_context.h" | 13 #include "chromeos/login/auth/user_context.h" |
| 13 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" | 14 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 // WebUI implementation of EncryptionMigrationScreenView | 18 // WebUI implementation of EncryptionMigrationScreenView |
| 18 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView, | 19 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView, |
| 19 public BaseScreenHandler, | 20 public BaseScreenHandler, |
| 20 public PowerManagerClient::Observer { | 21 public PowerManagerClient::Observer { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void PowerChanged(const power_manager::PowerSupplyProperties& proto) override; | 55 void PowerChanged(const power_manager::PowerSupplyProperties& proto) override; |
| 55 | 56 |
| 56 // Handlers for JS API callbacks. | 57 // Handlers for JS API callbacks. |
| 57 void HandleStartMigration(); | 58 void HandleStartMigration(); |
| 58 void HandleSkipMigration(); | 59 void HandleSkipMigration(); |
| 59 void HandleRequestRestart(); | 60 void HandleRequestRestart(); |
| 60 | 61 |
| 61 // Updates UI state. | 62 // Updates UI state. |
| 62 void UpdateUIState(UIState state); | 63 void UpdateUIState(UIState state); |
| 63 | 64 |
| 64 // Requests cryptohome to start encryption migration. | |
| 65 void CheckAvailableStorage(); | 65 void CheckAvailableStorage(); |
| 66 void OnGetAvailableStorage(int64_t size); | 66 void OnGetAvailableStorage(int64_t size); |
| 67 void WaitBatteryAndMigrate(); | 67 void WaitBatteryAndMigrate(); |
| 68 void StartMigration(); | 68 void StartMigration(); |
| 69 void OnMountExistingVault(bool success, |
| 70 cryptohome::MountError return_code, |
| 71 const std::string& mount_hash); |
| 72 // Creates authorization key for MountEx method using |user_context_|. |
| 73 cryptohome::KeyDefinition GetAuthKey(); |
| 69 | 74 |
| 70 // Handlers for cryptohome API callbacks. | 75 // Handlers for cryptohome API callbacks. |
| 71 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, | 76 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, |
| 72 uint64_t current, | 77 uint64_t current, |
| 73 uint64_t total); | 78 uint64_t total); |
| 74 void OnMigrationRequested(bool success); | 79 void OnMigrationRequested(bool success); |
| 75 | 80 |
| 76 Delegate* delegate_ = nullptr; | 81 Delegate* delegate_ = nullptr; |
| 77 bool show_on_init_ = false; | 82 bool show_on_init_ = false; |
| 78 | 83 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 97 bool should_migrate_on_enough_battery_ = false; | 102 bool should_migrate_on_enough_battery_ = false; |
| 98 | 103 |
| 99 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; | 104 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; |
| 100 | 105 |
| 101 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); | 106 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 } // namespace chromeos | 109 } // namespace chromeos |
| 105 | 110 |
| 106 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ | 111 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ |
| OLD | NEW |