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_conversion_utils.h" | 27 #include "base/utf_string_conversion_utils.h" |
28 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.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/network_login_observer.h" | 35 #include "chrome/browser/chromeos/network_login_observer.h" |
35 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | |
36 #include "chrome/common/time_format.h" | 36 #include "chrome/common/time_format.h" |
37 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
38 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. | 38 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. |
39 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
40 #include "third_party/cros_system_api/dbus/service_constants.h" | 40 #include "third_party/cros_system_api/dbus/service_constants.h" |
41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/base/text/bytes_formatting.h" | 42 #include "ui/base/text/bytes_formatting.h" |
43 | 43 |
44 using content::BrowserThread; | 44 using content::BrowserThread; |
45 | 45 |
(...skipping 3536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 3582 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
3583 NetworkDevice* device = FindNetworkDeviceByPath(path); | 3583 NetworkDevice* device = FindNetworkDeviceByPath(path); |
3584 if (device) { | 3584 if (device) { |
3585 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; | 3585 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; |
3586 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; | 3586 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; |
3587 if (device->UpdateStatus(key, value, &index)) { | 3587 if (device->UpdateStatus(key, value, &index)) { |
3588 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { | 3588 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { |
3589 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 3589 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
3590 SetCellularDataRoamingAllowed(true); | 3590 SetCellularDataRoamingAllowed(true); |
3591 } else { | 3591 } else { |
3592 bool settings_value = | 3592 bool settings_value; |
3593 UserCrosSettingsProvider::cached_data_roaming_enabled(); | 3593 if (CrosSettings::Get()->GetBoolean( |
3594 if (device->data_roaming_allowed() != settings_value) { | 3594 kSignedDataRoamingEnabled, &settings_value) && |
| 3595 device->data_roaming_allowed() != settings_value) { |
3595 // Switch back to signed settings value. | 3596 // Switch back to signed settings value. |
3596 SetCellularDataRoamingAllowed(settings_value); | 3597 SetCellularDataRoamingAllowed(settings_value); |
3597 return; | 3598 return; |
3598 } | 3599 } |
3599 } | 3600 } |
3600 } | 3601 } |
3601 } else { | 3602 } else { |
3602 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: " | 3603 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: " |
3603 << path << "." << key; | 3604 << path << "." << key; |
3604 } | 3605 } |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4663 if (device) { | 4664 if (device) { |
4664 device_map_[device_path] = device; | 4665 device_map_[device_path] = device; |
4665 } | 4666 } |
4666 CHECK(device) << "Attempted to add NULL device for path: " << device_path; | 4667 CHECK(device) << "Attempted to add NULL device for path: " << device_path; |
4667 } | 4668 } |
4668 VLOG(1) << "ParseNetworkDevice:" << device->name(); | 4669 VLOG(1) << "ParseNetworkDevice:" << device->name(); |
4669 if (device && device->type() == TYPE_CELLULAR) { | 4670 if (device && device->type() == TYPE_CELLULAR) { |
4670 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 4671 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
4671 SetCellularDataRoamingAllowed(true); | 4672 SetCellularDataRoamingAllowed(true); |
4672 } else { | 4673 } else { |
4673 bool settings_value = | 4674 bool settings_value; |
4674 UserCrosSettingsProvider::cached_data_roaming_enabled(); | 4675 if (CrosSettings::Get()->GetBoolean( |
4675 if (device->data_roaming_allowed() != settings_value) { | 4676 kSignedDataRoamingEnabled, &settings_value) && |
| 4677 device->data_roaming_allowed() != settings_value) { |
4676 // Switch back to signed settings value. | 4678 // Switch back to signed settings value. |
4677 SetCellularDataRoamingAllowed(settings_value); | 4679 SetCellularDataRoamingAllowed(settings_value); |
4678 } | 4680 } |
4679 } | 4681 } |
4680 } | 4682 } |
4681 NotifyNetworkManagerChanged(false); // Not forced. | 4683 NotifyNetworkManagerChanged(false); // Not forced. |
4682 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); | 4684 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); |
4683 } | 4685 } |
4684 | 4686 |
4685 //////////////////////////////////////////////////////////////////////////// | 4687 //////////////////////////////////////////////////////////////////////////// |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5157 return impl; | 5159 return impl; |
5158 } | 5160 } |
5159 | 5161 |
5160 ///////////////////////////////////////////////////////////////////////////// | 5162 ///////////////////////////////////////////////////////////////////////////// |
5161 | 5163 |
5162 } // namespace chromeos | 5164 } // namespace chromeos |
5163 | 5165 |
5164 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 5166 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
5165 // won't be deleted until its last InvokeLater is run. | 5167 // won't be deleted until its last InvokeLater is run. |
5166 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 5168 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
OLD | NEW |