Index: chrome/browser/chromeos/preferences.cc |
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc |
index ad25bcc182b6eb8f5bf616751e0ea2431b533417..d1c2a1145521da9cb7a8c9b9de0fe8d2cfc8f6ab 100644 |
--- a/chrome/browser/chromeos/preferences.cc |
+++ b/chrome/browser/chromeos/preferences.cc |
@@ -24,6 +24,7 @@ |
#include "chrome/browser/chromeos/drive/file_system_util.h" |
#include "chrome/browser/chromeos/input_method/input_method_syncer.h" |
#include "chrome/browser/chromeos/login/session/user_session_manager.h" |
+#include "chrome/browser/chromeos/net/network_throttling_observer.h" |
#include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" |
#include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
#include "chrome/browser/chromeos/system/input_device_settings.h" |
@@ -629,6 +630,30 @@ void Preferences::ApplyPreferences(ApplyReason reason, |
UpdateAutoRepeatRate(); |
} |
+ // TODO(kirtika): Shill handles the initialization part, just handle |
+ // the case when preference changes |
+ if (reason == REASON_INITIALIZATION || |
Mattias Nissler (ping if slow)
2016/10/20 07:28:40
If you want this code to trigger when the pref cha
|
+ pref_name == prefs::kNetworkThrottlingEnabled) { |
+ PrefService* prefs = g_browser_process->local_state(); |
+ const base::DictionaryValue* throttling_policy = |
+ prefs->GetDictionary(prefs::kNetworkThrottlingEnabled); |
+ // TODO(kirtika): Add something like IsDictValid (see existing chrome code) |
+ // here |
+ if (!throttling_policy) { |
+ LOG(ERROR) << "Couldn't get throttling policy"; |
+ } else { |
+ bool enabled; |
+ uint32_t upload_rate, download_rate; |
+ throttling_policy->GetBoolean("enabled", &enabled); |
+ throttling_policy->GetInteger("upload_rate_kbits", |
+ reinterpret_cast<int*>(&upload_rate)); |
+ throttling_policy->GetInteger("download_rate_kbits", |
+ reinterpret_cast<int*>(&download_rate)); |
+ } |
+ // TODO(kirtika): Testing-only, till the actual policy is available |
+ NetworkThrottlingObserver::Get()->OnPreferenceChanged(true, 3400, 3400); |
+ } |
+ |
if (reason == REASON_INITIALIZATION) |
SetInputMethodList(); |