| OLD | NEW |
| 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" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 13 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 14 #include "chrome/browser/chromeos/login/screens/hid_detection_model.h" | 14 #include "chrome/browser/chromeos/login/screens/hid_detection_model.h" |
| 15 #include "chrome/browser/ui/webui/chromeos/login/oobe_screen.h" | 15 #include "chrome/browser/ui/webui/chromeos/login/oobe_screen.h" |
| 16 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 18 #include "chromeos/chromeos_switches.h" | 19 #include "chromeos/chromeos_switches.h" |
| 19 #include "components/login/localized_values_builder.h" | 20 #include "components/login/localized_values_builder.h" |
| 20 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 const char kJsScreenPath[] = "login.HIDDetectionScreen"; | 25 const char kJsScreenPath[] = "login.HIDDetectionScreen"; |
| 25 | 26 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 46 return; | 47 return; |
| 47 } | 48 } |
| 48 core_oobe_actor_->InitDemoModeDetection(); | 49 core_oobe_actor_->InitDemoModeDetection(); |
| 49 | 50 |
| 50 PrefService* local_state = g_browser_process->local_state(); | 51 PrefService* local_state = g_browser_process->local_state(); |
| 51 int num_of_times_dialog_was_shown = local_state->GetInteger( | 52 int num_of_times_dialog_was_shown = local_state->GetInteger( |
| 52 prefs::kTimesHIDDialogShown); | 53 prefs::kTimesHIDDialogShown); |
| 53 local_state->SetInteger(prefs::kTimesHIDDialogShown, | 54 local_state->SetInteger(prefs::kTimesHIDDialogShown, |
| 54 num_of_times_dialog_was_shown + 1); | 55 num_of_times_dialog_was_shown + 1); |
| 55 | 56 |
| 57 // useMdOobe must be updated before HID screen is shown. |
| 58 base::DictionaryValue localized_strings; |
| 59 GetOobeUI()->GetLocalizedStrings(&localized_strings); |
| 60 core_oobe_actor_->ReloadContent(localized_strings); |
| 61 |
| 56 ShowScreen(OobeScreen::SCREEN_OOBE_HID_DETECTION); | 62 ShowScreen(OobeScreen::SCREEN_OOBE_HID_DETECTION); |
| 57 } | 63 } |
| 58 | 64 |
| 59 void HIDDetectionScreenHandler::Hide() { | 65 void HIDDetectionScreenHandler::Hide() { |
| 60 } | 66 } |
| 61 | 67 |
| 62 void HIDDetectionScreenHandler::Bind(HIDDetectionModel& model) { | 68 void HIDDetectionScreenHandler::Bind(HIDDetectionModel& model) { |
| 63 model_ = &model; | 69 model_ = &model; |
| 64 BaseScreenHandler::SetBaseScreen(model_); | 70 BaseScreenHandler::SetBaseScreen(model_); |
| 65 if (page_is_ready()) | 71 if (page_is_ready()) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (model_) | 120 if (model_) |
| 115 model_->OnContinueButtonClicked(); | 121 model_->OnContinueButtonClicked(); |
| 116 } | 122 } |
| 117 | 123 |
| 118 // static | 124 // static |
| 119 void HIDDetectionScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { | 125 void HIDDetectionScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
| 120 registry->RegisterIntegerPref(prefs::kTimesHIDDialogShown, 0); | 126 registry->RegisterIntegerPref(prefs::kTimesHIDDialogShown, 0); |
| 121 } | 127 } |
| 122 | 128 |
| 123 } // namespace chromeos | 129 } // namespace chromeos |
| OLD | NEW |