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/status/network_menu.h" | 5 #include "chrome/browser/chromeos/status/network_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 info->remembered = true; | 193 info->remembered = true; |
194 } else { | 194 } else { |
195 // Not a network, e.g options, separator. | 195 // Not a network, e.g options, separator. |
196 } | 196 } |
197 return res; | 197 return res; |
198 } | 198 } |
199 | 199 |
200 bool NetworkMenu::ConnectToNetworkAt(int index, | 200 bool NetworkMenu::ConnectToNetworkAt(int index, |
201 const std::string& passphrase, | 201 const std::string& passphrase, |
202 const std::string& ssid, | 202 const std::string& ssid, |
203 int remember) const { | 203 int remember) const { |
Charlie Lee
2010/11/12 12:29:57
why is this an int? and is this misnamed? should i
kochi
2010/11/15 08:46:13
I think 'int' is because it is adapted to the call
| |
204 int flags = menu_items_[index].flags; | 204 int flags = menu_items_[index].flags; |
205 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | 205 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
206 if (flags & FLAG_WIFI) { | 206 if (flags & FLAG_WIFI) { |
207 WifiNetwork* wifi = cros->FindWifiNetworkByPath( | 207 WifiNetwork* wifi = cros->FindWifiNetworkByPath( |
208 menu_items_[index].wireless_path); | 208 menu_items_[index].wireless_path); |
209 if (wifi) { | 209 if (wifi) { |
210 // Connect or reconnect. | 210 // Connect or reconnect. |
211 if (remember >= 0) | 211 if (remember >= 0) |
Charlie Lee
2010/11/12 12:29:57
if remember means auto-connect, then this is the r
kochi
2010/11/15 08:46:13
Renamed to auto_connect.
On 2010/11/12 12:29:57,
| |
212 wifi->set_favorite(remember ? true : false); | 212 wifi->set_auto_connect(remember ? true : false); |
213 if (cros->wifi_network() && | 213 if (cros->wifi_network() && |
214 wifi->service_path() == cros->wifi_network()->service_path()) { | 214 wifi->service_path() == cros->wifi_network()->service_path()) { |
215 // Show the config settings for the active network. | 215 // Show the config settings for the active network. |
216 ShowWifi(wifi, false); | 216 ShowWifi(wifi, false); |
217 return true; | 217 return true; |
218 } | 218 } |
219 bool connected = false; | 219 bool connected = false; |
220 if (wifi->encrypted()) { | 220 if (wifi->encrypted()) { |
221 if (wifi->IsCertificateLoaded()) { | 221 if (wifi->IsCertificateLoaded()) { |
222 connected = cros->ConnectToWifiNetwork( | 222 connected = cros->ConnectToWifiNetwork( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 } | 271 } |
272 } | 272 } |
273 } else { | 273 } else { |
274 // If we are attempting to connect to a network that no longer exists, | 274 // If we are attempting to connect to a network that no longer exists, |
275 // display a notification. | 275 // display a notification. |
276 // TODO(stevenjb): Show notification. | 276 // TODO(stevenjb): Show notification. |
277 } | 277 } |
278 } else if (flags & FLAG_OTHER_NETWORK) { | 278 } else if (flags & FLAG_OTHER_NETWORK) { |
279 bool connected = false; | 279 bool connected = false; |
280 if (MenuUI::IsEnabled()) { | 280 if (MenuUI::IsEnabled()) { |
281 bool favorite = remember == 0 ? false : true; // default is true | 281 bool favorite = remember == 0 ? false : true; // default is true |
Charlie Lee
2010/11/12 12:29:57
rename this to auto-connect?
kochi
2010/11/15 08:46:13
Done.
| |
282 connected = cros->ConnectToWifiNetwork( | 282 connected = cros->ConnectToWifiNetwork( |
283 passphrase.empty() ? SECURITY_NONE : SECURITY_UNKNOWN, | 283 passphrase.empty() ? SECURITY_NONE : SECURITY_UNKNOWN, |
284 ssid, passphrase, std::string(), std::string(), favorite); | 284 ssid, passphrase, std::string(), std::string(), favorite); |
285 } | 285 } |
286 if (!connected) { | 286 if (!connected) { |
287 ShowOther(); | 287 ShowOther(); |
288 } | 288 } |
289 } | 289 } |
290 return true; | 290 return true; |
291 } | 291 } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
767 chromeos::TYPE_WIFI); | 767 chromeos::TYPE_WIFI); |
768 browser->ShowOptionsTab(page); | 768 browser->ShowOptionsTab(page); |
769 } | 769 } |
770 } else { | 770 } else { |
771 const bool kFocusLogin = true; | 771 const bool kFocusLogin = true; |
772 ShowNetworkConfigView(new NetworkConfigView(), kFocusLogin); | 772 ShowNetworkConfigView(new NetworkConfigView(), kFocusLogin); |
773 } | 773 } |
774 } | 774 } |
775 | 775 |
776 } // namespace chromeos | 776 } // namespace chromeos |
OLD | NEW |