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

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

Issue 1887953002: Revert of [Merge to M50] Enable bootstrapping feature by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 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/host_pairing_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 9 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
10 #include "chromeos/chromeos_switches.h" 10 #include "chromeos/chromeos_switches.h"
11 #include "components/login/localized_values_builder.h" 11 #include "components/login/localized_values_builder.h"
12 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 namespace { 16 namespace {
17 17
18 const char kJsScreenPath[] = "login.HostPairingScreen"; 18 const char kJsScreenPath[] = "login.HostPairingScreen";
19 19
20 const char kMethodContextChanged[] = "contextChanged"; 20 const char kMethodContextChanged[] = "contextChanged";
21 21
22 // Sent from JS when screen is ready to receive context updates. 22 // Sent from JS when screen is ready to receive context updates.
23 // TODO(dzhioev): Move 'contextReady' logic to the base screen handler when 23 // TODO(dzhioev): Move 'contextReady' logic to the base screen handler when
24 // all screens migrate to context-based communications. 24 // all screens migrate to context-based communications.
25 const char kCallbackContextReady[] = "contextReady"; 25 const char kCallbackContextReady[] = "contextReady";
26 26
27 bool IsBootstrappingSlave() {
28 return base::CommandLine::ForCurrentProcess()->HasSwitch(
29 chromeos::switches::kOobeBootstrappingSlave);
30 }
31
27 } // namespace 32 } // namespace
28 33
29 HostPairingScreenHandler::HostPairingScreenHandler() 34 HostPairingScreenHandler::HostPairingScreenHandler()
30 : BaseScreenHandler(kJsScreenPath), 35 : BaseScreenHandler(kJsScreenPath),
31 delegate_(NULL), 36 delegate_(NULL),
32 show_on_init_(false), 37 show_on_init_(false),
33 js_context_ready_(false) { 38 js_context_ready_(false) {
34 } 39 }
35 40
36 HostPairingScreenHandler::~HostPairingScreenHandler() { 41 HostPairingScreenHandler::~HostPairingScreenHandler() {
(...skipping 16 matching lines...) Expand all
53 } 58 }
54 } 59 }
55 60
56 void HostPairingScreenHandler::DeclareLocalizedValues( 61 void HostPairingScreenHandler::DeclareLocalizedValues(
57 ::login::LocalizedValuesBuilder* builder) { 62 ::login::LocalizedValuesBuilder* builder) {
58 // TODO(dzhioev): Move the prefix logic to the base screen handler after 63 // TODO(dzhioev): Move the prefix logic to the base screen handler after
59 // migration. 64 // migration.
60 std::string prefix; 65 std::string prefix;
61 base::RemoveChars(kJsScreenPath, ".", &prefix); 66 base::RemoveChars(kJsScreenPath, ".", &prefix);
62 67
63 // TODO(xdai): Clean up all unrelated strings and rename others if necessary.
64 builder->Add(prefix + "WelcomeTitle", IDS_PAIRING_HOST_WELCOME_TITLE); 68 builder->Add(prefix + "WelcomeTitle", IDS_PAIRING_HOST_WELCOME_TITLE);
65 builder->Add(prefix + "WelcomeText", IDS_PAIRING_HOST_WELCOME_TEXT); 69 builder->Add(prefix + "WelcomeText", IDS_PAIRING_HOST_WELCOME_TEXT);
66 builder->Add(prefix + "ConfirmationTitle", IDS_SLAVE_CONFIRMATION_TITLE); 70 builder->Add(prefix + "ConfirmationTitle",
71 IDS_PAIRING_HOST_CONFIRMATION_TITLE);
67 builder->Add(prefix + "UpdatingTitle", IDS_PAIRING_HOST_UPDATING_TITLE); 72 builder->Add(prefix + "UpdatingTitle", IDS_PAIRING_HOST_UPDATING_TITLE);
68 builder->Add(prefix + "UpdatingText", IDS_PAIRING_HOST_UPDATING_TEXT); 73 builder->Add(prefix + "UpdatingText", IDS_PAIRING_HOST_UPDATING_TEXT);
69 builder->Add(prefix + "EnrollTitle", IDS_SLAVE_ENROLL_TITLE); 74 builder->Add(prefix + "EnrollTitle", IDS_PAIRING_ENROLL_TITLE);
70 builder->Add(prefix + "EnrollingTitle", IDS_SLAVE_ENROLLMENT_IN_PROGRESS); 75 builder->Add(prefix + "EnrollingTitle",
76 IDS_PAIRING_ENROLLMENT_IN_PROGRESS);
71 builder->Add(prefix + "DoneTitle", IDS_PAIRING_HOST_DONE_TITLE); 77 builder->Add(prefix + "DoneTitle", IDS_PAIRING_HOST_DONE_TITLE);
72 builder->Add(prefix + "DoneText", IDS_PAIRING_HOST_DONE_TEXT); 78 builder->Add(prefix + "DoneText", IDS_PAIRING_HOST_DONE_TEXT);
73 builder->Add(prefix + "EnrollmentErrorTitle", 79 builder->Add(prefix + "EnrollmentErrorTitle",
74 IDS_SLAVE_ENROLLMENT_ERROR_TITLE); 80 IDS_PAIRING_ENROLLMENT_ERROR_TITLE);
75 builder->Add(prefix + "ErrorNeedsRestart", 81 builder->Add(prefix + "ErrorNeedsRestart",
76 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT); 82 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT);
77 builder->Add(prefix + "SetupBasicConfigTitle", 83 builder->Add(prefix + "SetupBasicConfigTitle",
78 IDS_HOST_SETUP_BASIC_CONFIGURATION_TITLE); 84 IDS_HOST_SETUP_BASIC_CONFIGURATION_TITLE);
79 builder->Add(prefix + "SetupNetworkErrorTitle", 85 builder->Add(prefix + "SetupNetworkErrorTitle",
80 IDS_HOST_SETUP_NETWORK_ERROR_TITLE); 86 IDS_HOST_SETUP_NETWORK_ERROR_TITLE);
81 builder->Add(prefix + "InitializationErrorTitle", 87 builder->Add(prefix + "InitializationErrorTitle",
82 IDS_PAIRING_HOST_INITIALIZATION_ERROR_TITLE); 88 IDS_PAIRING_HOST_INITIALIZATION_ERROR_TITLE);
83 builder->Add(prefix + "ConnectionErrorTitle", 89 builder->Add(prefix + "ConnectionErrorTitle",
84 IDS_PAIRING_HOST_CONNECTION_ERROR_TITLE); 90 IDS_PAIRING_HOST_CONNECTION_ERROR_TITLE);
85 builder->Add(prefix + "ErrorNeedRestartText", 91 builder->Add(prefix + "ErrorNeedRestartText",
86 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT); 92 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT);
87 builder->Add(prefix + "ErrorNeedsRestart", 93 builder->Add(prefix + "ErrorNeedsRestart",
88 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT); 94 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT);
95
96 if (IsBootstrappingSlave()) {
97 builder->Add(prefix + "ConfirmationTitle", IDS_SLAVE_CONFIRMATION_TITLE);
98 builder->Add(prefix + "EnrollTitle", IDS_SLAVE_ENROLL_TITLE);
99 builder->Add(prefix + "EnrollingTitle", IDS_SLAVE_ENROLLMENT_IN_PROGRESS);
100 builder->Add(prefix + "EnrollmentErrorTitle",
101 IDS_SLAVE_ENROLLMENT_ERROR_TITLE);
102 }
89 } 103 }
90 104
91 void HostPairingScreenHandler::RegisterMessages() { 105 void HostPairingScreenHandler::RegisterMessages() {
92 AddPrefixedCallback(kCallbackContextReady, 106 AddPrefixedCallback(kCallbackContextReady,
93 &HostPairingScreenHandler::HandleContextReady); 107 &HostPairingScreenHandler::HandleContextReady);
94 } 108 }
95 109
96 void HostPairingScreenHandler::Show() { 110 void HostPairingScreenHandler::Show() {
97 if (!page_is_ready()) { 111 if (!page_is_ready()) {
98 show_on_init_ = true; 112 show_on_init_ = true;
(...skipping 14 matching lines...) Expand all
113 void HostPairingScreenHandler::OnContextChanged( 127 void HostPairingScreenHandler::OnContextChanged(
114 const base::DictionaryValue& diff) { 128 const base::DictionaryValue& diff) {
115 if (!js_context_ready_) { 129 if (!js_context_ready_) {
116 context_cache_.ApplyChanges(diff, NULL); 130 context_cache_.ApplyChanges(diff, NULL);
117 return; 131 return;
118 } 132 }
119 CallJS(kMethodContextChanged, diff); 133 CallJS(kMethodContextChanged, diff);
120 } 134 }
121 135
122 } // namespace chromeos 136 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698