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. |
45 app_dict->SetString("id", app_data.app_id); | 48 app_dict->SetString("id", app_data.app_id); |
46 app_dict->SetString("name", app_data.name); | 49 app_dict->SetString("name", app_data.name); |
47 app_dict->SetString("iconURL", icon_url); | 50 app_dict->SetString("iconURL", icon_url); |
48 app_dict->SetBoolean( | 51 app_dict->SetBoolean( |
49 "autoLaunch", | 52 "autoLaunch", |
50 KioskAppManager::Get()->GetAutoLaunchApp() == app_data.app_id && | 53 KioskAppManager::Get()->GetAutoLaunchApp() == app_data.app_id && |
51 (KioskAppManager::Get()->IsAutoLaunchEnabled() || | 54 (KioskAppManager::Get()->IsAutoLaunchEnabled() || |
52 KioskAppManager::Get()->IsAutoLaunchRequested())); | 55 KioskAppManager::Get()->IsAutoLaunchRequested())); |
53 app_dict->SetBoolean("isLoading", app_data.is_loading); | 56 app_dict->SetBoolean("isLoading", app_data.is_loading); |
54 } | 57 } |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 347 |
345 void KioskAppsHandler::ShowError(const std::string& app_id) { | 348 void KioskAppsHandler::ShowError(const std::string& app_id) { |
346 base::StringValue app_id_value(app_id); | 349 base::StringValue app_id_value(app_id); |
347 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", | 350 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", |
348 app_id_value); | 351 app_id_value); |
349 | 352 |
350 kiosk_app_manager_->RemoveApp(app_id); | 353 kiosk_app_manager_->RemoveApp(app_id); |
351 } | 354 } |
352 | 355 |
353 } // namespace chromeos | 356 } // namespace chromeos |
OLD | NEW |