| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/login/network_screen.h" | 5 #include "chrome/browser/chromeos/login/network_screen.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/string16.h" |
| 8 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 11 #include "chrome/browser/chromeos/login/network_selection_view.h" | 12 #include "chrome/browser/chromeos/login/network_selection_view.h" |
| 12 #include "chrome/browser/chromeos/login/screen_observer.h" | 13 #include "chrome/browser/chromeos/login/screen_observer.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "views/widget/widget.h" | 15 #include "views/widget/widget.h" |
| 15 #include "views/window/window.h" | 16 #include "views/window/window.h" |
| 16 | 17 |
| 17 | 18 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 47 // ComboboxModel implementation: | 48 // ComboboxModel implementation: |
| 48 | 49 |
| 49 int NetworkScreen::GetItemCount() { | 50 int NetworkScreen::GetItemCount() { |
| 50 // Item with index = 0 is either "no networks are available" or | 51 // Item with index = 0 is either "no networks are available" or |
| 51 // "no selection". | 52 // "no selection". |
| 52 // If WiFi is disabled adding extra item to enable it. | 53 // If WiFi is disabled adding extra item to enable it. |
| 53 return static_cast<int>(networks_.GetNetworkCount()) + 1 + | 54 return static_cast<int>(networks_.GetNetworkCount()) + 1 + |
| 54 (wifi_disabled_ ? 1 : 0); | 55 (wifi_disabled_ ? 1 : 0); |
| 55 } | 56 } |
| 56 | 57 |
| 57 std::wstring NetworkScreen::GetItemAt(int index) { | 58 string16 NetworkScreen::GetItemAt(int index) { |
| 58 if (index == 0) { | 59 if (index == 0) { |
| 59 return networks_.IsEmpty() ? | 60 return networks_.IsEmpty() ? |
| 60 l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE) : | 61 l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE) : |
| 61 l10n_util::GetString(IDS_NETWORK_SELECTION_NONE); | 62 l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_NONE); |
| 62 } | 63 } |
| 63 if (wifi_disabled_ && | 64 if (wifi_disabled_ && |
| 64 index == static_cast<int>(networks_.GetNetworkCount()) + 1) { | 65 index == static_cast<int>(networks_.GetNetworkCount()) + 1) { |
| 65 return l10n_util::GetStringF( | 66 return l10n_util::GetStringFUTF16( |
| 66 IDS_STATUSBAR_NETWORK_DEVICE_ENABLE, | 67 IDS_STATUSBAR_NETWORK_DEVICE_ENABLE, |
| 67 l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_WIFI)); | 68 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI)); |
| 68 } | 69 } |
| 69 NetworkList::NetworkItem* network = | 70 NetworkList::NetworkItem* network = |
| 70 networks_.GetNetworkAt(index - 1); | 71 networks_.GetNetworkAt(index - 1); |
| 71 return network ? UTF16ToWide(network->label) : std::wstring(); | 72 return network ? network->label : string16(); |
| 72 } | 73 } |
| 73 | 74 |
| 74 //////////////////////////////////////////////////////////////////////////////// | 75 //////////////////////////////////////////////////////////////////////////////// |
| 75 // views::Combobox::Listener implementation: | 76 // views::Combobox::Listener implementation: |
| 76 | 77 |
| 77 void NetworkScreen::ItemChanged(views::Combobox* sender, | 78 void NetworkScreen::ItemChanged(views::Combobox* sender, |
| 78 int prev_index, | 79 int prev_index, |
| 79 int new_index) { | 80 int new_index) { |
| 80 view()->EnableContinue(new_index > 0); | 81 view()->EnableContinue(new_index > 0); |
| 81 // Corner case: item with index 0 is "No selection". Just select it. | 82 // Corner case: item with index 0 is "No selection". Just select it. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if (connection_timer_.IsRunning()) | 322 if (connection_timer_.IsRunning()) |
| 322 connection_timer_.Stop(); | 323 connection_timer_.Stop(); |
| 323 connection_timer_.Start(base::TimeDelta::FromSeconds(kConnectionTimeoutSec), | 324 connection_timer_.Start(base::TimeDelta::FromSeconds(kConnectionTimeoutSec), |
| 324 this, | 325 this, |
| 325 &NetworkScreen::OnConnectionTimeout); | 326 &NetworkScreen::OnConnectionTimeout); |
| 326 if (continue_pressed_) | 327 if (continue_pressed_) |
| 327 ShowConnectingStatus(); | 328 ShowConnectingStatus(); |
| 328 } | 329 } |
| 329 | 330 |
| 330 } // namespace chromeos | 331 } // namespace chromeos |
| OLD | NEW |