Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Side by Side Diff: chrome/browser/chromeos/cros/network_library.cc

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ckleaned up values.cc and profile_impl.cc that has creeped from the rebase back in. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 14 #include "base/bind.h"
15 #include "base/i18n/icu_encoding_detection.h" 15 #include "base/i18n/icu_encoding_detection.h"
16 #include "base/i18n/icu_string_conversions.h" 16 #include "base/i18n/icu_string_conversions.h"
17 #include "base/i18n/time_formatting.h" 17 #include "base/i18n/time_formatting.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/stl_util.h" 19 #include "base/stl_util.h"
20 #include "base/string_number_conversions.h" 20 #include "base/string_number_conversions.h"
21 #include "base/string_tokenizer.h" 21 #include "base/string_tokenizer.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #include "base/stringprintf.h" 23 #include "base/stringprintf.h"
24 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
25 #include "base/utf_string_conversion_utils.h" 25 #include "base/utf_string_conversion_utils.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 #include "chrome/browser/chromeos/cros_settings.h"
27 #include "chrome/browser/chromeos/cros/cros_library.h" 28 #include "chrome/browser/chromeos/cros/cros_library.h"
28 #include "chrome/browser/chromeos/cros/native_network_constants.h" 29 #include "chrome/browser/chromeos/cros/native_network_constants.h"
29 #include "chrome/browser/chromeos/cros/native_network_parser.h" 30 #include "chrome/browser/chromeos/cros/native_network_parser.h"
30 #include "chrome/browser/chromeos/login/user_manager.h" 31 #include "chrome/browser/chromeos/login/user_manager.h"
31 #include "chrome/browser/chromeos/network_login_observer.h" 32 #include "chrome/browser/chromeos/network_login_observer.h"
32 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
33 #include "chrome/common/time_format.h" 33 #include "chrome/common/time_format.h"
34 #include "content/browser/browser_thread.h" 34 #include "content/browser/browser_thread.h"
35 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. 35 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN.
36 #include "grit/generated_resources.h" 36 #include "grit/generated_resources.h"
37 #include "third_party/cros_system_api/dbus/service_constants.h" 37 #include "third_party/cros_system_api/dbus/service_constants.h"
38 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
39 #include "ui/base/text/bytes_formatting.h" 39 #include "ui/base/text/bytes_formatting.h"
40 40
41 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
42 // Implementation notes. 42 // Implementation notes.
(...skipping 3468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3511 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 3511 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
3512 NetworkDevice* device = FindNetworkDeviceByPath(path); 3512 NetworkDevice* device = FindNetworkDeviceByPath(path);
3513 if (device) { 3513 if (device) {
3514 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key; 3514 VLOG(2) << "UpdateNetworkDeviceStatus: " << device->name() << "." << key;
3515 PropertyIndex index = PROPERTY_INDEX_UNKNOWN; 3515 PropertyIndex index = PROPERTY_INDEX_UNKNOWN;
3516 if (device->UpdateStatus(key, value, &index)) { 3516 if (device->UpdateStatus(key, value, &index)) {
3517 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { 3517 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) {
3518 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { 3518 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) {
3519 SetCellularDataRoamingAllowed(true); 3519 SetCellularDataRoamingAllowed(true);
3520 } else { 3520 } else {
3521 bool settings_value = 3521 bool settings_value;
3522 UserCrosSettingsProvider::cached_data_roaming_enabled(); 3522 if (CrosSettings::Get()->GetBoolean(
3523 if (device->data_roaming_allowed() != settings_value) { 3523 kSignedDataRoamingEnabled, &settings_value) &&
3524 device->data_roaming_allowed() != settings_value) {
3524 // Switch back to signed settings value. 3525 // Switch back to signed settings value.
3525 SetCellularDataRoamingAllowed(settings_value); 3526 SetCellularDataRoamingAllowed(settings_value);
3526 return; 3527 return;
3527 } 3528 }
3528 } 3529 }
3529 } 3530 }
3530 } else { 3531 } else {
3531 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: " 3532 VLOG(1) << "UpdateNetworkDeviceStatus: Failed to update: "
3532 << path << "." << key; 3533 << path << "." << key;
3533 } 3534 }
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
4585 if (device) { 4586 if (device) {
4586 device_map_[device_path] = device; 4587 device_map_[device_path] = device;
4587 } 4588 }
4588 CHECK(device) << "Attempted to add NULL device for path: " << device_path; 4589 CHECK(device) << "Attempted to add NULL device for path: " << device_path;
4589 } 4590 }
4590 VLOG(1) << "ParseNetworkDevice:" << device->name(); 4591 VLOG(1) << "ParseNetworkDevice:" << device->name();
4591 if (device && device->type() == TYPE_CELLULAR) { 4592 if (device && device->type() == TYPE_CELLULAR) {
4592 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { 4593 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) {
4593 SetCellularDataRoamingAllowed(true); 4594 SetCellularDataRoamingAllowed(true);
4594 } else { 4595 } else {
4595 bool settings_value = 4596 bool settings_value;
4596 UserCrosSettingsProvider::cached_data_roaming_enabled(); 4597 if (CrosSettings::Get()->GetBoolean(
4597 if (device->data_roaming_allowed() != settings_value) { 4598 kSignedDataRoamingEnabled, &settings_value) &&
4599 device->data_roaming_allowed() != settings_value) {
4598 // Switch back to signed settings value. 4600 // Switch back to signed settings value.
4599 SetCellularDataRoamingAllowed(settings_value); 4601 SetCellularDataRoamingAllowed(settings_value);
4600 } 4602 }
4601 } 4603 }
4602 } 4604 }
4603 NotifyNetworkManagerChanged(false); // Not forced. 4605 NotifyNetworkManagerChanged(false); // Not forced.
4604 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); 4606 AddNetworkDeviceObserver(device_path, network_device_observer_.get());
4605 } 4607 }
4606 4608
4607 //////////////////////////////////////////////////////////////////////////// 4609 ////////////////////////////////////////////////////////////////////////////
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 return impl; 5079 return impl;
5078 } 5080 }
5079 5081
5080 ///////////////////////////////////////////////////////////////////////////// 5082 /////////////////////////////////////////////////////////////////////////////
5081 5083
5082 } // namespace chromeos 5084 } // namespace chromeos
5083 5085
5084 // Allows InvokeLater without adding refcounting. This class is a Singleton and 5086 // Allows InvokeLater without adding refcounting. This class is a Singleton and
5085 // won't be deleted until its last InvokeLater is run. 5087 // won't be deleted until its last InvokeLater is run.
5086 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); 5088 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698