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/ui/webui/options/chromeos/internet_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 base::DictionaryValue* new_properties) { | 283 base::DictionaryValue* new_properties) { |
284 int old_value; | 284 int old_value; |
285 if (!old_properties.GetIntegerWithoutPathExpansion(key, &old_value) || | 285 if (!old_properties.GetIntegerWithoutPathExpansion(key, &old_value) || |
286 new_value != old_value) { | 286 new_value != old_value) { |
287 new_properties->SetIntegerWithoutPathExpansion(key, new_value); | 287 new_properties->SetIntegerWithoutPathExpansion(key, new_value); |
288 return true; | 288 return true; |
289 } | 289 } |
290 return false; | 290 return false; |
291 } | 291 } |
292 | 292 |
293 void RequestReconnect(const std::string& service_path, | 293 void RequestReconnect(const std::string& service_path) { |
294 gfx::NativeWindow owning_window) { | |
295 NetworkHandler::Get()->network_connection_handler()->DisconnectNetwork( | 294 NetworkHandler::Get()->network_connection_handler()->DisconnectNetwork( |
296 service_path, | 295 service_path, |
297 base::Bind(&ash::network_connect::ConnectToNetwork, | 296 base::Bind(&ash::network_connect::ConnectToNetwork, service_path), |
298 service_path, owning_window), | |
299 base::Bind(&ShillError, "RequestReconnect")); | 297 base::Bind(&ShillError, "RequestReconnect")); |
300 } | 298 } |
301 | 299 |
302 } // namespace | 300 } // namespace |
303 | 301 |
304 InternetOptionsHandler::InternetOptionsHandler() | 302 InternetOptionsHandler::InternetOptionsHandler() |
305 : weak_factory_(this) { | 303 : weak_factory_(this) { |
306 NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE); | 304 NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE); |
307 } | 305 } |
308 | 306 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 const base::ListValue* args) { | 586 const base::ListValue* args) { |
589 NetworkHandler::Get()->network_state_handler()->RequestScan(); | 587 NetworkHandler::Get()->network_state_handler()->RequestScan(); |
590 } | 588 } |
591 | 589 |
592 void InternetOptionsHandler::StartConnectCallback(const base::ListValue* args) { | 590 void InternetOptionsHandler::StartConnectCallback(const base::ListValue* args) { |
593 std::string service_path; | 591 std::string service_path; |
594 if (!args->GetString(0, &service_path)) { | 592 if (!args->GetString(0, &service_path)) { |
595 NOTREACHED(); | 593 NOTREACHED(); |
596 return; | 594 return; |
597 } | 595 } |
598 ash::network_connect::ConnectToNetwork(service_path, GetNativeWindow()); | 596 ash::network_connect::ConnectToNetwork(service_path); |
599 } | 597 } |
600 | 598 |
601 void InternetOptionsHandler::StartDisconnectCallback( | 599 void InternetOptionsHandler::StartDisconnectCallback( |
602 const base::ListValue* args) { | 600 const base::ListValue* args) { |
603 std::string service_path; | 601 std::string service_path; |
604 if (!args->GetString(0, &service_path)) { | 602 if (!args->GetString(0, &service_path)) { |
605 NOTREACHED(); | 603 NOTREACHED(); |
606 return; | 604 return; |
607 } | 605 } |
608 NetworkHandler::Get()->network_connection_handler()->DisconnectNetwork( | 606 NetworkHandler::Get()->network_connection_handler()->DisconnectNetwork( |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 base::Bind(&ShillError, "SetIPConfigProperties")); | 824 base::Bind(&ShillError, "SetIPConfigProperties")); |
827 } | 825 } |
828 std::string device_path; | 826 std::string device_path; |
829 shill_properties.GetStringWithoutPathExpansion( | 827 shill_properties.GetStringWithoutPathExpansion( |
830 shill::kDeviceProperty, &device_path); | 828 shill::kDeviceProperty, &device_path); |
831 if (!device_path.empty()) { | 829 if (!device_path.empty()) { |
832 base::Closure callback = base::Bind(&base::DoNothing); | 830 base::Closure callback = base::Bind(&base::DoNothing); |
833 // If auto config or a static IP property changed, we need to reconnect | 831 // If auto config or a static IP property changed, we need to reconnect |
834 // to the network. | 832 // to the network. |
835 if (request_reconnect) | 833 if (request_reconnect) |
836 callback = base::Bind(&RequestReconnect, service_path, GetNativeWindow()); | 834 callback = base::Bind(&RequestReconnect, service_path); |
837 NetworkHandler::Get()->network_device_handler()->RequestRefreshIPConfigs( | 835 NetworkHandler::Get()->network_device_handler()->RequestRefreshIPConfigs( |
838 device_path, | 836 device_path, |
839 callback, | 837 callback, |
840 base::Bind(&ShillError, "RequestRefreshIPConfigs")); | 838 base::Bind(&ShillError, "RequestRefreshIPConfigs")); |
841 } | 839 } |
842 } | 840 } |
843 | 841 |
844 void InternetOptionsHandler::PopulateDictionaryDetailsCallback( | 842 void InternetOptionsHandler::PopulateDictionaryDetailsCallback( |
845 const std::string& service_path, | 843 const std::string& service_path, |
846 const base::DictionaryValue& onc_properties) { | 844 const base::DictionaryValue& onc_properties) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 dictionary->SetBoolean( | 1037 dictionary->SetBoolean( |
1040 kTagWimaxAvailable, | 1038 kTagWimaxAvailable, |
1041 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 1039 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
1042 dictionary->SetBoolean( | 1040 dictionary->SetBoolean( |
1043 kTagWimaxEnabled, | 1041 kTagWimaxEnabled, |
1044 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 1042 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
1045 } | 1043 } |
1046 | 1044 |
1047 } // namespace options | 1045 } // namespace options |
1048 } // namespace chromeos | 1046 } // namespace chromeos |
OLD | NEW |