Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..72fb1538b0f82c99fd62be247bf886c1549c7b05 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.cc |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/webui/chromeos/login/encryption_migration_screen_handler.h" |
| + |
| +namespace { |
| + |
| +const char kJsScreenPath[] = "login.EncryptionMigrationScreen"; |
|
xiyuan
2017/03/28 17:15:04
nit: const -> constexpr
fukino
2017/03/29 01:03:57
Done.
|
| + |
| +} // namespace |
| + |
| +namespace chromeos { |
| + |
| +EncryptionMigrationScreenHandler::EncryptionMigrationScreenHandler() |
| + : BaseScreenHandler(kScreenId) { |
| + set_call_js_prefix(kJsScreenPath); |
| +} |
| + |
| +EncryptionMigrationScreenHandler::~EncryptionMigrationScreenHandler() { |
| + if (delegate_) |
| + delegate_->OnViewDestroyed(this); |
| +} |
| + |
| +void EncryptionMigrationScreenHandler::Show() { |
| + if (!page_is_ready()) { |
|
xiyuan
2017/03/28 17:15:04
nit: check !delegate_ to make it consistent with w
fukino
2017/03/29 01:03:57
Done.
|
| + show_on_init_ = true; |
| + return; |
| + } |
| + ShowScreen(kScreenId); |
| +} |
| + |
| +void EncryptionMigrationScreenHandler::Hide() { |
| + show_on_init_ = false; |
| +} |
| + |
| +void EncryptionMigrationScreenHandler::SetDelegate(Delegate* delegate) { |
| + delegate_ = delegate; |
| + if (page_is_ready()) |
| + Initialize(); |
| +} |
| + |
| +void EncryptionMigrationScreenHandler::DeclareLocalizedValues( |
| + ::login::LocalizedValuesBuilder* builder) {} |
| + |
| +void EncryptionMigrationScreenHandler::Initialize() { |
| + if (!page_is_ready() || !delegate_) |
| + return; |
| + |
| + if (show_on_init_) { |
| + Show(); |
| + show_on_init_ = false; |
| + } |
| +} |
| + |
| +} // chromeos |