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

Side by Side Diff: chrome/browser/chromeos/preferences.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/preferences.h" 5 #include "chrome/browser/chromeos/preferences.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/chromeos/cros/cros_library.h" 12 #include "chrome/browser/chromeos/cros/cros_library.h"
13 #include "chrome/browser/chromeos/cros/power_library.h" 13 #include "chrome/browser/chromeos/cros/power_library.h"
14 #include "chrome/browser/chromeos/cros/touchpad_library.h" 14 #include "chrome/browser/chromeos/cros/touchpad_library.h"
15 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 15 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
16 #include "chrome/browser/chromeos/input_method/input_method_util.h" 16 #include "chrome/browser/chromeos/input_method/input_method_util.h"
17 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 17 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
18 #include "chrome/browser/chromeos/login/login_utils.h" 18 #include "chrome/browser/chromeos/login/login_utils.h"
19 #include "chrome/browser/prefs/pref_member.h" 19 #include "chrome/browser/prefs/pref_member.h"
20 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "content/common/notification_details.h" 23 #include "content/common/notification_details.h"
23 #include "content/common/notification_source.h" 24 #include "content/common/notification_source.h"
24 #include "content/common/notification_type.h"
25 #include "unicode/timezone.h" 25 #include "unicode/timezone.h"
26 26
27 namespace chromeos { 27 namespace chromeos {
28 28
29 static const char kFallbackInputMethodLocale[] = "en-US"; 29 static const char kFallbackInputMethodLocale[] = "en-US";
30 30
31 Preferences::Preferences() {} 31 Preferences::Preferences() {}
32 32
33 Preferences::~Preferences() {} 33 Preferences::~Preferences() {}
34 34
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // Initialize preferences to currently saved state. 257 // Initialize preferences to currently saved state.
258 NotifyPrefChanged(NULL); 258 NotifyPrefChanged(NULL);
259 259
260 // If a guest is logged in, initialize the prefs as if this is the first 260 // If a guest is logged in, initialize the prefs as if this is the first
261 // login. 261 // login.
262 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { 262 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) {
263 LoginUtils::Get()->SetFirstLoginPrefs(prefs); 263 LoginUtils::Get()->SetFirstLoginPrefs(prefs);
264 } 264 }
265 } 265 }
266 266
267 void Preferences::Observe(NotificationType type, 267 void Preferences::Observe(int type,
268 const NotificationSource& source, 268 const NotificationSource& source,
269 const NotificationDetails& details) { 269 const NotificationDetails& details) {
270 if (type == NotificationType::PREF_CHANGED) 270 if (type == chrome::NOTIFICATION_PREF_CHANGED)
271 NotifyPrefChanged(Details<std::string>(details).ptr()); 271 NotifyPrefChanged(Details<std::string>(details).ptr());
272 } 272 }
273 273
274 void Preferences::NotifyPrefChanged(const std::string* pref_name) { 274 void Preferences::NotifyPrefChanged(const std::string* pref_name) {
275 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { 275 if (!pref_name || *pref_name == prefs::kTapToClickEnabled) {
276 bool enabled = tap_to_click_enabled_.GetValue(); 276 bool enabled = tap_to_click_enabled_.GetValue();
277 CrosLibrary::Get()->GetTouchpadLibrary()->SetTapToClick(enabled); 277 CrosLibrary::Get()->GetTouchpadLibrary()->SetTapToClick(enabled);
278 if (pref_name) 278 if (pref_name)
279 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled); 279 UMA_HISTOGRAM_BOOLEAN("Touchpad.TapToClick.Changed", enabled);
280 else 280 else
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 input_method::AutoRepeatRate rate; 531 input_method::AutoRepeatRate rate;
532 rate.initial_delay_in_ms = language_xkb_auto_repeat_delay_pref_.GetValue(); 532 rate.initial_delay_in_ms = language_xkb_auto_repeat_delay_pref_.GetValue();
533 rate.repeat_interval_in_ms = 533 rate.repeat_interval_in_ms =
534 language_xkb_auto_repeat_interval_pref_.GetValue(); 534 language_xkb_auto_repeat_interval_pref_.GetValue();
535 DCHECK(rate.initial_delay_in_ms > 0); 535 DCHECK(rate.initial_delay_in_ms > 0);
536 DCHECK(rate.repeat_interval_in_ms > 0); 536 DCHECK(rate.repeat_interval_in_ms > 0);
537 input_method::SetAutoRepeatRate(rate); 537 input_method::SetAutoRepeatRate(rate);
538 } 538 }
539 539
540 } // namespace chromeos 540 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/browser/chromeos/status/clock_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698