OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/chromeos/login/voice_interaction_value_prop_sc
reen_handler.h" |
| 6 |
| 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/chromeos/login/oobe_screen.h" |
| 9 #include "chrome/browser/chromeos/login/screens/voice_interaction_value_prop_scr
een.h" |
| 10 #include "chrome/grit/generated_resources.h" |
| 11 #include "components/login/localized_values_builder.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 const char kJsScreenPath[] = "login.VoiceInteractionValuePropScreen"; |
| 16 |
| 17 } // namespace |
| 18 |
| 19 namespace chromeos { |
| 20 |
| 21 VoiceInteractionValuePropScreenHandler::VoiceInteractionValuePropScreenHandler() |
| 22 : BaseScreenHandler(kScreenId) { |
| 23 set_call_js_prefix(kJsScreenPath); |
| 24 } |
| 25 |
| 26 VoiceInteractionValuePropScreenHandler:: |
| 27 ~VoiceInteractionValuePropScreenHandler() { |
| 28 if (screen_) { |
| 29 screen_->OnViewDestroyed(this); |
| 30 } |
| 31 } |
| 32 |
| 33 void VoiceInteractionValuePropScreenHandler::DeclareLocalizedValues( |
| 34 ::login::LocalizedValuesBuilder* builder) { |
| 35 builder->Add("locale", g_browser_process->GetApplicationLocale()); |
| 36 builder->Add("voiceInteractionValuePropNoThanksButton", |
| 37 IDS_VOICE_INTERACTION_VALUE_PROP_NO_THANKS_BUTTON); |
| 38 builder->Add("voiceInteractionValuePropContinueButton", |
| 39 IDS_VOICE_INTERACTION_VALUE_PROP_CONTINUE_BUTTION); |
| 40 } |
| 41 |
| 42 void VoiceInteractionValuePropScreenHandler::Bind( |
| 43 VoiceInteractionValuePropScreen* screen) { |
| 44 BaseScreenHandler::SetBaseScreen(screen); |
| 45 screen_ = screen; |
| 46 if (page_is_ready()) |
| 47 Initialize(); |
| 48 } |
| 49 |
| 50 void VoiceInteractionValuePropScreenHandler::Unbind() { |
| 51 screen_ = nullptr; |
| 52 BaseScreenHandler::SetBaseScreen(nullptr); |
| 53 } |
| 54 |
| 55 void VoiceInteractionValuePropScreenHandler::Show() { |
| 56 if (!page_is_ready() || !screen_) { |
| 57 show_on_init_ = true; |
| 58 return; |
| 59 } |
| 60 |
| 61 ShowScreen(kScreenId); |
| 62 } |
| 63 |
| 64 void VoiceInteractionValuePropScreenHandler::Hide() {} |
| 65 |
| 66 void VoiceInteractionValuePropScreenHandler::Initialize() { |
| 67 if (!screen_ || !show_on_init_) |
| 68 return; |
| 69 |
| 70 Show(); |
| 71 show_on_init_ = false; |
| 72 } |
| 73 |
| 74 } // namespace chromeos |
OLD | NEW |