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

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

Issue 1829453002: Enable bootstrapping feature by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CL format 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_screen.h" 9 #include "chrome/browser/ui/webui/chromeos/login/oobe_screen.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
32 } // namespace 27 } // namespace
33 28
34 HostPairingScreenHandler::HostPairingScreenHandler() 29 HostPairingScreenHandler::HostPairingScreenHandler()
35 : BaseScreenHandler(kJsScreenPath), 30 : BaseScreenHandler(kJsScreenPath),
36 delegate_(NULL), 31 delegate_(NULL),
37 show_on_init_(false), 32 show_on_init_(false),
38 js_context_ready_(false) { 33 js_context_ready_(false) {
39 } 34 }
40 35
41 HostPairingScreenHandler::~HostPairingScreenHandler() { 36 HostPairingScreenHandler::~HostPairingScreenHandler() {
(...skipping 16 matching lines...) Expand all
58 } 53 }
59 } 54 }
60 55
61 void HostPairingScreenHandler::DeclareLocalizedValues( 56 void HostPairingScreenHandler::DeclareLocalizedValues(
62 ::login::LocalizedValuesBuilder* builder) { 57 ::login::LocalizedValuesBuilder* builder) {
63 // TODO(dzhioev): Move the prefix logic to the base screen handler after 58 // TODO(dzhioev): Move the prefix logic to the base screen handler after
64 // migration. 59 // migration.
65 std::string prefix; 60 std::string prefix;
66 base::RemoveChars(kJsScreenPath, ".", &prefix); 61 base::RemoveChars(kJsScreenPath, ".", &prefix);
67 62
63 // TODO(xdai): Clean up all unrelated strings and rename others if necessary.
68 builder->Add(prefix + "WelcomeTitle", IDS_PAIRING_HOST_WELCOME_TITLE); 64 builder->Add(prefix + "WelcomeTitle", IDS_PAIRING_HOST_WELCOME_TITLE);
69 builder->Add(prefix + "WelcomeText", IDS_PAIRING_HOST_WELCOME_TEXT); 65 builder->Add(prefix + "WelcomeText", IDS_PAIRING_HOST_WELCOME_TEXT);
70 builder->Add(prefix + "ConfirmationTitle", 66 builder->Add(prefix + "ConfirmationTitle", IDS_SLAVE_CONFIRMATION_TITLE);
71 IDS_PAIRING_HOST_CONFIRMATION_TITLE);
72 builder->Add(prefix + "UpdatingTitle", IDS_PAIRING_HOST_UPDATING_TITLE); 67 builder->Add(prefix + "UpdatingTitle", IDS_PAIRING_HOST_UPDATING_TITLE);
73 builder->Add(prefix + "UpdatingText", IDS_PAIRING_HOST_UPDATING_TEXT); 68 builder->Add(prefix + "UpdatingText", IDS_PAIRING_HOST_UPDATING_TEXT);
74 builder->Add(prefix + "EnrollTitle", IDS_PAIRING_ENROLL_TITLE); 69 builder->Add(prefix + "EnrollTitle", IDS_SLAVE_ENROLL_TITLE);
75 builder->Add(prefix + "EnrollingTitle", 70 builder->Add(prefix + "EnrollingTitle", IDS_SLAVE_ENROLLMENT_IN_PROGRESS);
76 IDS_PAIRING_ENROLLMENT_IN_PROGRESS);
77 builder->Add(prefix + "DoneTitle", IDS_PAIRING_HOST_DONE_TITLE); 71 builder->Add(prefix + "DoneTitle", IDS_PAIRING_HOST_DONE_TITLE);
78 builder->Add(prefix + "DoneText", IDS_PAIRING_HOST_DONE_TEXT); 72 builder->Add(prefix + "DoneText", IDS_PAIRING_HOST_DONE_TEXT);
79 builder->Add(prefix + "EnrollmentErrorTitle", 73 builder->Add(prefix + "EnrollmentErrorTitle",
80 IDS_PAIRING_ENROLLMENT_ERROR_TITLE); 74 IDS_SLAVE_ENROLLMENT_ERROR_TITLE);
81 builder->Add(prefix + "ErrorNeedsRestart", 75 builder->Add(prefix + "ErrorNeedsRestart",
82 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT); 76 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT);
83 builder->Add(prefix + "SetupBasicConfigTitle", 77 builder->Add(prefix + "SetupBasicConfigTitle",
84 IDS_HOST_SETUP_BASIC_CONFIGURATION_TITLE); 78 IDS_HOST_SETUP_BASIC_CONFIGURATION_TITLE);
85 builder->Add(prefix + "SetupNetworkErrorTitle", 79 builder->Add(prefix + "SetupNetworkErrorTitle",
86 IDS_HOST_SETUP_NETWORK_ERROR_TITLE); 80 IDS_HOST_SETUP_NETWORK_ERROR_TITLE);
87 builder->Add(prefix + "InitializationErrorTitle", 81 builder->Add(prefix + "InitializationErrorTitle",
88 IDS_PAIRING_HOST_INITIALIZATION_ERROR_TITLE); 82 IDS_PAIRING_HOST_INITIALIZATION_ERROR_TITLE);
89 builder->Add(prefix + "ConnectionErrorTitle", 83 builder->Add(prefix + "ConnectionErrorTitle",
90 IDS_PAIRING_HOST_CONNECTION_ERROR_TITLE); 84 IDS_PAIRING_HOST_CONNECTION_ERROR_TITLE);
91 builder->Add(prefix + "ErrorNeedRestartText", 85 builder->Add(prefix + "ErrorNeedRestartText",
92 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT); 86 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT);
93 builder->Add(prefix + "ErrorNeedsRestart", 87 builder->Add(prefix + "ErrorNeedsRestart",
94 IDS_PAIRING_HOST_ERROR_NEED_RESTART_TEXT); 88 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 }
103 } 89 }
104 90
105 void HostPairingScreenHandler::RegisterMessages() { 91 void HostPairingScreenHandler::RegisterMessages() {
106 AddPrefixedCallback(kCallbackContextReady, 92 AddPrefixedCallback(kCallbackContextReady,
107 &HostPairingScreenHandler::HandleContextReady); 93 &HostPairingScreenHandler::HandleContextReady);
108 } 94 }
109 95
110 void HostPairingScreenHandler::Show() { 96 void HostPairingScreenHandler::Show() {
111 if (!page_is_ready()) { 97 if (!page_is_ready()) {
112 show_on_init_ = true; 98 show_on_init_ = true;
(...skipping 14 matching lines...) Expand all
127 void HostPairingScreenHandler::OnContextChanged( 113 void HostPairingScreenHandler::OnContextChanged(
128 const base::DictionaryValue& diff) { 114 const base::DictionaryValue& diff) {
129 if (!js_context_ready_) { 115 if (!js_context_ready_) {
130 context_cache_.ApplyChanges(diff, NULL); 116 context_cache_.ApplyChanges(diff, NULL);
131 return; 117 return;
132 } 118 }
133 CallJS(kMethodContextChanged, diff); 119 CallJS(kMethodContextChanged, diff);
134 } 120 }
135 121
136 } // namespace chromeos 122 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698