Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / preferences.h
blob3f26f5a7e5e8a130ab0602ba79e5949f249c0aae
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_PREFERENCES_H_
6 #define CHROME_BROWSER_CHROMEOS_PREFERENCES_H_
8 #include <string>
9 #include <vector>
11 #include "ash/shell_observer.h"
12 #include "base/compiler_specific.h"
13 #include "base/prefs/pref_member.h"
14 #include "chrome/browser/chromeos/language_preferences.h"
15 #include "chrome/browser/prefs/pref_service_syncable_observer.h"
17 class PrefRegistrySimple;
18 class PrefService;
19 class PrefServiceSyncable;
21 class TracingManager;
23 namespace user_prefs {
24 class PrefRegistrySyncable;
27 namespace chromeos {
29 namespace input_method {
30 class InputMethodManager;
33 // The Preferences class handles Chrome OS preferences. When the class
34 // is first initialized, it will initialize the OS settings to what's stored in
35 // the preferences. These include touchpad settings, etc.
36 // When the preferences change, we change the settings to reflect the new value.
37 class Preferences : public PrefServiceSyncableObserver,
38 public ash::ShellObserver {
39 public:
40 Preferences();
41 explicit Preferences(
42 input_method::InputMethodManager* input_method_manager); // for testing
43 virtual ~Preferences();
45 // These method will register the prefs associated with Chrome OS settings.
46 static void RegisterPrefs(PrefRegistrySimple* registry);
47 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
49 // This method will initialize Chrome OS settings to values in user prefs.
50 // |is_primary_user| is true if preferences are initialized for primary user
51 // in multi-profile session.
52 void Init(PrefServiceSyncable* prefs, bool is_primary_user);
54 void InitUserPrefsForTesting(PrefServiceSyncable* prefs);
55 void SetInputMethodListForTesting();
57 private:
58 // Initializes all member prefs.
59 void InitUserPrefs(PrefServiceSyncable* prefs);
61 // Callback method for preference changes.
62 void OnPreferenceChanged(const std::string& pref_name);
64 // This will set the OS settings when the preference changes.
65 // If this method is called with NULL, it will set all OS settings to what's
66 // stored in the preferences.
67 void NotifyPrefChanged(const std::string* pref_name);
69 // A variant of SetLanguageConfigStringList. You can pass comma-separated
70 // values. Examples of |value|: "", "Control+space,Hiragana"
71 void SetLanguageConfigStringListAsCSV(const char* section,
72 const char* name,
73 const std::string& value);
75 // Restores the user's preferred input method / keyboard layout on signing in.
76 void SetInputMethodList();
78 // Updates the initial key repeat delay and key repeat interval following
79 // current prefs values. We set the delay and interval at once since an
80 // underlying XKB API requires it.
81 void UpdateAutoRepeatRate();
83 // Force natural scroll to on if --enable-natural-scroll-default is specified
84 // on the cmd line.
85 void ForceNaturalScrollDefault();
87 // PrefServiceSyncableObserver implementation.
88 virtual void OnIsSyncingChanged() OVERRIDE;
90 // Overriden from ash::ShellObserver.
91 virtual void OnTouchHudProjectionToggled(bool enabled) OVERRIDE;
93 PrefServiceSyncable* prefs_;
95 input_method::InputMethodManager* input_method_manager_;
96 scoped_ptr<TracingManager> tracing_manager_;
98 BooleanPrefMember performance_tracing_enabled_;
99 BooleanPrefMember tap_to_click_enabled_;
100 BooleanPrefMember tap_dragging_enabled_;
101 BooleanPrefMember three_finger_click_enabled_;
102 BooleanPrefMember natural_scroll_;
103 BooleanPrefMember vert_edge_scroll_enabled_;
104 BooleanPrefMember a11y_spoken_feedback_enabled_;
105 BooleanPrefMember a11y_high_contrast_enabled_;
106 BooleanPrefMember a11y_screen_magnifier_enabled_;
107 IntegerPrefMember a11y_screen_magnifier_type_;
108 DoublePrefMember a11y_screen_magnifier_scale_;
109 IntegerPrefMember speed_factor_;
110 IntegerPrefMember mouse_sensitivity_;
111 IntegerPrefMember touchpad_sensitivity_;
112 BooleanPrefMember primary_mouse_button_right_;
113 BooleanPrefMember use_24hour_clock_;
114 BooleanPrefMember disable_drive_;
115 BooleanPrefMember disable_drive_over_cellular_;
116 BooleanPrefMember disable_drive_hosted_files_;
117 FilePathPrefMember download_default_directory_;
118 FilePathPrefMember select_file_last_directory_;
119 FilePathPrefMember save_file_default_directory_;
120 BooleanPrefMember touch_hud_projection_enabled_;
122 // Input method preferences.
123 StringPrefMember preferred_languages_;
124 StringPrefMember preload_engines_;
125 StringPrefMember current_input_method_;
126 StringPrefMember previous_input_method_;
127 StringPrefMember enabled_extension_imes_;
129 BooleanPrefMember xkb_auto_repeat_enabled_;
130 IntegerPrefMember xkb_auto_repeat_delay_pref_;
131 IntegerPrefMember xkb_auto_repeat_interval_pref_;
133 // True if this preferences instance is for primary user.
134 bool is_primary_user_prefs_;
136 DISALLOW_COPY_AND_ASSIGN(Preferences);
139 } // namespace chromeos
141 #endif // CHROME_BROWSER_CHROMEOS_PREFERENCES_H_