| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/options/network_config_view.h" | 5 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | |
| 10 #include "chrome/browser/chromeos/options/ip_config_view.h" | 9 #include "chrome/browser/chromeos/options/ip_config_view.h" |
| 11 #include "chrome/browser/chromeos/options/wifi_config_view.h" | 10 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
| 12 #include "grit/chromium_strings.h" | 11 #include "grit/chromium_strings.h" |
| 13 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 14 #include "grit/locale_settings.h" | 13 #include "grit/locale_settings.h" |
| 15 #include "views/grid_layout.h" | 14 #include "views/grid_layout.h" |
| 16 #include "views/standard_layout.h" | 15 #include "views/standard_layout.h" |
| 17 #include "views/window/window.h" | 16 #include "views/window/window.h" |
| 18 | 17 |
| 19 namespace chromeos { | 18 namespace chromeos { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (flags_ & FLAG_LOGIN_ONLY && button == MessageBoxFlags::DIALOGBUTTON_OK) | 65 if (flags_ & FLAG_LOGIN_ONLY && button == MessageBoxFlags::DIALOGBUTTON_OK) |
| 67 return wificonfig_view_->can_login(); | 66 return wificonfig_view_->can_login(); |
| 68 return true; | 67 return true; |
| 69 } | 68 } |
| 70 | 69 |
| 71 bool NetworkConfigView::Cancel() { | 70 bool NetworkConfigView::Cancel() { |
| 72 return true; | 71 return true; |
| 73 } | 72 } |
| 74 | 73 |
| 75 bool NetworkConfigView::Accept() { | 74 bool NetworkConfigView::Accept() { |
| 76 if (flags_ & FLAG_LOGIN_ONLY) { | 75 if (flags_ & FLAG_WIFI) |
| 77 if (flags_ & FLAG_OTHER_NETWORK) { | 76 return wificonfig_view_->Accept(); |
| 78 CrosLibrary::Get()->GetNetworkLibrary()->ConnectToWifiNetwork( | |
| 79 wificonfig_view_->GetSSID(), wificonfig_view_->GetPassphrase()); | |
| 80 } else { | |
| 81 CrosLibrary::Get()->GetNetworkLibrary()->ConnectToWifiNetwork(wifi_, | |
| 82 wificonfig_view_->GetPassphrase()); | |
| 83 } | |
| 84 } else { | |
| 85 // TODO(chocobo): Save new ip config data and/or save new passphrase. | |
| 86 } | |
| 87 return true; | 77 return true; |
| 88 } | 78 } |
| 89 | 79 |
| 90 std::wstring NetworkConfigView::GetWindowTitle() const { | 80 std::wstring NetworkConfigView::GetWindowTitle() const { |
| 91 if (flags_ & FLAG_OTHER_NETWORK) | 81 if (flags_ & FLAG_OTHER_NETWORK) |
| 92 return l10n_util::GetString(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS); | 82 return l10n_util::GetString(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS); |
| 93 if (flags_ & FLAG_WIFI) | 83 if (flags_ & FLAG_WIFI) |
| 94 return ASCIIToWide(wifi_.ssid); | 84 return ASCIIToWide(wifi_.ssid); |
| 95 if (flags_ & FLAG_CELLULAR) | 85 if (flags_ & FLAG_CELLULAR) |
| 96 return ASCIIToWide(cellular_.name); | 86 return ASCIIToWide(cellular_.name); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 ipconfig_view_ = new IPConfigView(cellular_.device_path); | 136 ipconfig_view_ = new IPConfigView(cellular_.device_path); |
| 147 else | 137 else |
| 148 ipconfig_view_ = new IPConfigView(ethernet_.device_path); | 138 ipconfig_view_ = new IPConfigView(ethernet_.device_path); |
| 149 tabs_->AddTab( | 139 tabs_->AddTab( |
| 150 l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_IP_CONFIG), | 140 l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_IP_CONFIG), |
| 151 ipconfig_view_); | 141 ipconfig_view_); |
| 152 } | 142 } |
| 153 } | 143 } |
| 154 | 144 |
| 155 } // namespace chromeos | 145 } // namespace chromeos |
| OLD | NEW |