| 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/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/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chromeos/chromeos_switches.h" |
| 16 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
| 17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/web_ui.h" | 18 #include "content/public/browser/web_ui.h" |
| 19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/webui/web_ui_util.h" | 21 #include "ui/webui/web_ui_util.h" |
| 22 | 22 |
| 23 namespace chromeos { | 23 namespace chromeos { |
| 24 | 24 |
| 25 KioskAppMenuHandler::KioskAppMenuHandler() | 25 KioskAppMenuHandler::KioskAppMenuHandler() |
| 26 : initialized_(false) { | 26 : initialized_(false) { |
| 27 KioskAppManager::Get()->AddObserver(this); | 27 KioskAppManager::Get()->AddObserver(this); |
| 28 } | 28 } |
| 29 | 29 |
| 30 KioskAppMenuHandler::~KioskAppMenuHandler() { | 30 KioskAppMenuHandler::~KioskAppMenuHandler() { |
| 31 KioskAppManager::Get()->RemoveObserver(this); | 31 KioskAppManager::Get()->RemoveObserver(this); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void KioskAppMenuHandler::GetLocalizedStrings( | 34 void KioskAppMenuHandler::GetLocalizedStrings( |
| 35 base::DictionaryValue* localized_strings) { | 35 base::DictionaryValue* localized_strings) { |
| 36 localized_strings->SetBoolean( | 36 localized_strings->SetBoolean( |
| 37 "enableAppMode", | 37 "enableAppMode", |
| 38 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAppMode)); | 38 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 39 chromeos::switches::kDisableAppMode)); |
| 39 localized_strings->SetString( | 40 localized_strings->SetString( |
| 40 "showApps", | 41 "showApps", |
| 41 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON)); | 42 l10n_util::GetStringUTF16(IDS_KIOSK_APPS_BUTTON)); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void KioskAppMenuHandler::RegisterMessages() { | 45 void KioskAppMenuHandler::RegisterMessages() { |
| 45 web_ui()->RegisterMessageCallback("initializeKioskApps", | 46 web_ui()->RegisterMessageCallback("initializeKioskApps", |
| 46 base::Bind(&KioskAppMenuHandler::HandleInitializeKioskApps, | 47 base::Bind(&KioskAppMenuHandler::HandleInitializeKioskApps, |
| 47 base::Unretained(this))); | 48 base::Unretained(this))); |
| 48 web_ui()->RegisterMessageCallback("kioskAppsLoaded", | 49 web_ui()->RegisterMessageCallback("kioskAppsLoaded", |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() { | 127 void KioskAppMenuHandler::OnKioskAppsSettingsChanged() { |
| 127 SendKioskApps(); | 128 SendKioskApps(); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) { | 131 void KioskAppMenuHandler::OnKioskAppDataChanged(const std::string& app_id) { |
| 131 SendKioskApps(); | 132 SendKioskApps(); |
| 132 } | 133 } |
| 133 | 134 |
| 134 } // namespace chromeos | 135 } // namespace chromeos |
| OLD | NEW |