| 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 #include "chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_han
dler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_han
dler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 delegate_ = delegate; | 51 delegate_ = delegate; |
| 52 if (page_is_ready()) | 52 if (page_is_ready()) |
| 53 Initialize(); | 53 Initialize(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void EncryptionMigrationScreenHandler::SetUserContext( | 56 void EncryptionMigrationScreenHandler::SetUserContext( |
| 57 const UserContext& user_context) { | 57 const UserContext& user_context) { |
| 58 user_context_ = user_context; | 58 user_context_ = user_context; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void EncryptionMigrationScreenHandler::SetShouldResume(bool should_resume) { |
| 62 if (current_ui_state_ == INITIAL && should_resume) { |
| 63 // TODO(fukino): Wait until the battery gets enough level. |
| 64 StartMigration(); |
| 65 } |
| 66 } |
| 67 |
| 61 void EncryptionMigrationScreenHandler::SetContinueLoginCallback( | 68 void EncryptionMigrationScreenHandler::SetContinueLoginCallback( |
| 62 ContinueLoginCallback callback) { | 69 ContinueLoginCallback callback) { |
| 63 continue_login_callback_ = std::move(callback); | 70 continue_login_callback_ = std::move(callback); |
| 64 } | 71 } |
| 65 | 72 |
| 66 void EncryptionMigrationScreenHandler::DeclareLocalizedValues( | 73 void EncryptionMigrationScreenHandler::DeclareLocalizedValues( |
| 67 ::login::LocalizedValuesBuilder* builder) {} | 74 ::login::LocalizedValuesBuilder* builder) {} |
| 68 | 75 |
| 69 void EncryptionMigrationScreenHandler::Initialize() { | 76 void EncryptionMigrationScreenHandler::Initialize() { |
| 70 if (!page_is_ready() || !delegate_) | 77 if (!page_is_ready() || !delegate_) |
| 71 return; | 78 return; |
| 72 | 79 |
| 73 if (show_on_init_) { | 80 if (show_on_init_) { |
| 74 Show(); | 81 Show(); |
| 75 show_on_init_ = false; | 82 show_on_init_ = false; |
| 76 } | 83 } |
| 77 } | 84 } |
| 78 | 85 |
| 79 void EncryptionMigrationScreenHandler::RegisterMessages() { | 86 void EncryptionMigrationScreenHandler::RegisterMessages() { |
| 80 AddCallback(kJsApiStartMigration, | 87 AddCallback(kJsApiStartMigration, |
| 81 &EncryptionMigrationScreenHandler::HandleStartMigration); | 88 &EncryptionMigrationScreenHandler::HandleStartMigration); |
| 82 AddCallback(kJsApiSkipMigration, | 89 AddCallback(kJsApiSkipMigration, |
| 83 &EncryptionMigrationScreenHandler::HandleSkipMigration); | 90 &EncryptionMigrationScreenHandler::HandleSkipMigration); |
| 84 AddCallback(kJsApiRequestRestart, | 91 AddCallback(kJsApiRequestRestart, |
| 85 &EncryptionMigrationScreenHandler::HandleRequestRestart); | 92 &EncryptionMigrationScreenHandler::HandleRequestRestart); |
| 86 } | 93 } |
| 87 | 94 |
| 88 void EncryptionMigrationScreenHandler::HandleStartMigration() { | 95 void EncryptionMigrationScreenHandler::HandleStartMigration() { |
| 96 // TODO(fukino): Wait until the battery gets enough level. |
| 89 StartMigration(); | 97 StartMigration(); |
| 90 } | 98 } |
| 91 | 99 |
| 92 void EncryptionMigrationScreenHandler::HandleSkipMigration() { | 100 void EncryptionMigrationScreenHandler::HandleSkipMigration() { |
| 93 // If the user skips migration, we mount the cryptohome without performing the | 101 // If the user skips migration, we mount the cryptohome without performing the |
| 94 // migration by reusing UserContext and LoginPerformer which were used in the | 102 // migration by reusing UserContext and LoginPerformer which were used in the |
| 95 // previous attempt and dropping |is_forcing_dircrypto| flag in UserContext. | 103 // previous attempt and dropping |is_forcing_dircrypto| flag in UserContext. |
| 96 // In this case, the user can not launch ARC apps in the session, and will be | 104 // In this case, the user can not launch ARC apps in the session, and will be |
| 97 // asked to do the migration again in the next log-in attempt. | 105 // asked to do the migration again in the next log-in attempt. |
| 98 if (!continue_login_callback_.is_null()) { | 106 if (!continue_login_callback_.is_null()) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void EncryptionMigrationScreenHandler::OnMigrationRequested(bool success) { | 182 void EncryptionMigrationScreenHandler::OnMigrationRequested(bool success) { |
| 175 // This function is called when MigrateToDircrypto is correctly requested. | 183 // This function is called when MigrateToDircrypto is correctly requested. |
| 176 // It does not mean that the migration is completed. We should know the | 184 // It does not mean that the migration is completed. We should know the |
| 177 // completion by DircryptoMigrationProgressHandler. success == false means a | 185 // completion by DircryptoMigrationProgressHandler. success == false means a |
| 178 // failure in DBus communication. | 186 // failure in DBus communication. |
| 179 // TODO(fukino): Handle this case. Should we retry or restart? | 187 // TODO(fukino): Handle this case. Should we retry or restart? |
| 180 DCHECK(success); | 188 DCHECK(success); |
| 181 } | 189 } |
| 182 | 190 |
| 183 } // namespace chromeos | 191 } // namespace chromeos |
| OLD | NEW |