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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/hid_detection_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/hid_detection_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_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/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 namespace { 23 namespace {
24 24
25 const char kJsScreenPath[] = "login.HIDDetectionScreen"; 25 const char kJsScreenPath[] = "login.HIDDetectionScreen";
26 26
27 } // namespace 27 } // namespace
28 28
29 namespace chromeos { 29 namespace chromeos {
30 30
31 HIDDetectionScreenHandler::HIDDetectionScreenHandler( 31 HIDDetectionScreenHandler::HIDDetectionScreenHandler(
32 CoreOobeView* core_oobe_view) 32 CoreOobeView* core_oobe_view)
33 : core_oobe_view_(core_oobe_view) { 33 : BaseScreenHandler(kScreenId), core_oobe_view_(core_oobe_view) {
34 set_call_js_prefix(kJsScreenPath); 34 set_call_js_prefix(kJsScreenPath);
35 } 35 }
36 36
37 HIDDetectionScreenHandler::~HIDDetectionScreenHandler() { 37 HIDDetectionScreenHandler::~HIDDetectionScreenHandler() {
38 if (screen_) 38 if (screen_)
39 screen_->OnViewDestroyed(this); 39 screen_->OnViewDestroyed(this);
40 } 40 }
41 41
42 void HIDDetectionScreenHandler::Show() { 42 void HIDDetectionScreenHandler::Show() {
43 if (!page_is_ready()) { 43 if (!page_is_ready()) {
44 show_on_init_ = true; 44 show_on_init_ = true;
45 return; 45 return;
46 } 46 }
47 core_oobe_view_->InitDemoModeDetection(); 47 core_oobe_view_->InitDemoModeDetection();
48 48
49 PrefService* local_state = g_browser_process->local_state(); 49 PrefService* local_state = g_browser_process->local_state();
50 int num_of_times_dialog_was_shown = local_state->GetInteger( 50 int num_of_times_dialog_was_shown = local_state->GetInteger(
51 prefs::kTimesHIDDialogShown); 51 prefs::kTimesHIDDialogShown);
52 local_state->SetInteger(prefs::kTimesHIDDialogShown, 52 local_state->SetInteger(prefs::kTimesHIDDialogShown,
53 num_of_times_dialog_was_shown + 1); 53 num_of_times_dialog_was_shown + 1);
54 54
55 ShowScreen(OobeScreen::SCREEN_OOBE_HID_DETECTION); 55 ShowScreen(kScreenId);
56 } 56 }
57 57
58 void HIDDetectionScreenHandler::Hide() { 58 void HIDDetectionScreenHandler::Hide() {
59 } 59 }
60 60
61 void HIDDetectionScreenHandler::Bind(HIDDetectionScreen* screen) { 61 void HIDDetectionScreenHandler::Bind(HIDDetectionScreen* screen) {
62 screen_ = screen; 62 screen_ = screen;
63 BaseScreenHandler::SetBaseScreen(screen_); 63 BaseScreenHandler::SetBaseScreen(screen_);
64 if (page_is_ready()) 64 if (page_is_ready())
65 Initialize(); 65 Initialize();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (screen_) 113 if (screen_)
114 screen_->OnContinueButtonClicked(); 114 screen_->OnContinueButtonClicked();
115 } 115 }
116 116
117 // static 117 // static
118 void HIDDetectionScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { 118 void HIDDetectionScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) {
119 registry->RegisterIntegerPref(prefs::kTimesHIDDialogShown, 0); 119 registry->RegisterIntegerPref(prefs::kTimesHIDDialogShown, 0);
120 } 120 }
121 121
122 } // namespace chromeos 122 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698