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 <algorithm> | 7 #include <algorithm> |
8 #include <dbus/dbus-glib.h> | 8 #include <dbus/dbus-glib.h> |
9 #include <dbus/dbus-gtype-specialized.h> | 9 #include <dbus/dbus-gtype-specialized.h> |
10 #include <glib-object.h> | 10 #include <glib-object.h> |
11 #include <map> | 11 #include <map> |
12 #include <set> | 12 #include <set> |
13 | 13 |
14 #include "base/i18n/icu_encoding_detection.h" | 14 #include "base/i18n/icu_encoding_detection.h" |
15 #include "base/i18n/icu_string_conversions.h" | 15 #include "base/i18n/icu_string_conversions.h" |
16 #include "base/i18n/time_formatting.h" | 16 #include "base/i18n/time_formatting.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
20 #include "base/string_tokenizer.h" | 20 #include "base/string_tokenizer.h" |
21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
22 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "base/utf_string_conversion_utils.h" | 24 #include "base/utf_string_conversion_utils.h" |
25 #include "base/values.h" | 25 #include "base/values.h" |
26 #include "chrome/browser/chromeos/cros_settings.h" | |
27 #include "chrome/browser/chromeos/network_login_observer.h" | |
Denis Lagno
2011/09/20 14:05:22
nit: ASCII order
pastarmovj
2011/09/20 17:11:52
Done.
| |
26 #include "chrome/browser/chromeos/cros/cros_library.h" | 28 #include "chrome/browser/chromeos/cros/cros_library.h" |
27 #include "chrome/browser/chromeos/cros/native_network_constants.h" | 29 #include "chrome/browser/chromeos/cros/native_network_constants.h" |
28 #include "chrome/browser/chromeos/cros/native_network_parser.h" | 30 #include "chrome/browser/chromeos/cros/native_network_parser.h" |
29 #include "chrome/browser/chromeos/login/user_manager.h" | 31 #include "chrome/browser/chromeos/login/user_manager.h" |
30 #include "chrome/browser/chromeos/network_login_observer.h" | |
31 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | |
32 #include "chrome/common/time_format.h" | 32 #include "chrome/common/time_format.h" |
33 #include "content/browser/browser_thread.h" | 33 #include "content/browser/browser_thread.h" |
34 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. | 34 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. |
35 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
36 #include "third_party/cros_system_api/dbus/service_constants.h" | 36 #include "third_party/cros_system_api/dbus/service_constants.h" |
37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
38 #include "ui/base/text/bytes_formatting.h" | 38 #include "ui/base/text/bytes_formatting.h" |
39 | 39 |
40 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
41 // Implementation notes. | 41 // Implementation notes. |
(...skipping 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3473 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 3473 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
3474 NetworkDevice* device = FindNetworkDeviceByPath(path); | 3474 NetworkDevice* device = FindNetworkDeviceByPath(path); |
3475 if (device) { | 3475 if (device) { |
3476 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; | 3476 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; |
3477 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; | 3477 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; |
3478 if (device->UpdateStatus(key, value, &index)) { | 3478 if (device->UpdateStatus(key, value, &index)) { |
3479 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { | 3479 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { |
3480 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 3480 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
3481 SetCellularDataRoamingAllowed(true); | 3481 SetCellularDataRoamingAllowed(true); |
3482 } else { | 3482 } else { |
3483 bool settings_value = | 3483 bool settings_value; |
3484 UserCrosSettingsProvider::cached_data_roaming_enabled(); | 3484 if (CrosSettings::Get()->GetBoolean( |
3485 if (device->data_roaming_allowed() != settings_value) { | 3485 kSignedDataRoamingEnabled, &settings_value) && |
3486 device->data_roaming_allowed() != settings_value) { | |
3486 // Switch back to signed settings value. | 3487 // Switch back to signed settings value. |
3487 SetCellularDataRoamingAllowed(settings_value); | 3488 SetCellularDataRoamingAllowed(settings_value); |
3488 return; | 3489 return; |
3489 } | 3490 } |
3490 } | 3491 } |
3491 } | 3492 } |
3492 } else { | 3493 } else { |
3493 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: " | 3494 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: " |
3494 << path << "." << key; | 3495 << path << "." << key; |
3495 } | 3496 } |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4560 if (device) { | 4561 if (device) { |
4561 device_map_[device_path] = device; | 4562 device_map_[device_path] = device; |
4562 } | 4563 } |
4563 CHECK(device) << "Attempted to add NULL device for path: " << device_path; | 4564 CHECK(device) << "Attempted to add NULL device for path: " << device_path; |
4564 } | 4565 } |
4565 VLOG(1) << "ParseNetworkDevice:" << device->name(); | 4566 VLOG(1) << "ParseNetworkDevice:" << device->name(); |
4566 if (device && device->type() == TYPE_CELLULAR) { | 4567 if (device && device->type() == TYPE_CELLULAR) { |
4567 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 4568 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
4568 SetCellularDataRoamingAllowed(true); | 4569 SetCellularDataRoamingAllowed(true); |
4569 } else { | 4570 } else { |
4570 bool settings_value = | 4571 bool settings_value; |
4571 UserCrosSettingsProvider::cached_data_roaming_enabled(); | 4572 if (CrosSettings::Get()->GetBoolean( |
4572 if (device->data_roaming_allowed() != settings_value) { | 4573 kSignedDataRoamingEnabled, &settings_value) && |
4574 device->data_roaming_allowed() != settings_value) { | |
4573 // Switch back to signed settings value. | 4575 // Switch back to signed settings value. |
4574 SetCellularDataRoamingAllowed(settings_value); | 4576 SetCellularDataRoamingAllowed(settings_value); |
4575 } | 4577 } |
4576 } | 4578 } |
4577 } | 4579 } |
4578 NotifyNetworkManagerChanged(false); // Not forced. | 4580 NotifyNetworkManagerChanged(false); // Not forced. |
4579 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); | 4581 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); |
4580 } | 4582 } |
4581 | 4583 |
4582 //////////////////////////////////////////////////////////////////////////// | 4584 //////////////////////////////////////////////////////////////////////////// |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4948 return impl; | 4950 return impl; |
4949 } | 4951 } |
4950 | 4952 |
4951 ///////////////////////////////////////////////////////////////////////////// | 4953 ///////////////////////////////////////////////////////////////////////////// |
4952 | 4954 |
4953 } // namespace chromeos | 4955 } // namespace chromeos |
4954 | 4956 |
4955 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 4957 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
4956 // won't be deleted until its last InvokeLater is run. | 4958 // won't be deleted until its last InvokeLater is run. |
4957 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 4959 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
OLD | NEW |