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/options/chromeos/kiosk_apps_handler.h" | 5 #include "chrome/browser/ui/webui/options/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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // Populates app info dictionary with |app_data|. | 33 // Populates app info dictionary with |app_data|. |
34 void PopulateAppDict(const KioskAppManager::App& app_data, | 34 void PopulateAppDict(const KioskAppManager::App& app_data, |
35 base::DictionaryValue* app_dict) { | 35 base::DictionaryValue* app_dict) { |
36 std::string icon_url("chrome://theme/IDR_APP_DEFAULT_ICON"); | 36 std::string icon_url("chrome://theme/IDR_APP_DEFAULT_ICON"); |
37 | 37 |
38 // TODO(xiyuan): Replace data url with a URLDataSource. | 38 // TODO(xiyuan): Replace data url with a URLDataSource. |
39 if (!app_data.icon.isNull()) | 39 if (!app_data.icon.isNull()) |
40 icon_url = webui::GetBitmapDataUrl(*app_data.icon.bitmap()); | 40 icon_url = webui::GetBitmapDataUrl(*app_data.icon.bitmap()); |
41 | 41 |
42 app_dict->SetString("id", app_data.id); | 42 app_dict->SetString("id", app_data.app_id); |
43 app_dict->SetString("name", app_data.name); | 43 app_dict->SetString("name", app_data.name); |
44 app_dict->SetString("iconURL", icon_url); | 44 app_dict->SetString("iconURL", icon_url); |
45 app_dict->SetBoolean( | 45 app_dict->SetBoolean( |
46 "autoLaunch", | 46 "autoLaunch", |
47 KioskAppManager::Get()->GetAutoLaunchApp() == app_data.id); | 47 KioskAppManager::Get()->GetAutoLaunchApp() == app_data.app_id); |
48 app_dict->SetBoolean("isLoading", app_data.is_loading); | 48 app_dict->SetBoolean("isLoading", app_data.is_loading); |
49 } | 49 } |
50 | 50 |
51 // Sanitize app id input value and extracts app id out of it. | 51 // Sanitize app id input value and extracts app id out of it. |
52 // Returns false if an app id could not be derived out of the input. | 52 // Returns false if an app id could not be derived out of the input. |
53 bool ExtractsAppIdFromInput(const std::string& input, | 53 bool ExtractsAppIdFromInput(const std::string& input, |
54 std::string* app_id) { | 54 std::string* app_id) { |
55 if (extensions::Extension::IdIsValid(input)) { | 55 if (extensions::Extension::IdIsValid(input)) { |
56 *app_id = input; | 56 *app_id = input; |
57 return true; | 57 return true; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 std::string startup_app_id = kiosk_app_manager_->GetAutoLaunchApp(); | 242 std::string startup_app_id = kiosk_app_manager_->GetAutoLaunchApp(); |
243 if (startup_app_id != app_id) | 243 if (startup_app_id != app_id) |
244 return; | 244 return; |
245 | 245 |
246 kiosk_app_manager_->SetAutoLaunchApp(""); | 246 kiosk_app_manager_->SetAutoLaunchApp(""); |
247 } | 247 } |
248 | 248 |
249 } // namespace options | 249 } // namespace options |
250 } // namespace chromeos | 250 } // namespace chromeos |
OLD | NEW |