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

Unified Diff: chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc

Issue 7121013: Initial implementation of network screen WebUI handler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed browser tests Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..56cfabb950e605dac604dd22f6be8dfc3515b9d5
--- /dev/null
+++ b/chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc
@@ -0,0 +1,97 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace chromeos {
+
+NetworkScreenHandler::NetworkScreenHandler()
+ : screen_(NULL) {
+}
+
+NetworkScreenHandler::~NetworkScreenHandler() {
+ ClearErrors();
+}
+
+void NetworkScreenHandler::SetDelegate(NetworkScreenActor::Delegate* screen) {
+ screen_ = screen;
+}
+
+void NetworkScreenHandler::PrepareToShow() {
+}
+
+void NetworkScreenHandler::Show() {
+ scoped_ptr<Value> value(Value::CreateIntegerValue(0));
+ web_ui_->CallJavascriptFunction("toggleStep", *value);
+}
+
+void NetworkScreenHandler::Hide() {
+}
+
+void NetworkScreenHandler::ShowError(const string16& message) {
+ scoped_ptr<Value> message_value(Value::CreateStringValue(message));
+ web_ui_->CallJavascriptFunction("showError", *message_value);
+}
+
+void NetworkScreenHandler::ClearErrors() {
+ web_ui_->CallJavascriptFunction("clearErrors");
+}
+
+void NetworkScreenHandler::ShowConnectingStatus(
+ bool connecting,
+ const string16& network_id) {
+ string16 connecting_label =
+ l10n_util::GetStringFUTF16(IDS_NETWORK_SELECTION_CONNECTING, network_id);
+ scoped_ptr<Value> connecting_value(Value::CreateBooleanValue(connecting));
+ scoped_ptr<Value> network_id_value(Value::CreateStringValue(network_id));
+ scoped_ptr<Value> connecting_label_value(
+ Value::CreateStringValue(connecting_label));
+ web_ui_->CallJavascriptFunction("showConnectingStatus",
+ *connecting_value,
+ *network_id_value,
+ *connecting_label_value);
+}
+
+void NetworkScreenHandler::EnableContinue(bool enabled) {
+ scoped_ptr<Value> enabled_value(Value::CreateBooleanValue(enabled));
+ web_ui_->CallJavascriptFunction("enableContinue", *enabled_value);
+}
+
+void NetworkScreenHandler::GetLocalizedSettings(
+ DictionaryValue* localized_strings) {
+ localized_strings->SetString("networkScreenTitle",
+ l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE));
+ localized_strings->SetString("selectLanguage",
+ l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT));
+ localized_strings->SetString("selectKeyboard",
+ l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT));
+ localized_strings->SetString("selectNetwork",
+ l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT));
+ localized_strings->SetString("proxySettings",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON));
+ localized_strings->SetString("continueButton",
+ l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_CONTINUE_BUTTON));
+ // TODO(avayvod): Initialize languages, keyboards and networks lists.
+}
+
+void NetworkScreenHandler::Initialize() {
+ // TODO(avayvod): Set necessary data.
+}
+
+void NetworkScreenHandler::RegisterMessages() {
+ web_ui_->RegisterMessageCallback("networkOnExit",
+ NewCallback(this, &NetworkScreenHandler::OnExit));
+}
+
+void NetworkScreenHandler::OnExit(const ListValue* args) {
+ ClearErrors();
+ screen_->OnContinuePressed();
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698