| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/kiosk_app_menu_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON)); | 54 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON)); |
| 55 localized_strings->SetString( | 55 localized_strings->SetString( |
| 56 "confirmKioskAppDiagnosticModeFormat", | 56 "confirmKioskAppDiagnosticModeFormat", |
| 57 l10n_util::GetStringUTF16(IDS_LOGIN_CONFIRM_KIOSK_DIAGNOSTIC_FORMAT)); | 57 l10n_util::GetStringUTF16(IDS_LOGIN_CONFIRM_KIOSK_DIAGNOSTIC_FORMAT)); |
| 58 localized_strings->SetString( | 58 localized_strings->SetString( |
| 59 "confirmKioskAppDiagnosticModeYes", | 59 "confirmKioskAppDiagnosticModeYes", |
| 60 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)); | 60 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)); |
| 61 localized_strings->SetString( | 61 localized_strings->SetString( |
| 62 "confirmKioskAppDiagnosticModeNo", | 62 "confirmKioskAppDiagnosticModeNo", |
| 63 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)); | 63 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)); |
| 64 localized_strings->SetBoolean( |
| 65 "kioskAppHasLaunchError", |
| 66 KioskAppLaunchError::Get() != KioskAppLaunchError::NONE); |
| 64 } | 67 } |
| 65 | 68 |
| 66 void KioskAppMenuHandler::RegisterMessages() { | 69 void KioskAppMenuHandler::RegisterMessages() { |
| 67 web_ui()->RegisterMessageCallback("initializeKioskApps", | 70 web_ui()->RegisterMessageCallback("initializeKioskApps", |
| 68 base::Bind(&KioskAppMenuHandler::HandleInitializeKioskApps, | 71 base::Bind(&KioskAppMenuHandler::HandleInitializeKioskApps, |
| 69 base::Unretained(this))); | 72 base::Unretained(this))); |
| 70 web_ui()->RegisterMessageCallback("kioskAppsLoaded", | 73 web_ui()->RegisterMessageCallback("kioskAppsLoaded", |
| 71 base::Bind(&KioskAppMenuHandler::HandleKioskAppsLoaded, | 74 base::Bind(&KioskAppMenuHandler::HandleKioskAppsLoaded, |
| 72 base::Unretained(this))); | 75 base::Unretained(this))); |
| 73 web_ui()->RegisterMessageCallback("checkKioskAppLaunchError", | 76 web_ui()->RegisterMessageCallback("checkKioskAppLaunchError", |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 117 } |
| 115 } else { | 118 } else { |
| 116 app_info->SetString("iconWidth", kDefaultAppIconSizeString); | 119 app_info->SetString("iconWidth", kDefaultAppIconSizeString); |
| 117 app_info->SetString("iconHeight", kDefaultAppIconSizeString); | 120 app_info->SetString("iconHeight", kDefaultAppIconSizeString); |
| 118 } | 121 } |
| 119 app_info->SetString("iconUrl", icon_url); | 122 app_info->SetString("iconUrl", icon_url); |
| 120 | 123 |
| 121 apps_list.Append(app_info.release()); | 124 apps_list.Append(app_info.release()); |
| 122 } | 125 } |
| 123 | 126 |
| 124 | |
| 125 web_ui()->CallJavascriptFunction(EnableNewKioskUI() ? | 127 web_ui()->CallJavascriptFunction(EnableNewKioskUI() ? |
| 126 kKioskSetAppsNewAPI : kKioskSetAppsOldAPI, | 128 kKioskSetAppsNewAPI : kKioskSetAppsOldAPI, |
| 127 apps_list); | 129 apps_list); |
| 128 } | 130 } |
| 129 | 131 |
| 130 void KioskAppMenuHandler::HandleInitializeKioskApps( | 132 void KioskAppMenuHandler::HandleInitializeKioskApps( |
| 131 const base::ListValue* args) { | 133 const base::ListValue* args) { |
| 132 is_webui_initialized_ = true; | 134 is_webui_initialized_ = true; |
| 133 SendKioskApps(); | 135 SendKioskApps(); |
| 134 } | 136 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 157 | 159 |
| 158 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() { | 160 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() { |
| 159 SendKioskApps(); | 161 SendKioskApps(); |
| 160 } | 162 } |
| 161 | 163 |
| 162 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) { | 164 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) { |
| 163 SendKioskApps(); | 165 SendKioskApps(); |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace chromeos | 168 } // namespace chromeos |
| OLD | NEW |