| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
| 6 | 6 |
| 7 #include <dbus/dbus-glib.h> | 7 #include <dbus/dbus-glib.h> |
| 8 #include <dbus/dbus-gtype-specialized.h> | 8 #include <dbus/dbus-gtype-specialized.h> |
| 9 #include <glib-object.h> | 9 #include <glib-object.h> |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <list> | 12 #include <list> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <set> | 14 #include <set> |
| 15 #include <utility> | 15 #include <utility> |
| 16 | 16 |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/i18n/icu_encoding_detection.h" | 18 #include "base/i18n/icu_encoding_detection.h" |
| 19 #include "base/i18n/icu_string_conversions.h" | 19 #include "base/i18n/icu_string_conversions.h" |
| 20 #include "base/i18n/time_formatting.h" | 20 #include "base/i18n/time_formatting.h" |
| 21 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
| 22 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
| 23 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
| 24 #include "base/string_tokenizer.h" | 24 #include "base/string_tokenizer.h" |
| 25 #include "base/string_util.h" | 25 #include "base/string_util.h" |
| 26 #include "base/stringprintf.h" | 26 #include "base/stringprintf.h" |
| 27 #include "base/utf_string_conversions.h" | 27 #include "base/utf_string_conversions.h" |
| 28 #include "base/utf_string_conversion_utils.h" | 28 #include "base/utf_string_conversion_utils.h" |
| 29 #include "base/values.h" | 29 #include "base/values.h" |
| 30 #include "chrome/browser/chromeos/cros_settings.h" |
| 30 #include "chrome/browser/chromeos/cros/cros_library.h" | 31 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 31 #include "chrome/browser/chromeos/cros/native_network_constants.h" | 32 #include "chrome/browser/chromeos/cros/native_network_constants.h" |
| 32 #include "chrome/browser/chromeos/cros/native_network_parser.h" | 33 #include "chrome/browser/chromeos/cros/native_network_parser.h" |
| 33 #include "chrome/browser/chromeos/cros/onc_network_parser.h" | 34 #include "chrome/browser/chromeos/cros/onc_network_parser.h" |
| 34 #include "chrome/browser/chromeos/login/user_manager.h" | 35 #include "chrome/browser/chromeos/login/user_manager.h" |
| 35 #include "chrome/browser/chromeos/network_login_observer.h" | 36 #include "chrome/browser/chromeos/network_login_observer.h" |
| 36 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | |
| 37 #include "chrome/common/time_format.h" | 37 #include "chrome/common/time_format.h" |
| 38 #include "content/browser/browser_thread.h" | 38 #include "content/browser/browser_thread.h" |
| 39 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. | 39 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. |
| 40 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
| 41 #include "third_party/cros_system_api/dbus/service_constants.h" | 41 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/base/text/bytes_formatting.h" | 43 #include "ui/base/text/bytes_formatting.h" |
| 44 | 44 |
| 45 //////////////////////////////////////////////////////////////////////////////// | 45 //////////////////////////////////////////////////////////////////////////////// |
| 46 // Implementation notes. | 46 // Implementation notes. |
| (...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3551 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 3551 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 3552 NetworkDevice* device = FindNetworkDeviceByPath(path); | 3552 NetworkDevice* device = FindNetworkDeviceByPath(path); |
| 3553 if (device) { | 3553 if (device) { |
| 3554 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; | 3554 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; |
| 3555 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; | 3555 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; |
| 3556 if (device->UpdateStatus(key, value, &index)) { | 3556 if (device->UpdateStatus(key, value, &index)) { |
| 3557 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { | 3557 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { |
| 3558 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 3558 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
| 3559 SetCellularDataRoamingAllowed(true); | 3559 SetCellularDataRoamingAllowed(true); |
| 3560 } else { | 3560 } else { |
| 3561 bool settings_value = | 3561 bool settings_value; |
| 3562 UserCrosSettingsProvider::cached_data_roaming_enabled(); | 3562 if (CrosSettings::Get()->GetBoolean( |
| 3563 if (device->data_roaming_allowed() != settings_value) { | 3563 kSignedDataRoamingEnabled, &settings_value) && |
| 3564 device->data_roaming_allowed() != settings_value) { |
| 3564 // Switch back to signed settings value. | 3565 // Switch back to signed settings value. |
| 3565 SetCellularDataRoamingAllowed(settings_value); | 3566 SetCellularDataRoamingAllowed(settings_value); |
| 3566 return; | 3567 return; |
| 3567 } | 3568 } |
| 3568 } | 3569 } |
| 3569 } | 3570 } |
| 3570 } else { | 3571 } else { |
| 3571 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: " | 3572 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: " |
| 3572 << path << "." << key; | 3573 << path << "." << key; |
| 3573 } | 3574 } |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4632 if (device) { | 4633 if (device) { |
| 4633 device_map_[device_path] = device; | 4634 device_map_[device_path] = device; |
| 4634 } | 4635 } |
| 4635 CHECK(device) << "Attempted to add NULL device for path: " << device_path; | 4636 CHECK(device) << "Attempted to add NULL device for path: " << device_path; |
| 4636 } | 4637 } |
| 4637 VLOG(1) << "ParseNetworkDevice:" << device->name(); | 4638 VLOG(1) << "ParseNetworkDevice:" << device->name(); |
| 4638 if (device && device->type() == TYPE_CELLULAR) { | 4639 if (device && device->type() == TYPE_CELLULAR) { |
| 4639 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 4640 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
| 4640 SetCellularDataRoamingAllowed(true); | 4641 SetCellularDataRoamingAllowed(true); |
| 4641 } else { | 4642 } else { |
| 4642 bool settings_value = | 4643 bool settings_value; |
| 4643 UserCrosSettingsProvider::cached_data_roaming_enabled(); | 4644 if (CrosSettings::Get()->GetBoolean( |
| 4644 if (device->data_roaming_allowed() != settings_value) { | 4645 kSignedDataRoamingEnabled, &settings_value) && |
| 4646 device->data_roaming_allowed() != settings_value) { |
| 4645 // Switch back to signed settings value. | 4647 // Switch back to signed settings value. |
| 4646 SetCellularDataRoamingAllowed(settings_value); | 4648 SetCellularDataRoamingAllowed(settings_value); |
| 4647 } | 4649 } |
| 4648 } | 4650 } |
| 4649 } | 4651 } |
| 4650 NotifyNetworkManagerChanged(false); // Not forced. | 4652 NotifyNetworkManagerChanged(false); // Not forced. |
| 4651 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); | 4653 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); |
| 4652 } | 4654 } |
| 4653 | 4655 |
| 4654 //////////////////////////////////////////////////////////////////////////// | 4656 //////////////////////////////////////////////////////////////////////////// |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5126 return impl; | 5128 return impl; |
| 5127 } | 5129 } |
| 5128 | 5130 |
| 5129 ///////////////////////////////////////////////////////////////////////////// | 5131 ///////////////////////////////////////////////////////////////////////////// |
| 5130 | 5132 |
| 5131 } // namespace chromeos | 5133 } // namespace chromeos |
| 5132 | 5134 |
| 5133 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 5135 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 5134 // won't be deleted until its last InvokeLater is run. | 5136 // won't be deleted until its last InvokeLater is run. |
| 5135 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 5137 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
| OLD | NEW |