summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxdai <xdai@chromium.org>2015-12-16 12:00:49 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-16 20:02:08 +0000
commit1bc23b7f85b9d927c23a85458ce0e10e644a4b61 (patch)
tree60770b2d8078f123d8632778e30c1b63b302ef41
parent2ac89ad12d6f0c914c673e57299f69e6d2046941 (diff)
downloadchromium_src-1bc23b7f85b9d927c23a85458ce0e10e644a4b61.zip
chromium_src-1bc23b7f85b9d927c23a85458ce0e10e644a4b61.tar.gz
chromium_src-1bc23b7f85b9d927c23a85458ce0e10e644a4b61.tar.bz2
1) Add basic configuration (network connection, language, keyboard layout, timezone) setup page.
2) Add network setup error page. 3) Format the i18n style in host-pairing-screen.html and controller-pairing-screen.html. BUG=564370 Review URL: https://codereview.chromium.org/1519883003 Cr-Commit-Position: refs/heads/master@{#365597}
-rw-r--r--chrome/app/chromeos_strings.grdp8
-rw-r--r--chrome/browser/chromeos/login/helper.cc1
-rw-r--r--chrome/browser/chromeos/login/screens/controller_pairing_screen.cc2
-rw-r--r--chrome/browser/chromeos/login/screens/host_pairing_screen.cc8
-rw-r--r--chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc2
-rw-r--r--chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h2
-rw-r--r--chrome/browser/chromeos/login/screens/network_screen.cc17
-rw-r--r--chrome/browser/chromeos/login/screens/network_screen.h7
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc35
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.h3
-rw-r--r--chrome/browser/resources/chromeos/login/controller-pairing-screen.html58
-rw-r--r--chrome/browser/resources/chromeos/login/controller-pairing-screen.js10
-rw-r--r--chrome/browser/resources/chromeos/login/host-pairing-screen.html28
-rw-r--r--chrome/browser/resources/chromeos/login/host-pairing-screen.js7
-rw-r--r--chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc57
-rw-r--r--chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc29
-rw-r--r--components/pairing/bluetooth_host_pairing_controller.cc34
-rw-r--r--components/pairing/bluetooth_host_pairing_controller.h2
-rw-r--r--components/pairing/fake_host_pairing_controller.cc4
-rw-r--r--components/pairing/fake_host_pairing_controller.h1
-rw-r--r--components/pairing/host_pairing_controller.h14
21 files changed, 223 insertions, 106 deletions
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index a47598c..62de8f2 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -5966,6 +5966,14 @@ All users must sign out to continue.
Chromebox needs to restart...
</message>
+ <!-- Strings for the bootstrapping OOBE process -->
+ <message name="IDS_HOST_SETUP_BASIC_CONFIGURATION_TITLE" desc="Title of the host's basic configuration setup page during the bootstrapping process.">
+ Setup network connection, language, keyboard layout...
+ </message>
+ <message name="IDS_HOST_SETUP_NETWORK_ERROR_TITLE" desc="Title of the host's network error page during the bootstrapping process.">
+ Could not set up network
+ </message>
+
<!-- Strings for the le OAuth-based enterprise enrollment page -->
<message name="IDS_ENTERPRISE_ENROLLMENT_STATUS_REGISTRATION_FAILED" desc="Error message shown on the enrollment screen upon failed device registration.">
Error when registering the device with the server: <ph name="CLIENT_ERROR">$1<ex>Failed to connect to the server</ex></ph>.
diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc
index e60a789..56a3f54 100644
--- a/chrome/browser/chromeos/login/helper.cc
+++ b/chrome/browser/chromeos/login/helper.cc
@@ -170,6 +170,7 @@ void NetworkStateHelper::CreateAndConnectNetworkFromOnc(
base::DictionaryValue* toplevel_onc = nullptr;
if (!root || !root->GetAsDictionary(&toplevel_onc)) {
LOG(ERROR) << "Invalid JSON Dictionary: " << error;
+ error_callback.Run();
return;
}
diff --git a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc
index 427d164..3114cba 100644
--- a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc
+++ b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc
@@ -102,8 +102,8 @@ void ControllerPairingScreen::PairingStageChanged(Stage new_stage) {
}
case ControllerPairingController::STAGE_PAIRING_DONE: {
if (delegate_) {
- delegate_->SetHostNetwork();
delegate_->SetHostConfiguration();
+ delegate_->SetHostNetwork();
}
break;
}
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen.cc b/chrome/browser/chromeos/login/screens/host_pairing_screen.cc
index b615fed..021ab6f 100644
--- a/chrome/browser/chromeos/login/screens/host_pairing_screen.cc
+++ b/chrome/browser/chromeos/login/screens/host_pairing_screen.cc
@@ -79,6 +79,14 @@ void HostPairingScreen::PairingStageChanged(Stage new_stage) {
remora_controller_->GetConfirmationCode());
break;
}
+ case HostPairingController::STAGE_SETUP_BASIC_CONFIGURATION: {
+ desired_page = kPageSetupBasicConfiguration;
+ break;
+ }
+ case HostPairingController::STAGE_SETUP_NETWORK_ERROR: {
+ desired_page = kPageSetupNetworkError;
+ break;
+ }
case HostPairingController::STAGE_WAITING_FOR_CREDENTIALS: {
desired_page = kPageEnrollmentIntroduction;
break;
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc b/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc
index e42e171..6eebd95 100644
--- a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc
+++ b/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.cc
@@ -18,6 +18,8 @@ const char kContextKeyUpdateProgress[] = "updateProgress";
const char kPageWelcome[] = "welcome";
const char kPageCodeConfirmation[] = "code-confirmation";
+const char kPageSetupBasicConfiguration[] = "setup-basic-configuration";
+const char kPageSetupNetworkError[] = "setup-network-error";
const char kPageUpdate[] = "update";
const char kPageEnrollmentIntroduction[] = "enrollment-introduction";
const char kPageEnrollment[] = "enrollment";
diff --git a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h b/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h
index a021ea1..e260c15 100644
--- a/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h
+++ b/chrome/browser/chromeos/login/screens/host_pairing_screen_actor.h
@@ -27,6 +27,8 @@ extern const char kContextKeyUpdateProgress[];
// Pages names.
extern const char kPageWelcome[];
extern const char kPageCodeConfirmation[];
+extern const char kPageSetupBasicConfiguration[];
+extern const char kPageSetupNetworkError[];
extern const char kPageUpdate[];
extern const char kPageEnrollmentIntroduction[];
extern const char kPageEnrollment[];
diff --git a/chrome/browser/chromeos/login/screens/network_screen.cc b/chrome/browser/chromeos/login/screens/network_screen.cc
index 8c25a17..8d83dc0 100644
--- a/chrome/browser/chromeos/login/screens/network_screen.cc
+++ b/chrome/browser/chromeos/login/screens/network_screen.cc
@@ -229,11 +229,11 @@ void NetworkScreen::GetConnectedWifiNetwork(std::string* out_onc_spec) {
}
void NetworkScreen::CreateAndConnectNetworkFromOnc(
- const std::string& onc_spec) {
+ const std::string& onc_spec,
+ const base::Closure& success_callback,
+ const base::Closure& failed_callback) {
network_state_helper_->CreateAndConnectNetworkFromOnc(
- onc_spec, base::Bind(&base::DoNothing),
- base::Bind(&NetworkScreen::OnConnectNetworkFromOncFailed,
- base::Unretained(this)));
+ onc_spec, success_callback, failed_callback);
}
void NetworkScreen::AddObserver(Observer* observer) {
@@ -441,13 +441,4 @@ void NetworkScreen::OnSystemTimezoneChanged() {
GetContextEditor().SetString(kContextKeyTimezone, current_timezone_id);
}
-void NetworkScreen::OnConnectNetworkFromOncFailed() {
- if (!network_state_helper_->IsConnected() && view_) {
- // Show error bubble.
- view_->ShowError(l10n_util::GetStringFUTF16(
- IDS_NETWORK_SELECTION_ERROR,
- l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_OS_NAME)));
- }
-}
-
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/network_screen.h b/chrome/browser/chromeos/login/screens/network_screen.h
index 597b90a..114f4d8 100644
--- a/chrome/browser/chromeos/login/screens/network_screen.h
+++ b/chrome/browser/chromeos/login/screens/network_screen.h
@@ -94,7 +94,9 @@ class NetworkScreen : public NetworkModel,
// Currently We can only get unsecured Wifi network configuration from shark
// that can be applied to remora. Returns the network ONC configuration.
void GetConnectedWifiNetwork(std::string* out_onc_spec);
- void CreateAndConnectNetworkFromOnc(const std::string& onc_spec);
+ void CreateAndConnectNetworkFromOnc(const std::string& onc_spec,
+ const base::Closure& success_callback,
+ const base::Closure& failed_callback);
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
@@ -160,9 +162,6 @@ class NetworkScreen : public NetworkModel,
// Callback when the system timezone settings is changed.
void OnSystemTimezoneChanged();
- // Called when connection the network from ONC failed.
- void OnConnectNetworkFromOncFailed();
-
// True if subscribed to network change notification.
bool is_network_subscribed_;
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 266a873..114229f 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -60,6 +60,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
+#include "chrome/browser/ui/webui/help/help_utils_chromeos.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
#include "chromeos/audio/cras_audio_handler.h"
@@ -152,6 +153,17 @@ bool IsBootstrappingMaster() {
chromeos::switches::kOobeBootstrappingMaster);
}
+bool NetworkAllowUpdate(const chromeos::NetworkState* network) {
+ if (!network || !network->IsConnectedState())
+ return false;
+ if (network->type() == shill::kTypeBluetooth ||
+ (network->type() == shill::kTypeCellular &&
+ !help_utils_chromeos::IsUpdateOverCellularAllowed())) {
+ return false;
+ }
+ return true;
+}
+
#if defined(GOOGLE_CHROME_BUILD)
void InitializeCrashReporter() {
// The crash reporter initialization needs IO to complete.
@@ -1104,8 +1116,22 @@ void WizardController::ConfigureHostRequested(
void WizardController::AddNetworkRequested(const std::string& onc_spec) {
NetworkScreen* network_screen = NetworkScreen::Get(this);
- network_screen->CreateAndConnectNetworkFromOnc(onc_spec);
- InitiateOOBEUpdate();
+ const chromeos::NetworkState* network_state = chromeos::NetworkHandler::Get()
+ ->network_state_handler()
+ ->DefaultNetwork();
+
+ if (NetworkAllowUpdate(network_state)) {
+ // Don't block the OOBE update and the following enrollment process.
+ InitiateOOBEUpdate();
+ network_screen->CreateAndConnectNetworkFromOnc(
+ onc_spec, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing));
+ } else {
+ network_screen->CreateAndConnectNetworkFromOnc(
+ onc_spec, base::Bind(&WizardController::InitiateOOBEUpdate,
+ weak_factory_.GetWeakPtr()),
+ base::Bind(&WizardController::OnSetHostNetworkFailed,
+ weak_factory_.GetWeakPtr()));
+ }
}
void WizardController::OnEnableDebuggingScreenRequested() {
@@ -1339,6 +1365,11 @@ void WizardController::OnSharkConnected(
ShowHostPairingScreen();
}
+void WizardController::OnSetHostNetworkFailed() {
+ remora_controller_->OnNetworkConnectivityChanged(
+ pairing_chromeos::HostPairingController::CONNECTIVITY_NONE);
+}
+
void WizardController::StartEnrollmentScreen() {
VLOG(1) << "Showing enrollment screen.";
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h
index 935014c..1b5f1bc 100644
--- a/chrome/browser/chromeos/login/wizard_controller.h
+++ b/chrome/browser/chromeos/login/wizard_controller.h
@@ -323,6 +323,9 @@ class WizardController : public BaseScreenDelegate,
void OnSharkConnected(
scoped_ptr<pairing_chromeos::HostPairingController> pairing_controller);
+ // Callback function for AddNetworkRequested().
+ void OnSetHostNetworkFailed();
+
// Start the enrollment screen using the config from
// |prescribed_enrollment_config_|.
void StartEnrollmentScreen();
diff --git a/chrome/browser/resources/chromeos/login/controller-pairing-screen.html b/chrome/browser/resources/chromeos/login/controller-pairing-screen.html
index 664f11f..5f97503 100644
--- a/chrome/browser/resources/chromeos/login/controller-pairing-screen.html
+++ b/chrome/browser/resources/chromeos/login/controller-pairing-screen.html
@@ -112,53 +112,53 @@ controller-pairing-page::shadow #top {
attr-for-selected="name" class="fit">
<controller-pairing-page name="devices-discovery" class="big-font">
<div class="title"
- i18n-content="login_ControllerPairingScreen_welcomeTitle">
+ i18n-content="loginControllerPairingScreenWelcomeTitle">
</div>
- <div i18n-content="login_ControllerPairingScreen_searching"></div>
+ <div i18n-content="loginControllerPairingScreenSearching"></div>
<paper-button class="help-button" on-tap="helpButtonClicked_"
- i18n-content="login_ControllerPairingScreen_helpBtn">
+ i18n-content="loginControllerPairingScreenHelpBtn">
</paper-button>
</controller-pairing-page>
<controller-pairing-page name="device-select" class="split">
<div class="title"
- i18n-content="login_ControllerPairingScreen_selectTitle">
+ i18n-content="loginControllerPairingScreenSelectTitle">
</div>
<pairing-device-list devices="[[C.devices]]"
selected="{{selectedDevice}}">
</pairing-device-list>
<paper-button class="help-button" on-tap="helpButtonClicked_"
- i18n-content="login_ControllerPairingScreen_helpBtn">
+ i18n-content="loginControllerPairingScreenHelpBtn">
</paper-button>
<paper-button on-tap="userActed" action="chooseDevice"
disabled$="[[C.controlsDisabled]]"
- i18n-content="login_ControllerPairingScreen_connectBtn">
+ i18n-content="loginControllerPairingScreenConnectBtn">
</paper-button>
</controller-pairing-page>
<controller-pairing-page name="device-not-found">
<div class="title"
- i18n-content="login_ControllerPairingScreen_troubleConnectingTitle">
+ i18n-content="loginControllerPairingScreenTroubleConnectingTitle">
</div>
- <div i18n-content="login_ControllerPairingScreen_connectingAdvice">
+ <div i18n-content="loginControllerPairingScreenConnectingAdvice">
</div>
<paper-button on-tap="userActed" action="repeatDiscovery"
- i18n-content="login_ControllerPairingScreen_adviceGotItBtn">
+ i18n-content="loginControllerPairingScreenAdviceGotItBtn">
</paper-button>
</controller-pairing-page>
<controller-pairing-page name="establishing-connection" class="split">
<div class="title"
- i18n-content="login_ControllerPairingScreen_selectTitle">
+ i18n-content="loginControllerPairingScreenSelectTitle">
</div>
<pairing-device-list devices="[[C.devices]]"
selected="{{selectedDevice}}" connecting>
</pairing-device-list>
<paper-button class="help-button" on-tap="helpButtonClicked_"
- i18n-content="login_ControllerPairingScreen_helpBtn">
+ i18n-content="loginControllerPairingScreenHelpBtn">
</paper-button>
<paper-button disabled
- i18n-content="login_ControllerPairingScreen_connecting">
+ i18n-content="loginControllerPairingScreenConnecting">
</paper-button>
</controller-pairing-page>
@@ -174,57 +174,57 @@ controller-pairing-page::shadow #top {
<controller-pairing-page name="code-confirmation" class="split">
<div class="title"
- i18n-content="login_ControllerPairingScreen_confirmationTitle">
+ i18n-content="loginControllerPairingScreenConfirmationTitle">
</div>
<div
- i18n-content="login_ControllerPairingScreen_confirmationQuestion">
+ i18n-content="loginControllerPairingScreenConfirmationQuestion">
</div>
<div id="code"><span>[[C.code]]</span></div>
<paper-button on-tap="userActed" action="rejectCode"
disabled$="[[C.controlsDisabled]"
- i18n-content="login_ControllerPairingScreen_rejectCodeBtn">
+ i18n-content="loginControllerPairingScreenRejectCodeBtn">
</paper-button>
<paper-button on-tap="userActed" action="acceptCode"
disabled$="[[C.controlsDisabled]]"
- i18n-content="login_ControllerPairingScreen_acceptCodeBtn">
+ i18n-content="loginControllerPairingScreenAcceptCodeBtn">
</paper-button>
</controller-pairing-page>
<controller-pairing-page name="host-update" class="split">
<div class="title"
- i18n-content="login_ControllerPairingScreen_updateTitle">
+ i18n-content="loginControllerPairingScreenUpdateTitle">
</div>
- <div i18n-content="login_ControllerPairingScreen_updateText"></div>
+ <div i18n-content="loginControllerPairingScreenUpdateText"></div>
<paper-progress indeterminate></paper-progress>
</controller-pairing-page>
<controller-pairing-page name="host-connection-lost" class="split">
<div class="title"
- i18n-content="login_ControllerPairingScreen_connectionLostTitle">
+ i18n-content="loginControllerPairingScreenConnectionLostTitle">
</div>
- <div i18n-content="login_ControllerPairingScreen_connectionLostText">
+ <div i18n-content="loginControllerPairingScreenConnectionLostText">
</div>
<paper-progress indeterminate></paper-progress>
</controller-pairing-page>
<controller-pairing-page name="enrollment-introduction" class="split">
<div class="title"
- i18n-content="login_ControllerPairingScreen_enrollTitle">
+ i18n-content="loginControllerPairingScreenEnrollTitle">
</div>
- <p i18n-content="login_ControllerPairingScreen_enrollText1"></p>
+ <p i18n-content="loginControllerPairingScreenEnrollText1"></p>
<p>
- <strong i18n-content="login_ControllerPairingScreen_enrollText2">
+ <strong i18n-content="loginControllerPairingScreenEnrollText2">
</strong>
</p>
<paper-button on-tap="userActed" action="proceedToAuthentication"
disabled$="[[C.controlsDisabled]]"
- i18n-content="login_ControllerPairingScreen_continueBtn">
+ i18n-content="loginControllerPairingScreenContinueBtn">
</paper-button>
</controller-pairing-page>
<controller-pairing-page name="authentication" class="split">
<div class="title"
- i18n-content="login_ControllerPairingScreen_enrollTitle">
+ i18n-content="loginControllerPairingScreenEnrollTitle">
</div>
<div>Not implemented.</div>
</controller-pairing-page>
@@ -238,21 +238,21 @@ controller-pairing-page::shadow #top {
<controller-pairing-page name="host-enrollment-error" class="progress">
<div class="title"
- i18n-content="login_ControllerPairingScreen_enrollmentErrorTitle">
+ i18n-content="loginControllerPairingScreenEnrollmentErrorTitle">
</div>
<div
- i18n-content="login_ControllerPairingScreen_enrollmentErrorHostRestarts">
+ i18n-content="loginControllerPairingScreenEnrollmentErrorHostRestarts">
</div>
</controller-pairing-page>
<controller-pairing-page name="pairing-done" class="big-font">
<div class="title"
- i18n-content="login_ControllerPairingScreen_successTitle">
+ i18n-content="loginControllerPairingScreenSuccessTitle">
</div>
<div><span>[[getSuccessMessage_(selectedDevice)]]</div>
<paper-button on-tap="userActed" action="startSession"
disabled$="{{C.controlsDisabled}}"
- i18n-content="login_ControllerPairingScreen_continueToHangoutsBtn">
+ i18n-content="loginControllerPairingScreenContinueToHangoutsBtn">
</paper-button>
</controller-pairing-page>
</neon-animated-pages>
diff --git a/chrome/browser/resources/chromeos/login/controller-pairing-screen.js b/chrome/browser/resources/chromeos/login/controller-pairing-screen.js
index 81560e2..f2da389 100644
--- a/chrome/browser/resources/chromeos/login/controller-pairing-screen.js
+++ b/chrome/browser/resources/chromeos/login/controller-pairing-screen.js
@@ -115,6 +115,10 @@ Polymer((function() {
this.commitContextChanges();
},
+ i18n: function(args) {
+ return loadTimeData.getStringF.apply(loadTimeData, args);
+ },
+
deviceListChanged_: function() {
this.selectedDevice = this.context.get(CONTEXT_KEY_SELECTED_DEVICE, null);
},
@@ -130,11 +134,13 @@ Polymer((function() {
},
getHostEnrollmentStepTitle_: function(domain) {
- return this.i18n(['enrollmentInProgress', domain]);
+ return this.i18n(['loginControllerPairingScreenEnrollmentInProgress',
+ domain]);
},
getSuccessMessage_: function(selectedDevice) {
- return this.i18n(['successText', selectedDevice]);
+ return this.i18n(['loginControllerPairingScreenSuccessText',
+ selectedDevice]);
}
};
})());
diff --git a/chrome/browser/resources/chromeos/login/host-pairing-screen.html b/chrome/browser/resources/chromeos/login/host-pairing-screen.html
index ef6e82e..dc9fb84 100644
--- a/chrome/browser/resources/chromeos/login/host-pairing-screen.html
+++ b/chrome/browser/resources/chromeos/login/host-pairing-screen.html
@@ -45,22 +45,32 @@
<neon-animated-pages attr-for-selected="name" selected="[[C.page]]"
entry-animation="fade-in-animation" exit-animation="fade-out-animation">
<host-pairing-page name="welcome">
- <div class="title" i18n-content="login_HostPairingScreen_welcomeTitle">
+ <div class="title" i18n-content="loginHostPairingScreenWelcomeTitle">
</div>
- <div i18n-content="login_HostPairingScreen_welcomeText"></div>
+ <div i18n-content="loginHostPairingScreenWelcomeText"></div>
</host-pairing-page>
<host-pairing-page name="code-confirmation">
<div class="title"
- i18n-content="login_HostPairingScreen_confirmationTitle">
+ i18n-content="loginHostPairingScreenConfirmationTitle">
</div>
<div id="code">{{C.code}}</div>
</host-pairing-page>
+ <host-pairing-page name="setup-basic-configuration">
+ <div class="title"
+ i18n-content="loginHostPairingScreenSetupBasicConfigTitle">
+ </div>
+ </host-pairing-page>
+ <host-pairing-page name="setup-network-error">
+ <div class="title"
+ i18n-content="loginHostPairingScreenSetupNetworkErrorTitle">
+ </div>
+ </host-pairing-page>
<host-pairing-page name="update">
- <div class="title" i18n-content="login_HostPairingScreen_updatingTitle">
+ <div class="title" i18n-content="loginHostPairingScreenUpdatingTitle">
</div>
</host-pairing-page>
<host-pairing-page name="enrollment-introduction">
- <div class="title" i18n-content="login_HostPairingScreen_enrollTitle">
+ <div class="title" i18n-content="loginHostPairingScreenEnrollTitle">
</div>
</host-pairing-page>
<host-pairing-page name="enrollment">
@@ -73,14 +83,14 @@
</host-pairing-page>
<host-pairing-page name="enrollment-error">
<div class="title"
- i18n-content="login_HostPairingScreen_enrollmentErrorTitle">
+ i18n-content="loginHostPairingScreenEnrollmentErrorTitle">
</div>
- <div i18n-content="login_HostPairingScreen_errorNeedsRestart"></div>
+ <div i18n-content="loginHostPairingScreenErrorNeedsRestart"></div>
</host-pairing-page>
<host-pairing-page name="pairing-done">
- <div class="title" i18n-content="login_HostPairingScreen_doneTitle">
+ <div class="title" i18n-content="loginHostPairingScreenDoneTitle">
</div>
- <div i18n-content="login_HostPairingScreen_doneText"></div>
+ <div i18n-content="loginHostPairingScreenDoneText"></div>
</host-pairing-page>
</neon-animated-pages>
<paper-icon-item id="device-indicator">
diff --git a/chrome/browser/resources/chromeos/login/host-pairing-screen.js b/chrome/browser/resources/chromeos/login/host-pairing-screen.js
index 25baa321..7263fe2 100644
--- a/chrome/browser/resources/chromeos/login/host-pairing-screen.js
+++ b/chrome/browser/resources/chromeos/login/host-pairing-screen.js
@@ -31,8 +31,13 @@ Polymer((function() {
this.send(CALLBACK_CONTEXT_READY);
},
+ i18n: function(args) {
+ return loadTimeData.getStringF.apply(loadTimeData, args);
+ },
+
getEnrollmentStepTitle_: function(enrollmentDomain) {
- return this.i18n(['enrollingTitle', enrollmentDomain]);
+ return this.i18n(['loginHostPairingScreenEnrollingTitle',
+ enrollmentDomain]);
}
};
})());
diff --git a/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc
index b92a6bf..713b96e 100644
--- a/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handler.cc
@@ -61,45 +61,44 @@ void ControllerPairingScreenHandler::DeclareLocalizedValues(
// TODO(dzhioev): Move the prefix logic to the base screen handler after
// migration.
std::string prefix;
- base::ReplaceChars(kJsScreenPath, ".", "_", &prefix);
- prefix += "_";
+ base::RemoveChars(kJsScreenPath, ".", &prefix);
- builder->Add(prefix + "welcomeTitle", IDS_PAIRING_CONTROLLER_WELCOME);
- builder->Add(prefix + "searching", IDS_PAIRING_CONTROLLER_SEARCHING);
- builder->Add(prefix + "helpBtn", IDS_PAIRING_NEED_HELP);
- builder->Add(prefix + "troubleConnectingTitle",
+ builder->Add(prefix + "WelcomeTitle", IDS_PAIRING_CONTROLLER_WELCOME);
+ builder->Add(prefix + "Searching", IDS_PAIRING_CONTROLLER_SEARCHING);
+ builder->Add(prefix + "HelpBtn", IDS_PAIRING_NEED_HELP);
+ builder->Add(prefix + "TroubleConnectingTitle",
IDS_PAIRING_CONTROLLER_TROUBLE_CONNECTING);
- builder->Add(prefix + "connectingAdvice",
+ builder->Add(prefix + "ConnectingAdvice",
IDS_PAIRING_CONTROLLER_CONNECTING_ADVICE);
- builder->Add(prefix + "adviceGotItBtn", IDS_PAIRING_CONTROLLER_ADVICE_GOT_IT);
- builder->Add(prefix + "selectTitle", IDS_PAIRING_CONTROLLER_SELECT_TITLE);
- builder->Add(prefix + "connectBtn", IDS_PAIRING_CONTROLLER_CONNECT);
- builder->Add(prefix + "connecting", IDS_PAIRING_CONTROLLER_CONNECTING);
- builder->Add(prefix + "confirmationTitle",
+ builder->Add(prefix + "AdviceGotItBtn", IDS_PAIRING_CONTROLLER_ADVICE_GOT_IT);
+ builder->Add(prefix + "SelectTitle", IDS_PAIRING_CONTROLLER_SELECT_TITLE);
+ builder->Add(prefix + "ConnectBtn", IDS_PAIRING_CONTROLLER_CONNECT);
+ builder->Add(prefix + "Connecting", IDS_PAIRING_CONTROLLER_CONNECTING);
+ builder->Add(prefix + "ConfirmationTitle",
IDS_PAIRING_CONTROLLER_CONFIRMATION_TITLE);
- builder->Add(prefix + "confirmationQuestion",
+ builder->Add(prefix + "ConfirmationQuestion",
IDS_PAIRING_CONTROLLER_CONFIRMATION_QUESTION);
- builder->Add(prefix + "rejectCodeBtn", IDS_PAIRING_CONTROLLER_REJECT_CODE);
- builder->Add(prefix + "acceptCodeBtn", IDS_PAIRING_CONTROLLER_ACCEPT_CODE);
- builder->Add(prefix + "updateTitle", IDS_PAIRING_CONTROLLER_UPDATE_TITLE);
- builder->Add(prefix + "updateText", IDS_PAIRING_CONTROLLER_UPDATE_TEXT);
- builder->Add(prefix + "connectionLostTitle",
+ builder->Add(prefix + "RejectCodeBtn", IDS_PAIRING_CONTROLLER_REJECT_CODE);
+ builder->Add(prefix + "AcceptCodeBtn", IDS_PAIRING_CONTROLLER_ACCEPT_CODE);
+ builder->Add(prefix + "UpdateTitle", IDS_PAIRING_CONTROLLER_UPDATE_TITLE);
+ builder->Add(prefix + "UpdateText", IDS_PAIRING_CONTROLLER_UPDATE_TEXT);
+ builder->Add(prefix + "ConnectionLostTitle",
IDS_PAIRING_CONTROLLER_CONNECTION_LOST_TITLE);
- builder->Add(prefix + "connectionLostText",
+ builder->Add(prefix + "ConnectionLostText",
IDS_PAIRING_CONTROLLER_CONNECTION_LOST_TEXT);
- builder->Add(prefix + "enrollTitle", IDS_PAIRING_ENROLL_TITLE);
- builder->Add(prefix + "enrollText1", IDS_PAIRING_CONTROLLER_ENROLL_TEXT_1);
- builder->Add(prefix + "enrollText2", IDS_PAIRING_CONTROLLER_ENROLL_TEXT_2);
- builder->Add(prefix + "continueBtn", IDS_PAIRING_CONTROLLER_CONTINUE);
- builder->Add(prefix + "enrollmentInProgress",
+ builder->Add(prefix + "EnrollTitle", IDS_PAIRING_ENROLL_TITLE);
+ builder->Add(prefix + "EnrollText1", IDS_PAIRING_CONTROLLER_ENROLL_TEXT_1);
+ builder->Add(prefix + "EnrollText2", IDS_PAIRING_CONTROLLER_ENROLL_TEXT_2);
+ builder->Add(prefix + "ContinueBtn", IDS_PAIRING_CONTROLLER_CONTINUE);
+ builder->Add(prefix + "EnrollmentInProgress",
IDS_PAIRING_ENROLLMENT_IN_PROGRESS);
- builder->Add(prefix + "enrollmentErrorTitle",
+ builder->Add(prefix + "EnrollmentErrorTitle",
IDS_PAIRING_ENROLLMENT_ERROR_TITLE);
- builder->Add(prefix + "enrollmentErrorHostRestarts",
+ builder->Add(prefix + "EnrollmentErrorHostRestarts",
IDS_PAIRING_CONTROLLER_ENROLLMENT_ERROR_HOST_RESTARTS);
- builder->Add(prefix + "successTitle", IDS_PAIRING_CONTROLLER_SUCCESS_TITLE);
- builder->Add(prefix + "successText", IDS_PAIRING_CONTROLLER_SUCCESS_TEXT);
- builder->Add(prefix + "continueToHangoutsBtn",
+ builder->Add(prefix + "SuccessTitle", IDS_PAIRING_CONTROLLER_SUCCESS_TITLE);
+ builder->Add(prefix + "SuccessText", IDS_PAIRING_CONTROLLER_SUCCESS_TEXT);
+ builder->Add(prefix + "ContinueToHangoutsBtn",
IDS_PAIRING_CONTROLLER_CONTINUE_TO_HANGOUTS);
}
diff --git a/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc
index 6646526..0c0e772 100644
--- a/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.cc
@@ -56,24 +56,27 @@ void HostPairingScreenHandler::DeclareLocalizedValues(
// TODO(dzhioev): Move the prefix logic to the base screen handler after
// migration.
std::string prefix;
- base::ReplaceChars(kJsScreenPath, ".", "_", &prefix);
- prefix += "_";
+ base::RemoveChars(kJsScreenPath, ".", &prefix);
- builder->Add(prefix + "welcomeTitle", IDS_PAIRING_HOST_WELCOME_TITLE);
- builder->Add(prefix + "welcomeText", IDS_PAIRING_HOST_WELCOME_TEXT);
- builder->Add(prefix + "confirmationTitle",
+ builder->Add(prefix + "WelcomeTitle", IDS_PAIRING_HOST_WELCOME_TITLE);
+ builder->Add(prefix + "WelcomeText", IDS_PAIRING_HOST_WELCOME_TEXT);
+ builder->Add(prefix + "ConfirmationTitle",
IDS_PAIRING_HOST_CONFIRMATION_TITLE);
- builder->Add(prefix + "updatingTitle", IDS_PAIRING_HOST_UPDATING_TITLE);
- builder->Add(prefix + "updatingText", IDS_PAIRING_HOST_UPDATING_TEXT);
- builder->Add(prefix + "enrollTitle", IDS_PAIRING_ENROLL_TITLE);
- builder->Add(prefix + "enrollingTitle",
+ builder->Add(prefix + "UpdatingTitle", IDS_PAIRING_HOST_UPDATING_TITLE);
+ builder->Add(prefix + "UpdatingText", IDS_PAIRING_HOST_UPDATING_TEXT);
+ builder->Add(prefix + "EnrollTitle", IDS_PAIRING_ENROLL_TITLE);
+ builder->Add(prefix + "EnrollingTitle",
IDS_PAIRING_ENROLLMENT_IN_PROGRESS);
- builder->Add(prefix + "doneTitle", IDS_PAIRING_HOST_DONE_TITLE);
- builder->Add(prefix + "doneText", IDS_PAIRING_HOST_DONE_TEXT);
- builder->Add(prefix + "enrollmentErrorTitle",
+ builder->Add(prefix + "DoneTitle", IDS_PAIRING_HOST_DONE_TITLE);
+ builder->Add(prefix + "DoneText", IDS_PAIRING_HOST_DONE_TEXT);
+ builder->Add(prefix + "EnrollmentErrorTitle",
IDS_PAIRING_ENROLLMENT_ERROR_TITLE);
- builder->Add(prefix + "errorNeedsRestart",
+ builder->Add(prefix + "ErrorNeedsRestart",
IDS_PAIRING_HOST_EROLLMENT_ERROR_NEEDS_RESTART);
+ builder->Add(prefix + "SetupBasicConfigTitle",
+ IDS_HOST_SETUP_BASIC_CONFIGURATION_TITLE);
+ builder->Add(prefix + "SetupNetworkErrorTitle",
+ IDS_HOST_SETUP_NETWORK_ERROR_TITLE);
}
void HostPairingScreenHandler::RegisterMessages() {
diff --git a/components/pairing/bluetooth_host_pairing_controller.cc b/components/pairing/bluetooth_host_pairing_controller.cc
index 088dada..37e48542 100644
--- a/components/pairing/bluetooth_host_pairing_controller.cc
+++ b/components/pairing/bluetooth_host_pairing_controller.cc
@@ -19,6 +19,25 @@ namespace pairing_chromeos {
namespace {
const int kReceiveSize = 16384;
+pairing_api::HostStatusParameters::Connectivity PairingApiConnectivityStatus(
+ HostPairingController::Connectivity connectivity_status) {
+ switch (connectivity_status) {
+ case HostPairingController::CONNECTIVITY_UNTESTED:
+ return pairing_api::HostStatusParameters::CONNECTIVITY_UNTESTED;
+ case HostPairingController::CONNECTIVITY_NONE:
+ return pairing_api::HostStatusParameters::CONNECTIVITY_NONE;
+ case HostPairingController::CONNECTIVITY_LIMITED:
+ return pairing_api::HostStatusParameters::CONNECTIVITY_LIMITED;
+ case HostPairingController::CONNECTIVITY_CONNECTING:
+ return pairing_api::HostStatusParameters::CONNECTIVITY_CONNECTING;
+ case HostPairingController::CONNECTIVITY_CONNECTED:
+ return pairing_api::HostStatusParameters::CONNECTIVITY_CONNECTED;
+ default:
+ NOTREACHED();
+ return pairing_api::HostStatusParameters::CONNECTIVITY_UNTESTED;
+ }
+}
+
pairing_api::HostStatusParameters::UpdateStatus PairingApiUpdateStatus(
HostPairingController::UpdateStatus update_status) {
switch(update_status) {
@@ -57,11 +76,11 @@ pairing_api::HostStatusParameters::EnrollmentStatus PairingApiEnrollmentStatus(
BluetoothHostPairingController::BluetoothHostPairingController()
: current_stage_(STAGE_NONE),
+ connectivity_status_(CONNECTIVITY_UNTESTED),
update_status_(UPDATE_STATUS_UNKNOWN),
enrollment_status_(ENROLLMENT_STATUS_UNKNOWN),
proto_decoder_(new ProtoDecoder(this)),
- ptr_factory_(this) {
-}
+ ptr_factory_(this) {}
BluetoothHostPairingController::~BluetoothHostPairingController() {
Reset();
@@ -93,7 +112,7 @@ void BluetoothHostPairingController::SendHostStatus() {
// TODO(zork): Get these values from the UI. (http://crbug.com/405744)
host_status.mutable_parameters()->set_connectivity(
- pairing_api::HostStatusParameters::CONNECTIVITY_CONNECTED);
+ PairingApiConnectivityStatus(connectivity_status_));
host_status.mutable_parameters()->set_update_status(
PairingApiUpdateStatus(update_status_));
host_status.mutable_parameters()->set_enrollment_status(
@@ -309,6 +328,7 @@ void BluetoothHostPairingController::OnHostStatusMessage(
void BluetoothHostPairingController::OnConfigureHostMessage(
const pairing_api::ConfigureHost& message) {
+ ChangeStage(STAGE_SETUP_BASIC_CONFIGURATION);
FOR_EACH_OBSERVER(Observer, observers_,
ConfigureHostRequested(
message.parameters().accepted_eula(),
@@ -401,6 +421,14 @@ std::string BluetoothHostPairingController::GetEnrollmentDomain() {
return enrollment_domain_;
}
+void BluetoothHostPairingController::OnNetworkConnectivityChanged(
+ Connectivity connectivity_status) {
+ connectivity_status_ = connectivity_status;
+ if (connectivity_status == CONNECTIVITY_NONE)
+ ChangeStage(STAGE_SETUP_NETWORK_ERROR);
+ SendHostStatus();
+}
+
void BluetoothHostPairingController::OnUpdateStatusChanged(
UpdateStatus update_status) {
update_status_ = update_status;
diff --git a/components/pairing/bluetooth_host_pairing_controller.h b/components/pairing/bluetooth_host_pairing_controller.h
index 51ff19a..75c1eb3 100644
--- a/components/pairing/bluetooth_host_pairing_controller.h
+++ b/components/pairing/bluetooth_host_pairing_controller.h
@@ -69,6 +69,7 @@ class BluetoothHostPairingController
std::string GetDeviceName() override;
std::string GetConfirmationCode() override;
std::string GetEnrollmentDomain() override;
+ void OnNetworkConnectivityChanged(Connectivity connectivity_status) override;
void OnUpdateStatusChanged(UpdateStatus update_status) override;
void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override;
void SetPermanentId(const std::string& permanent_id) override;
@@ -101,6 +102,7 @@ class BluetoothHostPairingController
std::string device_name_;
std::string confirmation_code_;
std::string enrollment_domain_;
+ Connectivity connectivity_status_;
UpdateStatus update_status_;
EnrollmentStatus enrollment_status_;
std::string permanent_id_;
diff --git a/components/pairing/fake_host_pairing_controller.cc b/components/pairing/fake_host_pairing_controller.cc
index ebd7084..0e4a34e 100644
--- a/components/pairing/fake_host_pairing_controller.cc
+++ b/components/pairing/fake_host_pairing_controller.cc
@@ -122,6 +122,10 @@ std::string FakeHostPairingController::GetEnrollmentDomain() {
return enrollment_domain_;
}
+void FakeHostPairingController::OnNetworkConnectivityChanged(
+ Connectivity connectivity_status) {
+}
+
void FakeHostPairingController::OnUpdateStatusChanged(
UpdateStatus update_status) {
}
diff --git a/components/pairing/fake_host_pairing_controller.h b/components/pairing/fake_host_pairing_controller.h
index 862e3d5..156380f 100644
--- a/components/pairing/fake_host_pairing_controller.h
+++ b/components/pairing/fake_host_pairing_controller.h
@@ -45,6 +45,7 @@ class FakeHostPairingController
std::string GetDeviceName() override;
std::string GetConfirmationCode() override;
std::string GetEnrollmentDomain() override;
+ void OnNetworkConnectivityChanged(Connectivity connectivity_status) override;
void OnUpdateStatusChanged(UpdateStatus update_status) override;
void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override;
void SetPermanentId(const std::string& permanent_id) override;
diff --git a/components/pairing/host_pairing_controller.h b/components/pairing/host_pairing_controller.h
index b360d07..05278f2 100644
--- a/components/pairing/host_pairing_controller.h
+++ b/components/pairing/host_pairing_controller.h
@@ -18,6 +18,8 @@ class HostPairingController {
STAGE_INITIALIZATION_ERROR,
STAGE_WAITING_FOR_CONTROLLER,
STAGE_WAITING_FOR_CODE_CONFIRMATION,
+ STAGE_SETUP_BASIC_CONFIGURATION,
+ STAGE_SETUP_NETWORK_ERROR,
STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE,
STAGE_WAITING_FOR_CREDENTIALS,
STAGE_ENROLLING,
@@ -26,6 +28,14 @@ class HostPairingController {
STAGE_FINISHED
};
+ enum Connectivity {
+ CONNECTIVITY_UNTESTED,
+ CONNECTIVITY_NONE,
+ CONNECTIVITY_LIMITED,
+ CONNECTIVITY_CONNECTING,
+ CONNECTIVITY_CONNECTED,
+ };
+
enum UpdateStatus {
UPDATE_STATUS_UNKNOWN,
UPDATE_STATUS_UPDATING,
@@ -85,6 +95,10 @@ class HostPairingController {
// |STAGE_ENROLLMENT| and later.
virtual std::string GetEnrollmentDomain() = 0;
+ // Notify that the network connectivity status has changed.
+ virtual void OnNetworkConnectivityChanged(
+ Connectivity connectivity_status) = 0;
+
// Notify that the update status has changed.
virtual void OnUpdateStatusChanged(UpdateStatus update_status) = 0;