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

Side by Side 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 comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h"
9 #include "grit/generated_resources.h"
10 #include "ui/base/l10n/l10n_util.h"
11
12 namespace chromeos {
13
14 NetworkScreenHandler::NetworkScreenHandler()
15 : screen_(NULL) {
16 }
17
18 NetworkScreenHandler::~NetworkScreenHandler() {
19 ClearErrors();
20 }
21
22 void NetworkScreenHandler::SetDelegate(NetworkScreenActor::Delegate* screen) {
23 screen_ = screen;
24 }
25
26 void NetworkScreenHandler::PrepareToShow() {
27 }
28
29 void NetworkScreenHandler::Show() {
30 scoped_ptr<Value> value(Value::CreateIntegerValue(0));
31 web_ui_->CallJavascriptFunction("toggleStep", *value);
Nikita (slow) 2011/06/08 08:21:23 cr.ui.Oobe.toggleStep Same prefix for other funct
whywhat 2011/06/08 08:29:57 Done.
32 }
33
34 void NetworkScreenHandler::Hide() {
35 }
36
37 void NetworkScreenHandler::ShowError(const string16& message) {
38 scoped_ptr<Value> message_value(Value::CreateStringValue(message));
39 web_ui_->CallJavascriptFunction("showError", *message_value);
Nikita (slow) 2011/06/08 08:21:23 I think it makes sense to comment these calls like
whywhat 2011/06/08 08:29:57 Done.
40 }
41
42 void NetworkScreenHandler::ClearErrors() {
43 web_ui_->CallJavascriptFunction("clearErrors");
44 }
45
46 void NetworkScreenHandler::ShowConnectingStatus(
47 bool connecting,
48 const string16& network_id) {
49 string16 connecting_label =
50 l10n_util::GetStringFUTF16(IDS_NETWORK_SELECTION_CONNECTING, network_id);
51 scoped_ptr<Value> connecting_value(Value::CreateBooleanValue(connecting));
52 scoped_ptr<Value> network_id_value(Value::CreateStringValue(network_id));
53 scoped_ptr<Value> connecting_label_value(
54 Value::CreateStringValue(connecting_label));
55 web_ui_->CallJavascriptFunction("showConnectingStatus",
56 *connecting_value,
57 *network_id_value,
58 *connecting_label_value);
59 }
60
61 void NetworkScreenHandler::EnableContinue(bool enabled) {
62 scoped_ptr<Value> enabled_value(Value::CreateBooleanValue(enabled));
63 web_ui_->CallJavascriptFunction("enableContinue", *enabled_value);
64 }
65
66 void NetworkScreenHandler::GetLocalizedSettings(
67 DictionaryValue* localized_strings) {
68 localized_strings->SetString("networkScreenTitle",
Nikita (slow) 2011/06/08 08:21:23 You don't need this string.
whywhat 2011/06/08 08:29:57 Done.
69 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE));
70 localized_strings->SetString("selectLanguage",
71 l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT));
72 localized_strings->SetString("selectKeyboard",
73 l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT));
74 localized_strings->SetString("selectNetwork",
75 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT));
76 localized_strings->SetString("proxySettings",
77 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON));
78 localized_strings->SetString("continueButton",
79 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_CONTINUE_BUTTON));
80 // TODO(avayvod): Initialize languages, keyboards and networks lists.
Nikita (slow) 2011/06/08 08:21:23 I guess these lists will be initialized in Initial
whywhat 2011/06/08 08:29:57 Done.
81 }
82
83 void NetworkScreenHandler::Initialize() {
84 // TODO(avayvod): Set necessary data.
85 }
86
87 void NetworkScreenHandler::RegisterMessages() {
88 web_ui_->RegisterMessageCallback("networkOnExit",
89 NewCallback(this, &NetworkScreenHandler::OnExit));
90 }
91
92 void NetworkScreenHandler::OnExit(const ListValue* args) {
93 ClearErrors();
94 screen_->OnContinuePressed();
95 }
96
97 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698