| 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/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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Populates app info dictionary with |app_data|. | 36 // Populates app info dictionary with |app_data|. |
| 37 void PopulateAppDict(const KioskAppManager::App& app_data, | 37 void PopulateAppDict(const KioskAppManager::App& app_data, |
| 38 base::DictionaryValue* app_dict) { | 38 base::DictionaryValue* app_dict) { |
| 39 std::string icon_url("chrome://theme/IDR_APP_DEFAULT_ICON"); | 39 std::string icon_url("chrome://theme/IDR_APP_DEFAULT_ICON"); |
| 40 | 40 |
| 41 // TODO(xiyuan): Replace data url with a URLDataSource. | 41 // TODO(xiyuan): Replace data url with a URLDataSource. |
| 42 if (!app_data.icon.isNull()) | 42 if (!app_data.icon.isNull()) |
| 43 icon_url = webui::GetBitmapDataUrl(*app_data.icon.bitmap()); | 43 icon_url = webui::GetBitmapDataUrl(*app_data.icon.bitmap()); |
| 44 | 44 |
| 45 // The items which are to be written into app_dict are also described in | |
| 46 // chrome/browser/resources/extensions/chromeos/kiosk_app_list.js in @typedef | |
| 47 // for AppDict. Please update it whenever you add or remove any keys here. | |
| 48 app_dict->SetString("id", app_data.app_id); | 45 app_dict->SetString("id", app_data.app_id); |
| 49 app_dict->SetString("name", app_data.name); | 46 app_dict->SetString("name", app_data.name); |
| 50 app_dict->SetString("iconURL", icon_url); | 47 app_dict->SetString("iconURL", icon_url); |
| 51 app_dict->SetBoolean( | 48 app_dict->SetBoolean( |
| 52 "autoLaunch", | 49 "autoLaunch", |
| 53 KioskAppManager::Get()->GetAutoLaunchApp() == app_data.app_id && | 50 KioskAppManager::Get()->GetAutoLaunchApp() == app_data.app_id && |
| 54 (KioskAppManager::Get()->IsAutoLaunchEnabled() || | 51 (KioskAppManager::Get()->IsAutoLaunchEnabled() || |
| 55 KioskAppManager::Get()->IsAutoLaunchRequested())); | 52 KioskAppManager::Get()->IsAutoLaunchRequested())); |
| 56 app_dict->SetBoolean("isLoading", app_data.is_loading); | 53 app_dict->SetBoolean("isLoading", app_data.is_loading); |
| 57 } | 54 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 344 |
| 348 void KioskAppsHandler::ShowError(const std::string& app_id) { | 345 void KioskAppsHandler::ShowError(const std::string& app_id) { |
| 349 base::StringValue app_id_value(app_id); | 346 base::StringValue app_id_value(app_id); |
| 350 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", | 347 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", |
| 351 app_id_value); | 348 app_id_value); |
| 352 | 349 |
| 353 kiosk_app_manager_->RemoveApp(app_id); | 350 kiosk_app_manager_->RemoveApp(app_id); |
| 354 } | 351 } |
| 355 | 352 |
| 356 } // namespace chromeos | 353 } // namespace chromeos |
| OLD | NEW |