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

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

Issue 2836603002: cros: Reboot the system after encryption migration finishes. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 "ash/system/devicetype_utils.h" 10 #include "ash/system/devicetype_utils.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // previous attempt and dropping |is_forcing_dircrypto| flag in UserContext. 191 // previous attempt and dropping |is_forcing_dircrypto| flag in UserContext.
192 // In this case, the user can not launch ARC apps in the session, and will be 192 // In this case, the user can not launch ARC apps in the session, and will be
193 // asked to do the migration again in the next log-in attempt. 193 // asked to do the migration again in the next log-in attempt.
194 if (!continue_login_callback_.is_null()) { 194 if (!continue_login_callback_.is_null()) {
195 user_context_.SetIsForcingDircrypto(false); 195 user_context_.SetIsForcingDircrypto(false);
196 std::move(continue_login_callback_).Run(user_context_); 196 std::move(continue_login_callback_).Run(user_context_);
197 } 197 }
198 } 198 }
199 199
200 void EncryptionMigrationScreenHandler::HandleRequestRestart() { 200 void EncryptionMigrationScreenHandler::HandleRequestRestart() {
201 chrome::AttemptRestart(); 201 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
202 } 202 }
203 203
204 void EncryptionMigrationScreenHandler::UpdateUIState(UIState state) { 204 void EncryptionMigrationScreenHandler::UpdateUIState(UIState state) {
205 if (state == current_ui_state_) 205 if (state == current_ui_state_)
206 return; 206 return;
207 207
208 current_ui_state_ = state; 208 current_ui_state_ = state;
209 CallJS("setUIState", static_cast<int>(state)); 209 CallJS("setUIState", static_cast<int>(state));
210 210
211 // When this handler is about to show the READY screen, we should get the 211 // When this handler is about to show the READY screen, we should get the
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 switch (status) { 306 switch (status) {
307 case cryptohome::DIRCRYPTO_MIGRATION_INITIALIZING: 307 case cryptohome::DIRCRYPTO_MIGRATION_INITIALIZING:
308 UpdateUIState(UIState::MIGRATING); 308 UpdateUIState(UIState::MIGRATING);
309 break; 309 break;
310 case cryptohome::DIRCRYPTO_MIGRATION_IN_PROGRESS: 310 case cryptohome::DIRCRYPTO_MIGRATION_IN_PROGRESS:
311 UpdateUIState(UIState::MIGRATING); 311 UpdateUIState(UIState::MIGRATING);
312 CallJS("setMigrationProgress", static_cast<double>(current) / total); 312 CallJS("setMigrationProgress", static_cast<double>(current) / total);
313 break; 313 break;
314 case cryptohome::DIRCRYPTO_MIGRATION_SUCCESS: 314 case cryptohome::DIRCRYPTO_MIGRATION_SUCCESS:
315 // Restart immediately after successful migration. 315 // Restart immediately after successful migration.
316 chrome::AttemptRestart(); 316 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
317 break; 317 break;
318 case cryptohome::DIRCRYPTO_MIGRATION_FAILED: 318 case cryptohome::DIRCRYPTO_MIGRATION_FAILED:
319 UpdateUIState(UIState::MIGRATION_FAILED); 319 UpdateUIState(UIState::MIGRATION_FAILED);
320 // Stop listening to the progress updates. 320 // Stop listening to the progress updates.
321 DBusThreadManager::Get() 321 DBusThreadManager::Get()
322 ->GetCryptohomeClient() 322 ->GetCryptohomeClient()
323 ->SetDircryptoMigrationProgressHandler( 323 ->SetDircryptoMigrationProgressHandler(
324 CryptohomeClient::DircryptoMigrationProgessHandler()); 324 CryptohomeClient::DircryptoMigrationProgessHandler());
325 break; 325 break;
326 default: 326 default:
327 break; 327 break;
328 } 328 }
329 } 329 }
330 330
331 void EncryptionMigrationScreenHandler::OnMigrationRequested(bool success) { 331 void EncryptionMigrationScreenHandler::OnMigrationRequested(bool success) {
332 // This function is called when MigrateToDircrypto is correctly requested. 332 // This function is called when MigrateToDircrypto is correctly requested.
333 // It does not mean that the migration is completed. We should know the 333 // It does not mean that the migration is completed. We should know the
334 // completion by DircryptoMigrationProgressHandler. success == false means a 334 // completion by DircryptoMigrationProgressHandler. success == false means a
335 // failure in DBus communication. 335 // failure in DBus communication.
336 // TODO(fukino): Handle this case. Should we retry or restart? 336 // TODO(fukino): Handle this case. Should we retry or restart?
337 DCHECK(success); 337 DCHECK(success);
338 } 338 }
339 339
340 } // namespace chromeos 340 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698