OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/display/display_preferences.h" | 5 #include "chrome/browser/chromeos/display/display_preferences.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 LOG(WARNING) << "Can't convert the data into insets for " << *it; | 125 LOG(WARNING) << "Can't convert the data into insets for " << *it; |
126 continue; | 126 continue; |
127 } | 127 } |
128 | 128 |
129 display_controller->SetOverscanInsets(display_id, insets); | 129 display_controller->SetOverscanInsets(display_id, insets); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 } // namespace | 133 } // namespace |
134 | 134 |
135 void RegisterDisplayLocalStatePrefs(PrefService* local_state) { | 135 void RegisterDisplayLocalStatePrefs(PrefServiceSimple* local_state) { |
136 // The default secondary display layout. | 136 // The default secondary display layout. |
137 local_state->RegisterIntegerPref(prefs::kSecondaryDisplayLayout, | 137 local_state->RegisterIntegerPref(prefs::kSecondaryDisplayLayout, |
138 static_cast<int>(ash::DisplayLayout::RIGHT), | 138 static_cast<int>(ash::DisplayLayout::RIGHT)); |
139 PrefService::UNSYNCABLE_PREF); | |
140 // The default offset of the secondary display position from the primary | 139 // The default offset of the secondary display position from the primary |
141 // display. | 140 // display. |
142 local_state->RegisterIntegerPref(prefs::kSecondaryDisplayOffset, | 141 local_state->RegisterIntegerPref(prefs::kSecondaryDisplayOffset, 0); |
143 0, | |
144 PrefService::UNSYNCABLE_PREF); | |
145 // Per-display preference. | 142 // Per-display preference. |
146 local_state->RegisterDictionaryPref(prefs::kSecondaryDisplays, | 143 local_state->RegisterDictionaryPref(prefs::kSecondaryDisplays); |
147 PrefService::UNSYNCABLE_PREF); | |
148 | 144 |
149 // Primary output name. | 145 // Primary output name. |
150 local_state->RegisterInt64Pref(prefs::kPrimaryDisplayID, | 146 local_state->RegisterInt64Pref(prefs::kPrimaryDisplayID, |
151 gfx::Display::kInvalidDisplayID, | 147 gfx::Display::kInvalidDisplayID); |
152 PrefService::UNSYNCABLE_PREF); | |
153 | 148 |
154 // Display overscan preference. | 149 // Display overscan preference. |
155 local_state->RegisterDictionaryPref(prefs::kDisplayOverscans, | 150 local_state->RegisterDictionaryPref(prefs::kDisplayOverscans); |
156 PrefService::UNSYNCABLE_PREF); | |
157 } | 151 } |
158 | 152 |
159 void SetDisplayLayoutPref(const gfx::Display& display, | 153 void SetDisplayLayoutPref(const gfx::Display& display, |
160 int layout, | 154 int layout, |
161 int offset) { | 155 int offset) { |
162 ash::DisplayLayout display_layout( | 156 ash::DisplayLayout display_layout( |
163 static_cast<ash::DisplayLayout::Position>(layout), offset); | 157 static_cast<ash::DisplayLayout::Position>(layout), offset); |
164 if (IsValidUser()) { | 158 if (IsValidUser()) { |
165 PrefService* local_state = g_browser_process->local_state(); | 159 PrefService* local_state = g_browser_process->local_state(); |
166 DictionaryPrefUpdate update(local_state, prefs::kSecondaryDisplays); | 160 DictionaryPrefUpdate update(local_state, prefs::kSecondaryDisplays); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 216 |
223 void NotifyDisplayLocalStatePrefChanged() { | 217 void NotifyDisplayLocalStatePrefChanged() { |
224 PrefService* local_state = g_browser_process->local_state(); | 218 PrefService* local_state = g_browser_process->local_state(); |
225 ash::Shell::GetInstance()->display_controller()->SetPrimaryDisplayId( | 219 ash::Shell::GetInstance()->display_controller()->SetPrimaryDisplayId( |
226 local_state->GetInt64(prefs::kPrimaryDisplayID)); | 220 local_state->GetInt64(prefs::kPrimaryDisplayID)); |
227 NotifyDisplayLayoutChanged(); | 221 NotifyDisplayLayoutChanged(); |
228 NotifyDisplayOverscans(); | 222 NotifyDisplayOverscans(); |
229 } | 223 } |
230 | 224 |
231 } // namespace chromeos | 225 } // namespace chromeos |
OLD | NEW |