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/login/auth/user_context.h" | 11 #include "chromeos/login/auth/user_context.h" |
12 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" | 12 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 // WebUI implementation of EncryptionMigrationScreenView | 16 // WebUI implementation of EncryptionMigrationScreenView |
17 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView, | 17 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView, |
18 public BaseScreenHandler { | 18 public BaseScreenHandler { |
19 public: | 19 public: |
20 EncryptionMigrationScreenHandler(); | 20 EncryptionMigrationScreenHandler(); |
21 ~EncryptionMigrationScreenHandler() override; | 21 ~EncryptionMigrationScreenHandler() override; |
22 | 22 |
23 // EncryptionMigrationScreenView implementation: | 23 // EncryptionMigrationScreenView implementation: |
24 void Show() override; | 24 void Show() override; |
25 void Hide() override; | 25 void Hide() override; |
26 void SetDelegate(Delegate* delegate) override; | 26 void SetDelegate(Delegate* delegate) override; |
27 void SetUserContext(const UserContext& user_context) override; | 27 void SetUserContext(const UserContext& user_context) override; |
| 28 void SetContinueLoginCallback(ContinueLoginCallback callback) override; |
28 | 29 |
29 // BaseScreenHandler implementation: | 30 // BaseScreenHandler implementation: |
30 void DeclareLocalizedValues( | 31 void DeclareLocalizedValues( |
31 ::login::LocalizedValuesBuilder* builder) override; | 32 ::login::LocalizedValuesBuilder* builder) override; |
32 void Initialize() override; | 33 void Initialize() override; |
33 | 34 |
34 private: | 35 private: |
35 // Enumeration for the migration state. These values must be kept in sync with | 36 // Enumeration for the migration state. These values must be kept in sync with |
36 // EncryptionMigrationUIState in JS code. | 37 // EncryptionMigrationUIState in JS code. |
37 enum UIState { | 38 enum UIState { |
38 INITIAL = 0, | 39 INITIAL = 0, |
39 MIGRATING = 1, | 40 MIGRATING = 1, |
40 MIGRATION_SUCCEEDED = 2, | 41 MIGRATION_SUCCEEDED = 2, |
41 MIGRATION_FAILED = 3 | 42 MIGRATION_FAILED = 3 |
42 }; | 43 }; |
43 | 44 |
44 // WebUIMessageHandler implementation: | 45 // WebUIMessageHandler implementation: |
45 void RegisterMessages() override; | 46 void RegisterMessages() override; |
46 | 47 |
47 // Handlers for JS API callbacks. | 48 // Handlers for JS API callbacks. |
48 void HandleStartMigration(); | 49 void HandleStartMigration(); |
| 50 void HandleSkipMigration(); |
49 void HandleRequestRestart(); | 51 void HandleRequestRestart(); |
50 | 52 |
51 // Updates UI state. | 53 // Updates UI state. |
52 void UpdateUIState(UIState state); | 54 void UpdateUIState(UIState state); |
53 | 55 |
54 // Requests cryptohome to start encryption migration. | 56 // Requests cryptohome to start encryption migration. |
55 void StartMigration(); | 57 void StartMigration(); |
56 | 58 |
57 // Handlers for cryptohome API callbacks. | 59 // Handlers for cryptohome API callbacks. |
58 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, | 60 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, |
59 uint64_t current, | 61 uint64_t current, |
60 uint64_t total); | 62 uint64_t total); |
61 void OnMigrationRequested(bool success); | 63 void OnMigrationRequested(bool success); |
62 | 64 |
63 Delegate* delegate_ = nullptr; | 65 Delegate* delegate_ = nullptr; |
64 bool show_on_init_ = false; | 66 bool show_on_init_ = false; |
65 | 67 |
66 // The current UI state which should be refrected in the web UI. | 68 // The current UI state which should be refrected in the web UI. |
67 UIState current_ui_state_ = INITIAL; | 69 UIState current_ui_state_ = INITIAL; |
68 | 70 |
69 // The current user's UserContext, which is used to request the migration to | 71 // The current user's UserContext, which is used to request the migration to |
70 // cryptohome. | 72 // cryptohome. |
71 UserContext user_context_; | 73 UserContext user_context_; |
72 | 74 |
| 75 // The callback which is used to log in to the session from the migration UI. |
| 76 ContinueLoginCallback continue_login_callback_; |
| 77 |
73 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; | 78 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; |
74 | 79 |
75 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); | 80 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); |
76 }; | 81 }; |
77 | 82 |
78 } // namespace chromeos | 83 } // namespace chromeos |
79 | 84 |
80 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ | 85 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA
NDLER_H_ |
OLD | NEW |