| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wifi_config_view.h" | 5 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
| 6 | 6 |
| 7 #include "ash/system/chromeos/network/network_connect.h" | 7 #include "ash/system/chromeos/network/network_connect.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 save_credentials_checkbox_(NULL), | 349 save_credentials_checkbox_(NULL), |
| 350 share_network_checkbox_(NULL), | 350 share_network_checkbox_(NULL), |
| 351 shared_network_label_(NULL), | 351 shared_network_label_(NULL), |
| 352 security_combobox_(NULL), | 352 security_combobox_(NULL), |
| 353 passphrase_label_(NULL), | 353 passphrase_label_(NULL), |
| 354 passphrase_textfield_(NULL), | 354 passphrase_textfield_(NULL), |
| 355 passphrase_visible_button_(NULL), | 355 passphrase_visible_button_(NULL), |
| 356 error_label_(NULL), | 356 error_label_(NULL), |
| 357 weak_ptr_factory_(this) { | 357 weak_ptr_factory_(this) { |
| 358 Init(show_8021x); | 358 Init(show_8021x); |
| 359 NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE); |
| 359 } | 360 } |
| 360 | 361 |
| 361 WifiConfigView::~WifiConfigView() { | 362 WifiConfigView::~WifiConfigView() { |
| 363 if (NetworkHandler::IsInitialized()) { |
| 364 NetworkHandler::Get()->network_state_handler()->RemoveObserver( |
| 365 this, FROM_HERE); |
| 366 } |
| 362 CertLibrary::Get()->RemoveObserver(this); | 367 CertLibrary::Get()->RemoveObserver(this); |
| 363 } | 368 } |
| 364 | 369 |
| 365 string16 WifiConfigView::GetTitle() const { | 370 string16 WifiConfigView::GetTitle() const { |
| 366 return l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_JOIN_WIFI_NETWORKS); | 371 return l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_JOIN_WIFI_NETWORKS); |
| 367 } | 372 } |
| 368 | 373 |
| 369 views::View* WifiConfigView::GetInitiallyFocusedView() { | 374 views::View* WifiConfigView::GetInitiallyFocusedView() { |
| 370 // Return a reasonable widget for initial focus, | 375 // Return a reasonable widget for initial focus, |
| 371 // depending on what we're showing. | 376 // depending on what we're showing. |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 RefreshShareCheckbox(); | 1245 RefreshShareCheckbox(); |
| 1241 UpdateErrorLabel(); | 1246 UpdateErrorLabel(); |
| 1242 } | 1247 } |
| 1243 | 1248 |
| 1244 void WifiConfigView::InitFocus() { | 1249 void WifiConfigView::InitFocus() { |
| 1245 views::View* view_to_focus = GetInitiallyFocusedView(); | 1250 views::View* view_to_focus = GetInitiallyFocusedView(); |
| 1246 if (view_to_focus) | 1251 if (view_to_focus) |
| 1247 view_to_focus->RequestFocus(); | 1252 view_to_focus->RequestFocus(); |
| 1248 } | 1253 } |
| 1249 | 1254 |
| 1255 void WifiConfigView::NetworkPropertiesUpdated(const NetworkState* network) { |
| 1256 if (network->path() != service_path_) |
| 1257 return; |
| 1258 UpdateErrorLabel(); |
| 1259 } |
| 1260 |
| 1250 // static | 1261 // static |
| 1251 void WifiConfigView::ParseWiFiUIProperty( | 1262 void WifiConfigView::ParseWiFiUIProperty( |
| 1252 NetworkPropertyUIData* property_ui_data, | 1263 NetworkPropertyUIData* property_ui_data, |
| 1253 const NetworkState* network, | 1264 const NetworkState* network, |
| 1254 const std::string& key) { | 1265 const std::string& key) { |
| 1255 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; | 1266 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; |
| 1256 const base::DictionaryValue* onc = | 1267 const base::DictionaryValue* onc = |
| 1257 network_connect::FindPolicyForActiveUser(network, &onc_source); | 1268 network_connect::FindPolicyForActiveUser(network, &onc_source); |
| 1258 | 1269 |
| 1259 property_ui_data->ParseOncProperty( | 1270 property_ui_data->ParseOncProperty( |
| 1260 onc_source, | 1271 onc_source, |
| 1261 onc, | 1272 onc, |
| 1262 base::StringPrintf("%s.%s", onc::network_config::kWiFi, key.c_str())); | 1273 base::StringPrintf("%s.%s", onc::network_config::kWiFi, key.c_str())); |
| 1263 } | 1274 } |
| 1264 | 1275 |
| 1265 // static | 1276 // static |
| 1266 void WifiConfigView::ParseWiFiEAPUIProperty( | 1277 void WifiConfigView::ParseWiFiEAPUIProperty( |
| 1267 NetworkPropertyUIData* property_ui_data, | 1278 NetworkPropertyUIData* property_ui_data, |
| 1268 const NetworkState* network, | 1279 const NetworkState* network, |
| 1269 const std::string& key) { | 1280 const std::string& key) { |
| 1270 ParseWiFiUIProperty( | 1281 ParseWiFiUIProperty( |
| 1271 property_ui_data, network, | 1282 property_ui_data, network, |
| 1272 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); | 1283 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); |
| 1273 } | 1284 } |
| 1274 | 1285 |
| 1275 } // namespace chromeos | 1286 } // namespace chromeos |
| OLD | NEW |