Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc

Issue 300843013: Install and launch kiosk app from cached crx file at start up. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the useless offline_enabled_app_profile testing data. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/extensions/chromeos/kiosk_apps_handler.h" 5 #include "chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 "kioskDisableBailoutShortcutConfirm", 171 "kioskDisableBailoutShortcutConfirm",
172 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)); 172 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL));
173 source->AddString( 173 source->AddString(
174 "kioskDisableBailoutShortcutCancel", 174 "kioskDisableBailoutShortcutCancel",
175 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)); 175 l10n_util::GetStringUTF16(IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL));
176 source->AddString("done", l10n_util::GetStringUTF16(IDS_DONE)); 176 source->AddString("done", l10n_util::GetStringUTF16(IDS_DONE));
177 source->AddString("add", l10n_util::GetStringUTF16(IDS_ADD)); 177 source->AddString("add", l10n_util::GetStringUTF16(IDS_ADD));
178 } 178 }
179 179
180 void KioskAppsHandler::OnKioskAppDataChanged(const std::string& app_id) { 180 void KioskAppsHandler::OnKioskAppDataChanged(const std::string& app_id) {
181 KioskAppManager::App app_data; 181 UpdateApp(app_id);
182 if (!kiosk_app_manager_->GetApp(app_id, &app_data))
183 return;
184
185 base::DictionaryValue app_dict;
186 PopulateAppDict(app_data, &app_dict);
187
188 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.updateApp",
189 app_dict);
190 } 182 }
191 183
192 void KioskAppsHandler::OnKioskAppDataLoadFailure(const std::string& app_id) { 184 void KioskAppsHandler::OnKioskAppDataLoadFailure(const std::string& app_id) {
193 base::StringValue app_id_value(app_id); 185 ShowError(app_id);
194 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError",
195 app_id_value);
196
197 kiosk_app_manager_->RemoveApp(app_id);
198 } 186 }
199 187
188 void KioskAppsHandler::OnKioskExtensionLoadedInCache(
189 const std::string& app_id) {
190 UpdateApp(app_id);
191 }
192
193 void KioskAppsHandler::OnKioskExtensionDownloadFailed(
194 const std::string& app_id) {
195 ShowError(app_id);
196 }
200 197
201 void KioskAppsHandler::OnGetConsumerKioskAutoLaunchStatus( 198 void KioskAppsHandler::OnGetConsumerKioskAutoLaunchStatus(
202 chromeos::KioskAppManager::ConsumerKioskAutoLaunchStatus status) { 199 chromeos::KioskAppManager::ConsumerKioskAutoLaunchStatus status) {
203 initialized_ = true; 200 initialized_ = true;
204 is_kiosk_enabled_ = 201 is_kiosk_enabled_ =
205 chromeos::UserManager::Get()->IsCurrentUserOwner() || 202 chromeos::UserManager::Get()->IsCurrentUserOwner() ||
206 !base::SysInfo::IsRunningOnChromeOS(); 203 !base::SysInfo::IsRunningOnChromeOS();
207 204
208 is_auto_launch_enabled_ = 205 is_auto_launch_enabled_ =
209 status == KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED || 206 status == KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_ENABLED ||
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return; 323 return;
327 324
328 bool disable_bailout_shortcut; 325 bool disable_bailout_shortcut;
329 CHECK(args->GetBoolean(0, &disable_bailout_shortcut)); 326 CHECK(args->GetBoolean(0, &disable_bailout_shortcut));
330 327
331 CrosSettings::Get()->SetBoolean( 328 CrosSettings::Get()->SetBoolean(
332 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, 329 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled,
333 !disable_bailout_shortcut); 330 !disable_bailout_shortcut);
334 } 331 }
335 332
333 void KioskAppsHandler::UpdateApp(const std::string& app_id) {
334 KioskAppManager::App app_data;
335 if (!kiosk_app_manager_->GetApp(app_id, &app_data))
336 return;
337
338 base::DictionaryValue app_dict;
339 PopulateAppDict(app_data, &app_dict);
340
341 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.updateApp",
342 app_dict);
343 }
344
345 void KioskAppsHandler::ShowError(const std::string& app_id) {
346 base::StringValue app_id_value(app_id);
347 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError",
348 app_id_value);
349
350 kiosk_app_manager_->RemoveApp(app_id);
351 }
352
336 } // namespace chromeos 353 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698