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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_util.cc

Issue 11280287: Magnifier: Prevent useless operation in enabling/disabling magnifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review fix (#2 & #3) Created 8 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 unified diff | Download patch
OLDNEW
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/accessibility/accessibility_util.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "ash/high_contrast/high_contrast_controller.h" 9 #include "ash/high_contrast/high_contrast_controller.h"
10 #include "ash/magnifier/magnification_controller.h" 10 #include "ash/magnifier/magnification_controller.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 PrefService* pref_service = g_browser_process->local_state(); 204 PrefService* pref_service = g_browser_process->local_state();
205 pref_service->SetBoolean(prefs::kHighContrastEnabled, enabled); 205 pref_service->SetBoolean(prefs::kHighContrastEnabled, enabled);
206 pref_service->CommitPendingWrite(); 206 pref_service->CommitPendingWrite();
207 207
208 #if defined(USE_ASH) 208 #if defined(USE_ASH)
209 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); 209 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled);
210 #endif 210 #endif
211 } 211 }
212 212
213 void SetMagnifier(ash::MagnifierType type) { 213 void SetMagnifier(ash::MagnifierType type) {
214 if (MagnificationManager::GetInstance()) 214 if (MagnificationManager::Get())
215 MagnificationManager::GetInstance()->SetMagnifier(type); 215 MagnificationManager::Get()->SetMagnifier(type);
216 } 216 }
217 217
218 void EnableVirtualKeyboard(bool enabled) { 218 void EnableVirtualKeyboard(bool enabled) {
219 PrefService* pref_service = g_browser_process->local_state(); 219 PrefService* pref_service = g_browser_process->local_state();
220 pref_service->SetBoolean(prefs::kVirtualKeyboardEnabled, enabled); 220 pref_service->SetBoolean(prefs::kVirtualKeyboardEnabled, enabled);
221 pref_service->CommitPendingWrite(); 221 pref_service->CommitPendingWrite();
222 } 222 }
223 223
224 void ToggleSpokenFeedback(content::WebUI* login_web_ui) { 224 void ToggleSpokenFeedback(content::WebUI* login_web_ui) {
225 bool spoken_feedback_enabled = g_browser_process && 225 bool spoken_feedback_enabled = g_browser_process &&
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 if (!g_browser_process) { 268 if (!g_browser_process) {
269 return false; 269 return false;
270 } 270 }
271 PrefService* prefs = g_browser_process->local_state(); 271 PrefService* prefs = g_browser_process->local_state();
272 bool virtual_keyboard_enabled = prefs && 272 bool virtual_keyboard_enabled = prefs &&
273 prefs->GetBoolean(prefs::kVirtualKeyboardEnabled); 273 prefs->GetBoolean(prefs::kVirtualKeyboardEnabled);
274 return virtual_keyboard_enabled; 274 return virtual_keyboard_enabled;
275 } 275 }
276 276
277 ash::MagnifierType GetMagnifierType() { 277 ash::MagnifierType GetMagnifierType() {
278 if (!MagnificationManager::GetInstance()) 278 if (!MagnificationManager::Get())
279 return ash::MAGNIFIER_OFF; 279 return ash::MAGNIFIER_OFF;
280 return MagnificationManager::GetInstance()->GetMagnifierType(); 280 return MagnificationManager::Get()->GetMagnifierType();
281 } 281 }
282 282
283 ash::MagnifierType MagnifierTypeFromName(const char type_name[]) { 283 ash::MagnifierType MagnifierTypeFromName(const char type_name[]) {
284 if (0 == strcmp(type_name, kScreenMagnifierFull)) 284 if (0 == strcmp(type_name, kScreenMagnifierFull))
285 return ash::MAGNIFIER_FULL; 285 return ash::MAGNIFIER_FULL;
286 else if (0 == strcmp(type_name, kScreenMagnifierPartial)) 286 else if (0 == strcmp(type_name, kScreenMagnifierPartial))
287 return ash::MAGNIFIER_PARTIAL; 287 return ash::MAGNIFIER_PARTIAL;
288 else 288 else
289 return ash::MAGNIFIER_OFF; 289 return ash::MAGNIFIER_OFF;
290 } 290 }
(...skipping 14 matching lines...) Expand all
305 if (IsSpokenFeedbackEnabled()) 305 if (IsSpokenFeedbackEnabled())
306 Speak(utterance); 306 Speak(utterance);
307 } 307 }
308 308
309 void ShowAccessibilityHelp(Browser* browser) { 309 void ShowAccessibilityHelp(Browser* browser) {
310 chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL)); 310 chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL));
311 } 311 }
312 312
313 } // namespace accessibility 313 } // namespace accessibility
314 } // namespace chromeos 314 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698