| 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_enable_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 if (delegate_) | 37 if (delegate_) |
| 38 delegate_->OnActorDestroyed(this); | 38 delegate_->OnActorDestroyed(this); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void KioskEnableScreenHandler::Show() { | 41 void KioskEnableScreenHandler::Show() { |
| 42 if (!page_is_ready()) { | 42 if (!page_is_ready()) { |
| 43 show_on_init_ = true; | 43 show_on_init_ = true; |
| 44 return; | 44 return; |
| 45 } | 45 } |
| 46 | 46 |
| 47 KioskAppManager::Get()->GetConsumerKioskModeStatus( | 47 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus( |
| 48 base::Bind(&KioskEnableScreenHandler::OnGetConsumerKioskModeStatus, | 48 base::Bind( |
| 49 weak_ptr_factory_.GetWeakPtr())); | 49 &KioskEnableScreenHandler::OnGetConsumerKioskAutoLaunchStatus, |
| 50 weak_ptr_factory_.GetWeakPtr())); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void KioskEnableScreenHandler::OnGetConsumerKioskModeStatus( | 53 void KioskEnableScreenHandler::OnGetConsumerKioskAutoLaunchStatus( |
| 53 KioskAppManager::ConsumerKioskModeStatus status) { | 54 KioskAppManager::ConsumerKioskAutoLaunchStatus status) { |
| 54 is_configurable_ = | 55 is_configurable_ = |
| 55 (status == KioskAppManager::CONSUMER_KIOSK_MODE_CONFIGURABLE); | 56 (status == KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE); |
| 56 if (!is_configurable_) { | 57 if (!is_configurable_) { |
| 57 LOG(WARNING) << "Consumer kiosk feature is not configurable anymore!"; | 58 LOG(WARNING) << "Consumer kiosk auto launch feature is not configurable!"; |
| 58 return; | 59 return; |
| 59 } | 60 } |
| 60 | 61 |
| 61 ShowScreen(kKioskEnableScreen, NULL); | 62 ShowScreen(kKioskEnableScreen, NULL); |
| 62 | 63 |
| 63 content::NotificationService::current()->Notify( | 64 content::NotificationService::current()->Notify( |
| 64 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 65 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
| 65 content::NotificationService::AllSources(), | 66 content::NotificationService::AllSources(), |
| 66 content::NotificationService::NoDetails()); | 67 content::NotificationService::NoDetails()); |
| 67 } | 68 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if (delegate_) | 118 if (delegate_) |
| 118 delegate_->OnExit(); | 119 delegate_->OnExit(); |
| 119 | 120 |
| 120 content::NotificationService::current()->Notify( | 121 content::NotificationService::current()->Notify( |
| 121 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, | 122 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_COMPLETED, |
| 122 content::NotificationService::AllSources(), | 123 content::NotificationService::AllSources(), |
| 123 content::NotificationService::NoDetails()); | 124 content::NotificationService::NoDetails()); |
| 124 return; | 125 return; |
| 125 } | 126 } |
| 126 | 127 |
| 127 KioskAppManager::Get()->EnableConsumerModeKiosk( | 128 KioskAppManager::Get()->EnableConsumerModeKioskAutoStart( |
| 128 base::Bind(&KioskEnableScreenHandler::OnEnableConsumerModeKiosk, | 129 base::Bind(&KioskEnableScreenHandler::OnEnableConsumerModeKioskAutoStart, |
| 129 weak_ptr_factory_.GetWeakPtr())); | 130 weak_ptr_factory_.GetWeakPtr())); |
| 130 } | 131 } |
| 131 | 132 |
| 132 void KioskEnableScreenHandler::OnEnableConsumerModeKiosk(bool success) { | 133 void KioskEnableScreenHandler::OnEnableConsumerModeKioskAutoStart( |
| 134 bool success) { |
| 133 if (!success) | 135 if (!success) |
| 134 LOG(WARNING) << "Consumer kiosk mode can't be enabled!"; | 136 LOG(WARNING) << "Consumer kiosk mode can't be enabled!"; |
| 135 | 137 |
| 136 CallJS("onCompleted", success); | 138 CallJS("onCompleted", success); |
| 137 if (success) { | 139 if (success) { |
| 138 content::NotificationService::current()->Notify( | 140 content::NotificationService::current()->Notify( |
| 139 chrome::NOTIFICATION_KIOSK_ENABLED, | 141 chrome::NOTIFICATION_KIOSK_ENABLED, |
| 140 content::NotificationService::AllSources(), | 142 content::NotificationService::AllSources(), |
| 141 content::NotificationService::NoDetails()); | 143 content::NotificationService::NoDetails()); |
| 142 } | 144 } |
| 143 } | 145 } |
| 144 | 146 |
| 145 } // namespace chromeos | 147 } // namespace chromeos |
| OLD | NEW |