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

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

Issue 14306004: Put Kiosk App parameters into device settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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"
11 #include "chrome/browser/chromeos/app_mode/kiosk_app_launcher.h" 11 #include "chrome/browser/chromeos/app_mode/kiosk_app_launcher.h"
12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
13 #include "chrome/browser/chromeos/login/existing_user_controller.h" 13 #include "chrome/browser/chromeos/login/existing_user_controller.h"
14 #include "chrome/browser/chromeos/settings/cros_settings.h"
15 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
17 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
18 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/web_ui.h" 18 #include "content/public/browser/web_ui.h"
20 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/webui/web_ui_util.h" 21 #include "ui/webui/web_ui_util.h"
23 22
24 namespace chromeos { 23 namespace chromeos {
25 24
26 KioskAppMenuHandler::KioskAppMenuHandler() 25 KioskAppMenuHandler::KioskAppMenuHandler()
27 : initialized_(false) { 26 : initialized_(false) {
28 CrosSettings::Get()->AddSettingsObserver(kKioskApps, this); 27 KioskAppManager::Get()->AddObserver(this);
29 } 28 }
30 29
31 KioskAppMenuHandler::~KioskAppMenuHandler() { 30 KioskAppMenuHandler::~KioskAppMenuHandler() {
32 CrosSettings::Get()->RemoveSettingsObserver(kKioskApps, this); 31 KioskAppManager::Get()->RemoveObserver(this);
33 } 32 }
34 33
35 void KioskAppMenuHandler::GetLocalizedStrings( 34 void KioskAppMenuHandler::GetLocalizedStrings(
36 base::DictionaryValue* localized_strings) { 35 base::DictionaryValue* localized_strings) {
37 localized_strings->SetBoolean( 36 localized_strings->SetBoolean(
38 "enableAppMode", 37 "enableAppMode",
39 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppMode)); 38 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppMode));
40 localized_strings->SetString( 39 localized_strings->SetString(
41 "showApps", 40 "showApps",
42 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON)); 41 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 KioskAppLaunchError::Error error = KioskAppLaunchError::Get(); 116 KioskAppLaunchError::Error error = KioskAppLaunchError::Get();
118 if (error == KioskAppLaunchError::NONE) 117 if (error == KioskAppLaunchError::NONE)
119 return; 118 return;
120 KioskAppLaunchError::Clear(); 119 KioskAppLaunchError::Clear();
121 120
122 const std::string error_message = KioskAppLaunchError::GetErrorMessage(error); 121 const std::string error_message = KioskAppLaunchError::GetErrorMessage(error);
123 web_ui()->CallJavascriptFunction("login.AppsMenuButton.showError", 122 web_ui()->CallJavascriptFunction("login.AppsMenuButton.showError",
124 base::StringValue(error_message)); 123 base::StringValue(error_message));
125 } 124 }
126 125
127 void KioskAppMenuHandler::Observe(int type, 126 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() {
128 const content::NotificationSource& source,
129 const content::NotificationDetails& details) {
130 DCHECK_EQ(chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED, type);
131 DCHECK_EQ(kKioskApps,
132 *content::Details<const std::string>(details).ptr());
133
134 SendKioskApps(); 127 SendKioskApps();
135 } 128 }
136 129
130 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) {
131 SendKioskApps();
132 }
133
137 } // namespace chromeos 134 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698