Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..93cdf6d0a8cfbcd4ba97893bb1fcb95d4beb81af |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_screen_handler.cc |
| @@ -0,0 +1,70 @@ |
| +// Copyright 2016 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/voice_interaction_value_prop_screen_handler.h" |
| + |
| +#include "chrome/browser/chromeos/login/oobe_screen.h" |
| +#include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_screen.h" |
| +#include "chrome/grit/generated_resources.h" |
| +#include "components/login/localized_values_builder.h" |
| + |
| +namespace { |
| + |
| +const char kJsScreenPath[] = "login.VoiceInteractionValuePropScreen"; |
| + |
| +} // namespace |
| + |
| +namespace chromeos { |
| + |
| +VoiceInteractionValuePropScreenHandler::VoiceInteractionValuePropScreenHandler() |
| + : BaseScreenHandler(kScreenId) { |
| + set_call_js_prefix(kJsScreenPath); |
| +} |
| + |
| +VoiceInteractionValuePropScreenHandler:: |
| + ~VoiceInteractionValuePropScreenHandler() { |
| + if (screen_) { |
| + screen_->OnViewDestroyed(this); |
| + } |
| +} |
| + |
| +void VoiceInteractionValuePropScreenHandler::DeclareLocalizedValues( |
| + ::login::LocalizedValuesBuilder* builder) { |
| + builder->Add("voiceInteractionValuePropNoThanksButton", |
| + IDS_VOICE_INTERACTION_VALUE_PROP_NO_THANKS_BUTTON); |
| + builder->Add("voiceInteractionValuePropContinueButton", |
| + IDS_VOICE_INTERACTION_VALUE_PROP_CONTINUE_BUTTION); |
| +} |
| + |
| +void VoiceInteractionValuePropScreenHandler::Bind( |
| + VoiceInteractionValuePropScreen* screen) { |
| + screen_ = screen; |
| + BaseScreenHandler::SetBaseScreen(screen_); |
| +} |
| + |
| +void VoiceInteractionValuePropScreenHandler::Unbind() { |
| + screen_ = nullptr; |
| + BaseScreenHandler::SetBaseScreen(nullptr); |
| +} |
| + |
| +void VoiceInteractionValuePropScreenHandler::Show() { |
| + if (!page_is_ready()) { |
| + show_on_init_ = true; |
| + return; |
| + } |
| + |
| + ShowScreen(kScreenId); |
| +} |
| + |
| +void VoiceInteractionValuePropScreenHandler::Hide() {} |
| + |
| +void VoiceInteractionValuePropScreenHandler::Initialize() { |
| + if (!page_is_ready() || !show_on_init_) |
|
xiyuan
2017/05/30 19:26:22
page_is_ready() is not necessary. It should always
yueli
2017/06/02 02:03:47
Done.
|
| + return; |
| + |
| + Show(); |
| + show_on_init_ = false; |
| +} |
| + |
| +} // namespace chromeos |