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

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

Issue 2713513009: cros: Break BaseScreenHandler into two classes. (Closed)
Patch Set: Add comments, fix compile Created 3 years, 9 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
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_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"
11 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 11 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "components/login/localized_values_builder.h" 14 #include "components/login/localized_values_builder.h"
15 #include "components/strings/grit/components_strings.h" 15 #include "components/strings/grit/components_strings.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 18
19 namespace { 19 namespace {
20 20
21 const char kJsScreenPath[] = "login.KioskEnableScreen"; 21 const char kJsScreenPath[] = "login.KioskEnableScreen";
22 22
23 } // namespace 23 } // namespace
24 24
25 namespace chromeos { 25 namespace chromeos {
26 26
27 KioskEnableScreenHandler::KioskEnableScreenHandler() : weak_ptr_factory_(this) { 27 KioskEnableScreenHandler::KioskEnableScreenHandler()
28 : BaseScreenHandler(kScreenId), weak_ptr_factory_(this) {
28 set_call_js_prefix(kJsScreenPath); 29 set_call_js_prefix(kJsScreenPath);
29 } 30 }
30 31
31 KioskEnableScreenHandler::~KioskEnableScreenHandler() { 32 KioskEnableScreenHandler::~KioskEnableScreenHandler() {
32 if (delegate_) 33 if (delegate_)
33 delegate_->OnViewDestroyed(this); 34 delegate_->OnViewDestroyed(this);
34 } 35 }
35 36
36 void KioskEnableScreenHandler::Show() { 37 void KioskEnableScreenHandler::Show() {
37 if (!page_is_ready()) { 38 if (!page_is_ready()) {
38 show_on_init_ = true; 39 show_on_init_ = true;
39 return; 40 return;
40 } 41 }
41 42
42 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus( 43 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus(
43 base::Bind( 44 base::Bind(
44 &KioskEnableScreenHandler::OnGetConsumerKioskAutoLaunchStatus, 45 &KioskEnableScreenHandler::OnGetConsumerKioskAutoLaunchStatus,
45 weak_ptr_factory_.GetWeakPtr())); 46 weak_ptr_factory_.GetWeakPtr()));
46 } 47 }
47 48
48 void KioskEnableScreenHandler::OnGetConsumerKioskAutoLaunchStatus( 49 void KioskEnableScreenHandler::OnGetConsumerKioskAutoLaunchStatus(
49 KioskAppManager::ConsumerKioskAutoLaunchStatus status) { 50 KioskAppManager::ConsumerKioskAutoLaunchStatus status) {
50 is_configurable_ = 51 is_configurable_ =
51 (status == KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE); 52 (status == KioskAppManager::CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE);
52 if (!is_configurable_) { 53 if (!is_configurable_) {
53 LOG(WARNING) << "Consumer kiosk auto launch feature is not configurable!"; 54 LOG(WARNING) << "Consumer kiosk auto launch feature is not configurable!";
54 return; 55 return;
55 } 56 }
56 57
57 ShowScreen(OobeScreen::SCREEN_KIOSK_ENABLE); 58 ShowScreen(kScreenId);
58 59
59 content::NotificationService::current()->Notify( 60 content::NotificationService::current()->Notify(
60 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 61 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
61 content::NotificationService::AllSources(), 62 content::NotificationService::AllSources(),
62 content::NotificationService::NoDetails()); 63 content::NotificationService::NoDetails());
63 } 64 }
64 65
65 void KioskEnableScreenHandler::SetDelegate(Delegate* delegate) { 66 void KioskEnableScreenHandler::SetDelegate(Delegate* delegate) {
66 delegate_ = delegate; 67 delegate_ = delegate;
67 if (page_is_ready()) 68 if (page_is_ready())
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 CallJS("onCompleted", success); 134 CallJS("onCompleted", success);
134 if (success) { 135 if (success) {
135 content::NotificationService::current()->Notify( 136 content::NotificationService::current()->Notify(
136 chrome::NOTIFICATION_KIOSK_ENABLED, 137 chrome::NOTIFICATION_KIOSK_ENABLED,
137 content::NotificationService::AllSources(), 138 content::NotificationService::AllSources(),
138 content::NotificationService::NoDetails()); 139 content::NotificationService::NoDetails());
139 } 140 }
140 } 141 }
141 142
142 } // namespace chromeos 143 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698