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

Unified Diff: chrome/browser/chromeos/preferences.cc

Issue 811973002: Enable lucid sleep (wake on wi-fi SSID) and add to Privacy options. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/preferences.cc
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index 6ab83e2f9f6e41b19920cf30e8dc5a7434cfd1d1..4cf6115c0cd901a866f407c55c95084cb1826b1f 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -24,7 +24,6 @@
#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/wake_on_wifi_manager.h"
#include "chrome/browser/chromeos/system/input_device_settings.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
@@ -45,6 +44,10 @@
#include "ui/events/event_utils.h"
#include "url/gurl.h"
+#if !defined(DISABLE_WAKE_ON_WIFI)
+#include "chrome/browser/chromeos/net/wake_on_wifi_manager.h"
+#endif
+
namespace chromeos {
static const char kFallbackInputMethodLocale[] = "en-US";
@@ -273,13 +276,9 @@ void Preferences::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
// We don't sync wake-on-wifi related prefs because they are device specific.
- // TODO(chirantan): Default this to on when we are ready to launch.
- registry->RegisterIntegerPref(
- prefs::kWakeOnWiFiEnabled,
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kWakeOnPackets)
- ? WakeOnWifiManager::WAKE_ON_PACKET_AND_SSID
- : WakeOnWifiManager::WAKE_ON_NONE,
+ registry->RegisterBooleanPref(
+ prefs::kWakeOnWifiSsid,
+ true,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
// Mobile plan notifications default to on.
@@ -359,7 +358,9 @@ void Preferences::InitUserPrefs(PrefServiceSyncable* prefs) {
xkb_auto_repeat_interval_pref_.Init(
prefs::kLanguageXkbAutoRepeatInterval, prefs, callback);
- wake_on_wifi_enabled_.Init(prefs::kWakeOnWiFiEnabled, prefs, callback);
+#if !defined(DISABLE_WAKE_ON_WIFI)
+ wake_on_wifi_ssid_.Init(prefs::kWakeOnWifiSsid, prefs, callback);
+#endif
}
void Preferences::Init(Profile* profile, const user_manager::User* user) {
@@ -573,13 +574,6 @@ void Preferences::ApplyPreferences(ApplyReason reason,
UpdateAutoRepeatRate();
}
- if (user_is_primary_ && (reason != REASON_PREF_CHANGED ||
- pref_name == prefs::kWakeOnWiFiEnabled)) {
- WakeOnWifiManager::Get()->OnPreferenceChanged(
- static_cast<WakeOnWifiManager::WakeOnWifiFeature>(
- wake_on_wifi_enabled_.GetValue()));
- }
-
if (reason == REASON_INITIALIZATION)
SetInputMethodList();
@@ -607,6 +601,19 @@ void Preferences::ApplyPreferences(ApplyReason reason,
touchpad_settings);
system::InputDeviceSettings::Get()->UpdateMouseSettings(mouse_settings);
}
+
+#if !defined(DISABLE_WAKE_ON_WIFI)
+ if (user_is_primary_ && (reason != REASON_PREF_CHANGED ||
+ pref_name == prefs::kWakeOnWifiSsid)) {
+ int features = wake_on_wifi_ssid_.GetValue() ?
+ WakeOnWifiManager::WAKE_ON_SSID : WakeOnWifiManager::WAKE_ON_NONE;
+ // The flag enables wake on packets but doesn't update a preference.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWakeOnPackets))
+ features |= WakeOnWifiManager::WAKE_ON_PACKET;
michaelpg 2014/12/17 02:30:54 bitwise operations make life easier and will conti
+ WakeOnWifiManager::Get()->OnPreferenceChanged(
+ static_cast<WakeOnWifiManager::WakeOnWifiFeature>(features));
+ }
+#endif // !defined(DISABLE_WAKE_ON_WIFI)
}
void Preferences::OnIsSyncingChanged() {

Powered by Google App Engine
This is Rietveld 408576698