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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc

Issue 14927015: Translate device-local account IDs to user IDs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix forward declaration. Created 7 years, 7 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/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/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" 10 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 return; 62 return;
63 63
64 KioskAppManager::Apps apps; 64 KioskAppManager::Apps apps;
65 KioskAppManager::Get()->GetApps(&apps); 65 KioskAppManager::Get()->GetApps(&apps);
66 66
67 base::ListValue apps_list; 67 base::ListValue apps_list;
68 for (size_t i = 0; i < apps.size(); ++i) { 68 for (size_t i = 0; i < apps.size(); ++i) {
69 const KioskAppManager::App& app_data = apps[i]; 69 const KioskAppManager::App& app_data = apps[i];
70 70
71 scoped_ptr<base::DictionaryValue> app_info(new base::DictionaryValue); 71 scoped_ptr<base::DictionaryValue> app_info(new base::DictionaryValue);
72 app_info->SetString("id", app_data.id); 72 app_info->SetString("id", app_data.app_id);
73 app_info->SetString("label", app_data.name); 73 app_info->SetString("label", app_data.name);
74 74
75 // TODO(xiyuan): Replace data url with a URLDataSource. 75 // TODO(xiyuan): Replace data url with a URLDataSource.
76 std::string icon_url("chrome://theme/IDR_APP_DEFAULT_ICON"); 76 std::string icon_url("chrome://theme/IDR_APP_DEFAULT_ICON");
77 if (!app_data.icon.isNull()) 77 if (!app_data.icon.isNull())
78 icon_url = webui::GetBitmapDataUrl(*app_data.icon.bitmap()); 78 icon_url = webui::GetBitmapDataUrl(*app_data.icon.bitmap());
79 app_info->SetString("iconUrl", icon_url); 79 app_info->SetString("iconUrl", icon_url);
80 80
81 apps_list.Append(app_info.release()); 81 apps_list.Append(app_info.release());
82 } 82 }
(...skipping 19 matching lines...) Expand all
102 void KioskAppMenuHandler::HandleLaunchKioskApps(const base::ListValue* args) { 102 void KioskAppMenuHandler::HandleLaunchKioskApps(const base::ListValue* args) {
103 std::string app_id; 103 std::string app_id;
104 CHECK(args->GetString(0, &app_id)); 104 CHECK(args->GetString(0, &app_id));
105 105
106 KioskAppManager::App app_data; 106 KioskAppManager::App app_data;
107 CHECK(KioskAppManager::Get()->GetApp(app_id, &app_data)); 107 CHECK(KioskAppManager::Get()->GetApp(app_id, &app_data));
108 108
109 ExistingUserController::current_controller()->PrepareKioskAppLaunch(); 109 ExistingUserController::current_controller()->PrepareKioskAppLaunch();
110 110
111 // KioskAppLauncher deletes itself when done. 111 // KioskAppLauncher deletes itself when done.
112 (new KioskAppLauncher(app_id))->Start(); 112 (new KioskAppLauncher(KioskAppManager::Get(), app_id))->Start();
113 } 113 }
114 114
115 void KioskAppMenuHandler::HandleCheckKioskAppLaunchError( 115 void KioskAppMenuHandler::HandleCheckKioskAppLaunchError(
116 const base::ListValue* args) { 116 const base::ListValue* args) {
117 KioskAppLaunchError::Error error = KioskAppLaunchError::Get(); 117 KioskAppLaunchError::Error error = KioskAppLaunchError::Get();
118 if (error == KioskAppLaunchError::NONE) 118 if (error == KioskAppLaunchError::NONE)
119 return; 119 return;
120 KioskAppLaunchError::Clear(); 120 KioskAppLaunchError::Clear();
121 121
122 const std::string error_message = KioskAppLaunchError::GetErrorMessage(error); 122 const std::string error_message = KioskAppLaunchError::GetErrorMessage(error);
123 web_ui()->CallJavascriptFunction("login.AppsMenuButton.showError", 123 web_ui()->CallJavascriptFunction("login.AppsMenuButton.showError",
124 base::StringValue(error_message)); 124 base::StringValue(error_message));
125 } 125 }
126 126
127 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() { 127 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() {
128 SendKioskApps(); 128 SendKioskApps();
129 } 129 }
130 130
131 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) { 131 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) {
132 SendKioskApps(); 132 SendKioskApps();
133 } 133 }
134 134
135 } // namespace chromeos 135 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/browser/ui/webui/options/chromeos/kiosk_apps_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698