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 <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "chrome/browser/chromeos/login/screens/encryption_migration_screen_view
.h" | 11 #include "chrome/browser/chromeos/login/screens/encryption_migration_screen_view
.h" |
10 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 12 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
11 #include "chromeos/cryptohome/cryptohome_parameters.h" | 13 #include "chromeos/cryptohome/cryptohome_parameters.h" |
12 #include "chromeos/dbus/power_manager_client.h" | 14 #include "chromeos/dbus/power_manager_client.h" |
13 #include "chromeos/login/auth/user_context.h" | 15 #include "chromeos/login/auth/user_context.h" |
14 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" | 16 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" |
15 | 17 |
| 18 namespace device { |
| 19 class PowerSaveBlocker; |
| 20 } // namespace device |
| 21 |
16 namespace chromeos { | 22 namespace chromeos { |
17 | 23 |
18 // WebUI implementation of EncryptionMigrationScreenView | 24 // WebUI implementation of EncryptionMigrationScreenView |
19 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView, | 25 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView, |
20 public BaseScreenHandler, | 26 public BaseScreenHandler, |
21 public PowerManagerClient::Observer { | 27 public PowerManagerClient::Observer { |
22 public: | 28 public: |
23 EncryptionMigrationScreenHandler(); | 29 EncryptionMigrationScreenHandler(); |
24 ~EncryptionMigrationScreenHandler() override; | 30 ~EncryptionMigrationScreenHandler() override; |
25 | 31 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Updates UI state. | 68 // Updates UI state. |
63 void UpdateUIState(UIState state); | 69 void UpdateUIState(UIState state); |
64 | 70 |
65 void CheckAvailableStorage(); | 71 void CheckAvailableStorage(); |
66 void OnGetAvailableStorage(int64_t size); | 72 void OnGetAvailableStorage(int64_t size); |
67 void WaitBatteryAndMigrate(); | 73 void WaitBatteryAndMigrate(); |
68 void StartMigration(); | 74 void StartMigration(); |
69 void OnMountExistingVault(bool success, | 75 void OnMountExistingVault(bool success, |
70 cryptohome::MountError return_code, | 76 cryptohome::MountError return_code, |
71 const std::string& mount_hash); | 77 const std::string& mount_hash); |
| 78 void StartBlockingPowerSave(); |
| 79 void StopBlockingPowerSave(); |
| 80 |
72 // Creates authorization key for MountEx method using |user_context_|. | 81 // Creates authorization key for MountEx method using |user_context_|. |
73 cryptohome::KeyDefinition GetAuthKey(); | 82 cryptohome::KeyDefinition GetAuthKey(); |
74 | 83 |
75 // Handlers for cryptohome API callbacks. | 84 // Handlers for cryptohome API callbacks. |
76 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, | 85 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, |
77 uint64_t current, | 86 uint64_t current, |
78 uint64_t total); | 87 uint64_t total); |
79 void OnMigrationRequested(bool success); | 88 void OnMigrationRequested(bool success); |
80 | 89 |
81 Delegate* delegate_ = nullptr; | 90 Delegate* delegate_ = nullptr; |
(...skipping 12 matching lines...) Expand all Loading... |
94 // True if the system should resume the previous incomplete migration. | 103 // True if the system should resume the previous incomplete migration. |
95 bool should_resume_ = false; | 104 bool should_resume_ = false; |
96 | 105 |
97 // The current battery level. | 106 // The current battery level. |
98 double current_battery_percent_ = 0.0; | 107 double current_battery_percent_ = 0.0; |
99 | 108 |
100 // True if the migration should start immediately once the battery level gets | 109 // True if the migration should start immediately once the battery level gets |
101 // sufficient. | 110 // sufficient. |
102 bool should_migrate_on_enough_battery_ = false; | 111 bool should_migrate_on_enough_battery_ = false; |
103 | 112 |
| 113 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_; |
| 114 |
104 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; | 115 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; |
105 | 116 |
106 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); | 117 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); |
107 }; | 118 }; |
108 | 119 |
109 } // namespace chromeos | 120 } // namespace chromeos |
110 | 121 |
111 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ | 122 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ |
OLD | NEW |