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> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 void SetShouldResume(bool should_resume) override; | 40 void SetShouldResume(bool should_resume) override; |
41 void SetContinueLoginCallback(ContinueLoginCallback callback) override; | 41 void SetContinueLoginCallback(ContinueLoginCallback callback) override; |
42 void SetupInitialView() override; | 42 void SetupInitialView() override; |
43 | 43 |
44 // BaseScreenHandler implementation: | 44 // BaseScreenHandler implementation: |
45 void DeclareLocalizedValues( | 45 void DeclareLocalizedValues( |
46 ::login::LocalizedValuesBuilder* builder) override; | 46 ::login::LocalizedValuesBuilder* builder) override; |
47 void Initialize() override; | 47 void Initialize() override; |
48 | 48 |
49 private: | 49 private: |
50 // Enumeration for the migration state. These values must be kept in sync with | 50 // Enumeration for migration UI state. These values must be kept in sync with |
51 // EncryptionMigrationUIState in JS code. | 51 // EncryptionMigrationUIState in JS code, and match the numbering for |
| 52 // MigrationUIScreen in histograms/enums.xml. Do not reorder or remove items, |
| 53 // only add new items before COUNT. |
52 enum UIState { | 54 enum UIState { |
53 INITIAL = 0, | 55 INITIAL = 0, |
54 READY = 1, | 56 READY = 1, |
55 MIGRATING = 2, | 57 MIGRATING = 2, |
56 MIGRATION_FAILED = 3, | 58 MIGRATION_FAILED = 3, |
57 NOT_ENOUGH_STORAGE = 4, | 59 NOT_ENOUGH_STORAGE = 4, |
| 60 COUNT |
58 }; | 61 }; |
59 | 62 |
60 // WebUIMessageHandler implementation: | 63 // WebUIMessageHandler implementation: |
61 void RegisterMessages() override; | 64 void RegisterMessages() override; |
62 | 65 |
63 // PowerManagerClient::Observer implementation: | 66 // PowerManagerClient::Observer implementation: |
64 void PowerChanged(const power_manager::PowerSupplyProperties& proto) override; | 67 void PowerChanged(const power_manager::PowerSupplyProperties& proto) override; |
65 | 68 |
66 // Handlers for JS API callbacks. | 69 // Handlers for JS API callbacks. |
67 void HandleStartMigration(); | 70 void HandleStartMigration(); |
68 void HandleSkipMigration(); | 71 void HandleSkipMigration(); |
69 void HandleRequestRestart(); | 72 void HandleRequestRestartOnLowStorage(); |
| 73 void HandleRequestRestartOnFailure(); |
70 void HandleOpenFeedbackDialog(); | 74 void HandleOpenFeedbackDialog(); |
71 | 75 |
72 // Updates UI state. | 76 // Updates UI state. |
73 void UpdateUIState(UIState state); | 77 void UpdateUIState(UIState state); |
74 | 78 |
75 void CheckAvailableStorage(); | 79 void CheckAvailableStorage(); |
76 void OnGetAvailableStorage(int64_t size); | 80 void OnGetAvailableStorage(int64_t size); |
77 void WaitBatteryAndMigrate(); | 81 void WaitBatteryAndMigrate(); |
78 void StartMigration(); | 82 void StartMigration(); |
79 void OnMountExistingVault(bool success, | 83 void OnMountExistingVault(bool success, |
80 cryptohome::MountError return_code, | 84 cryptohome::MountError return_code, |
81 const std::string& mount_hash); | 85 const std::string& mount_hash); |
82 void StartBlockingPowerSave(); | 86 void StartBlockingPowerSave(); |
83 void StopBlockingPowerSave(); | 87 void StopBlockingPowerSave(); |
84 // Removes cryptohome and shows the error screen after the removal finishes. | 88 // Removes cryptohome and shows the error screen after the removal finishes. |
85 void RemoveCryptohome(); | 89 void RemoveCryptohome(); |
86 void OnRemoveCryptohome(bool success, cryptohome::MountError return_code); | 90 void OnRemoveCryptohome(bool success, cryptohome::MountError return_code); |
87 | 91 |
88 // Creates authorization key for MountEx method using |user_context_|. | 92 // Creates authorization key for MountEx method using |user_context_|. |
89 cryptohome::KeyDefinition GetAuthKey(); | 93 cryptohome::KeyDefinition GetAuthKey(); |
90 | 94 |
91 // Handlers for cryptohome API callbacks. | 95 // Handlers for cryptohome API callbacks. |
92 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, | 96 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, |
93 uint64_t current, | 97 uint64_t current, |
94 uint64_t total); | 98 uint64_t total); |
95 void OnMigrationRequested(bool success); | 99 void OnMigrationRequested(bool success); |
96 | 100 |
| 101 // Records UMA about visible screen after delay. |
| 102 void OnDelayedRecordVisibleScreen(UIState state); |
| 103 |
97 Delegate* delegate_ = nullptr; | 104 Delegate* delegate_ = nullptr; |
98 bool show_on_init_ = false; | 105 bool show_on_init_ = false; |
99 | 106 |
100 // The current UI state which should be refrected in the web UI. | 107 // The current UI state which should be refrected in the web UI. |
101 UIState current_ui_state_ = INITIAL; | 108 UIState current_ui_state_ = INITIAL; |
102 | 109 |
103 // The current user's UserContext, which is used to request the migration to | 110 // The current user's UserContext, which is used to request the migration to |
104 // cryptohome. | 111 // cryptohome. |
105 UserContext user_context_; | 112 UserContext user_context_; |
106 | 113 |
(...skipping 18 matching lines...) Expand all Loading... |
125 std::unique_ptr<LoginFeedback> login_feedback_; | 132 std::unique_ptr<LoginFeedback> login_feedback_; |
126 | 133 |
127 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; | 134 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; |
128 | 135 |
129 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); | 136 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); |
130 }; | 137 }; |
131 | 138 |
132 } // namespace chromeos | 139 } // namespace chromeos |
133 | 140 |
134 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ | 141 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ |
OLD | NEW |