Index: chrome/browser/chromeos/preferences.cc |
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc |
index ad25bcc182b6eb8f5bf616751e0ea2431b533417..10d8b50c09065667d4d95069b92003b06f1ae277 100644 |
--- a/chrome/browser/chromeos/preferences.cc |
+++ b/chrome/browser/chromeos/preferences.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/chromeos/preferences.h" |
+#include <limits> |
#include <vector> |
#include "ash/autoclick/autoclick_controller.h" |
@@ -24,6 +25,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" |
@@ -122,7 +124,7 @@ void Preferences::RegisterProfilePrefs( |
} |
registry->RegisterBooleanPref(prefs::kPerformanceTracingEnabled, false); |
- |
+ registry->RegisterDictionaryPref(prefs::kNetworkThrottlingEnabled); |
Andrew T Wilson (Slow)
2016/10/21 13:27:30
Agreed with Mattias that I don't understand why we
|
registry->RegisterBooleanPref( |
prefs::kTapToClickEnabled, |
true, |
@@ -395,6 +397,7 @@ void Preferences::InitUserPrefs(syncable_prefs::PrefServiceSyncable* prefs) { |
pref_change_registrar_.Init(prefs); |
pref_change_registrar_.Add(prefs::kResolveTimezoneByGeolocation, callback); |
pref_change_registrar_.Add(prefs::kUse24HourClock, callback); |
+ pref_change_registrar_.Add(prefs::kNetworkThrottlingEnabled, callback); |
} |
void Preferences::Init(Profile* profile, const user_manager::User* user) { |
@@ -629,6 +632,26 @@ void Preferences::ApplyPreferences(ApplyReason reason, |
UpdateAutoRepeatRate(); |
} |
+ if (pref_name == prefs::kNetworkThrottlingEnabled && |
+ reason == REASON_PREF_CHANGED) { |
+ PrefService* prefs = g_browser_process->local_state(); |
+ const base::DictionaryValue* throttling_policy = |
+ prefs->GetDictionary(prefs::kNetworkThrottlingEnabled); |
+ |
+ if (!throttling_policy) { |
Andrew T Wilson (Slow)
2016/10/21 13:27:30
empty clause?
|
+ } 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)); |
+ NetworkThrottlingObserver::Get()->OnPreferenceChanged( |
Andrew T Wilson (Slow)
2016/10/21 13:27:30
This is kind of ugly - can you have NetworkThrottl
stevenjb
2016/10/21 19:41:20
+1. NetworkThrottlingObserver should be a proper p
|
+ enabled, upload_rate, download_rate); |
+ } |
+ } |
+ |
if (reason == REASON_INITIALIZATION) |
SetInputMethodList(); |