Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h

Issue 2798023005: Force encryption migration if the device supports ARC. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/authenticator.h"
11 #include "chromeos/login/auth/user_context.h" 12 #include "chromeos/login/auth/user_context.h"
12 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h" 13 #include "third_party/cros_system_api/dbus/cryptohome/dbus-constants.h"
13 14
14 namespace chromeos { 15 namespace chromeos {
15 16
16 // WebUI implementation of EncryptionMigrationScreenView 17 // WebUI implementation of EncryptionMigrationScreenView
17 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView, 18 class EncryptionMigrationScreenHandler : public EncryptionMigrationScreenView,
18 public BaseScreenHandler { 19 public BaseScreenHandler {
19 public: 20 public:
20 EncryptionMigrationScreenHandler(); 21 EncryptionMigrationScreenHandler();
21 ~EncryptionMigrationScreenHandler() override; 22 ~EncryptionMigrationScreenHandler() override;
22 23
23 // EncryptionMigrationScreenView implementation: 24 // EncryptionMigrationScreenView implementation:
24 void Show() override; 25 void Show() override;
25 void Hide() override; 26 void Hide() override;
26 void SetDelegate(Delegate* delegate) override; 27 void SetDelegate(Delegate* delegate) override;
27 void SetUserContext(const UserContext& user_context) override; 28 void SetUserContext(const UserContext& user_context) override;
29 void SetLoginPerformer(LoginPerformer* login_performer) override;
28 30
29 // BaseScreenHandler implementation: 31 // BaseScreenHandler implementation:
30 void DeclareLocalizedValues( 32 void DeclareLocalizedValues(
31 ::login::LocalizedValuesBuilder* builder) override; 33 ::login::LocalizedValuesBuilder* builder) override;
32 void Initialize() override; 34 void Initialize() override;
33 35
34 private: 36 private:
35 // Enumeration for the migration state. These values must be kept in sync with 37 // Enumeration for the migration state. These values must be kept in sync with
36 // EncryptionMigrationUIState in JS code. 38 // EncryptionMigrationUIState in JS code.
37 enum UIState { 39 enum UIState {
38 INITIAL = 0, 40 INITIAL = 0,
39 MIGRATING = 1, 41 MIGRATING = 1,
40 MIGRATION_SUCCEEDED = 2, 42 MIGRATION_SUCCEEDED = 2,
41 MIGRATION_FAILED = 3 43 MIGRATION_FAILED = 3
42 }; 44 };
43 45
44 // WebUIMessageHandler implementation: 46 // WebUIMessageHandler implementation:
45 void RegisterMessages() override; 47 void RegisterMessages() override;
46 48
47 // Handlers for JS API callbacks. 49 // Handlers for JS API callbacks.
48 void HandleStartMigration(); 50 void HandleStartMigration();
51 void HandleSkipMigration();
49 void HandleRequestRestart(); 52 void HandleRequestRestart();
50 53
51 // Updates UI state. 54 // Updates UI state.
52 void UpdateUIState(UIState state); 55 void UpdateUIState(UIState state);
53 56
54 // Requests cryptohome to start encryption migration. 57 // Requests cryptohome to start encryption migration.
55 void StartMigration(); 58 void StartMigration();
56 59
57 // Handlers for cryptohome API callbacks. 60 // Handlers for cryptohome API callbacks.
58 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status, 61 void OnMigrationProgress(cryptohome::DircryptoMigrationStatus status,
59 uint64_t current, 62 uint64_t current,
60 uint64_t total); 63 uint64_t total);
61 void OnMigrationRequested(bool success); 64 void OnMigrationRequested(bool success);
62 65
63 Delegate* delegate_ = nullptr; 66 Delegate* delegate_ = nullptr;
64 bool show_on_init_ = false; 67 bool show_on_init_ = false;
65 68
66 // The current UI state which should be refrected in the web UI. 69 // The current UI state which should be refrected in the web UI.
67 UIState current_ui_state_ = INITIAL; 70 UIState current_ui_state_ = INITIAL;
68 71
69 // The current user's UserContext, which is used to request the migration to 72 // The current user's UserContext, which is used to request the migration to
70 // cryptohome. 73 // cryptohome.
71 UserContext user_context_; 74 UserContext user_context_;
72 75
76 // The LoginPerfoermer which was used in the previous log-in attempt. It is
77 // used to login in to the session when the user skips migration.
78 LoginPerformer* login_performer_ = nullptr;
79
73 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_; 80 base::WeakPtrFactory<EncryptionMigrationScreenHandler> weak_ptr_factory_;
74 81
75 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler); 82 DISALLOW_COPY_AND_ASSIGN(EncryptionMigrationScreenHandler);
76 }; 83 };
77 84
78 } // namespace chromeos 85 } // namespace chromeos
79 86
80 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA NDLER_H_ 87 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENCRYPTION_MIGRATION_SCREEN_HA NDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698