| 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/arc_kiosk_splash_screen_handler
.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/arc_kiosk_splash_screen_handler
.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/grit/chrome_unscaled_resources.h" | 11 #include "chrome/grit/chrome_unscaled_resources.h" |
| 12 #include "chrome/grit/chromium_strings.h" | 12 #include "chrome/grit/chromium_strings.h" |
| 13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/login/localized_values_builder.h" | 14 #include "components/login/localized_values_builder.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/base/webui/web_ui_util.h" | 17 #include "ui/base/webui/web_ui_util.h" |
| 18 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 constexpr char kJsScreenPath[] = "login.ArcKioskSplashScreen"; | 22 constexpr char kJsScreenPath[] = "login.ArcKioskSplashScreen"; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| 26 | 26 |
| 27 ArcKioskSplashScreenHandler::ArcKioskSplashScreenHandler() { | 27 ArcKioskSplashScreenHandler::ArcKioskSplashScreenHandler() |
| 28 : BaseScreenHandler(kScreenId) { |
| 28 set_call_js_prefix(kJsScreenPath); | 29 set_call_js_prefix(kJsScreenPath); |
| 29 } | 30 } |
| 30 | 31 |
| 31 ArcKioskSplashScreenHandler::~ArcKioskSplashScreenHandler() = default; | 32 ArcKioskSplashScreenHandler::~ArcKioskSplashScreenHandler() = default; |
| 32 | 33 |
| 33 void ArcKioskSplashScreenHandler::DeclareLocalizedValues( | 34 void ArcKioskSplashScreenHandler::DeclareLocalizedValues( |
| 34 ::login::LocalizedValuesBuilder* builder) { | 35 ::login::LocalizedValuesBuilder* builder) { |
| 35 builder->Add("arcKioskStartMessage", IDS_APP_START_APP_WAIT_MESSAGE); | 36 builder->Add("arcKioskStartMessage", IDS_APP_START_APP_WAIT_MESSAGE); |
| 36 | 37 |
| 37 const base::string16 product_os_name = | 38 const base::string16 product_os_name = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 54 show_on_init_ = true; | 55 show_on_init_ = true; |
| 55 return; | 56 return; |
| 56 } | 57 } |
| 57 | 58 |
| 58 base::DictionaryValue data; | 59 base::DictionaryValue data; |
| 59 // |data| will take ownership of |app_info|. | 60 // |data| will take ownership of |app_info|. |
| 60 std::unique_ptr<base::DictionaryValue> app_info = | 61 std::unique_ptr<base::DictionaryValue> app_info = |
| 61 base::MakeUnique<base::DictionaryValue>(); | 62 base::MakeUnique<base::DictionaryValue>(); |
| 62 PopulateAppInfo(app_info.get()); | 63 PopulateAppInfo(app_info.get()); |
| 63 data.Set("appInfo", std::move(app_info)); | 64 data.Set("appInfo", std::move(app_info)); |
| 64 ShowScreenWithData(OobeScreen::SCREEN_ARC_KIOSK_SPLASH, &data); | 65 ShowScreenWithData(kScreenId, &data); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void ArcKioskSplashScreenHandler::RegisterMessages() { | 68 void ArcKioskSplashScreenHandler::RegisterMessages() { |
| 68 AddCallback("cancelArcKioskLaunch", | 69 AddCallback("cancelArcKioskLaunch", |
| 69 &ArcKioskSplashScreenHandler::HandleCancelArcKioskLaunch); | 70 &ArcKioskSplashScreenHandler::HandleCancelArcKioskLaunch); |
| 70 } | 71 } |
| 71 | 72 |
| 72 void ArcKioskSplashScreenHandler::UpdateArcKioskState(ArcKioskState state) { | 73 void ArcKioskSplashScreenHandler::UpdateArcKioskState(ArcKioskState state) { |
| 73 if (!page_is_ready()) | 74 if (!page_is_ready()) |
| 74 return; | 75 return; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 113 |
| 113 void ArcKioskSplashScreenHandler::HandleCancelArcKioskLaunch() { | 114 void ArcKioskSplashScreenHandler::HandleCancelArcKioskLaunch() { |
| 114 if (!delegate_) { | 115 if (!delegate_) { |
| 115 LOG(WARNING) << "No delegate set to handle cancel app launch"; | 116 LOG(WARNING) << "No delegate set to handle cancel app launch"; |
| 116 return; | 117 return; |
| 117 } | 118 } |
| 118 delegate_->OnCancelArcKioskLaunch(); | 119 delegate_->OnCancelArcKioskLaunch(); |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace chromeos | 122 } // namespace chromeos |
| OLD | NEW |