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

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: fix test failure (MagnificationManagerTest.ChangeMagnifierType) 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 PrefService* pref_service = g_browser_process->local_state(); 207 PrefService* pref_service = g_browser_process->local_state();
208 pref_service->SetBoolean(prefs::kHighContrastEnabled, enabled); 208 pref_service->SetBoolean(prefs::kHighContrastEnabled, enabled);
209 pref_service->CommitPendingWrite(); 209 pref_service->CommitPendingWrite();
210 210
211 #if defined(USE_ASH) 211 #if defined(USE_ASH)
212 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled); 212 ash::Shell::GetInstance()->high_contrast_controller()->SetEnabled(enabled);
213 #endif 213 #endif
214 } 214 }
215 215
216 void SetMagnifier(ash::MagnifierType type) { 216 void SetMagnifier(ash::MagnifierType type) {
217 if (MagnificationManager::GetInstance()) 217 if (MagnificationManager::Get())
218 MagnificationManager::GetInstance()->SetMagnifier(type); 218 MagnificationManager::Get()->SetMagnifier(type);
219 } 219 }
220 220
221 void EnableVirtualKeyboard(bool enabled) { 221 void EnableVirtualKeyboard(bool enabled) {
222 PrefService* pref_service = g_browser_process->local_state(); 222 PrefService* pref_service = g_browser_process->local_state();
223 pref_service->SetBoolean(prefs::kVirtualKeyboardEnabled, enabled); 223 pref_service->SetBoolean(prefs::kVirtualKeyboardEnabled, enabled);
224 pref_service->CommitPendingWrite(); 224 pref_service->CommitPendingWrite();
225 } 225 }
226 226
227 void ToggleSpokenFeedback(content::WebUI* login_web_ui) { 227 void ToggleSpokenFeedback(content::WebUI* login_web_ui) {
228 bool spoken_feedback_enabled = g_browser_process && 228 bool spoken_feedback_enabled = g_browser_process &&
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (!g_browser_process) { 271 if (!g_browser_process) {
272 return false; 272 return false;
273 } 273 }
274 PrefService* prefs = g_browser_process->local_state(); 274 PrefService* prefs = g_browser_process->local_state();
275 bool virtual_keyboard_enabled = prefs && 275 bool virtual_keyboard_enabled = prefs &&
276 prefs->GetBoolean(prefs::kVirtualKeyboardEnabled); 276 prefs->GetBoolean(prefs::kVirtualKeyboardEnabled);
277 return virtual_keyboard_enabled; 277 return virtual_keyboard_enabled;
278 } 278 }
279 279
280 ash::MagnifierType GetMagnifierType() { 280 ash::MagnifierType GetMagnifierType() {
281 if (!MagnificationManager::GetInstance()) 281 if (!MagnificationManager::Get())
282 return ash::MAGNIFIER_OFF; 282 return ash::MAGNIFIER_OFF;
283 return MagnificationManager::GetInstance()->GetMagnifierType(); 283 return MagnificationManager::Get()->GetMagnifierType();
284 } 284 }
285 285
286 ash::MagnifierType MagnifierTypeFromName(const char type_name[]) { 286 ash::MagnifierType MagnifierTypeFromName(const char type_name[]) {
287 if (0 == strcmp(type_name, kScreenMagnifierFull)) 287 if (0 == strcmp(type_name, kScreenMagnifierFull))
288 return ash::MAGNIFIER_FULL; 288 return ash::MAGNIFIER_FULL;
289 else if (0 == strcmp(type_name, kScreenMagnifierPartial)) 289 else if (0 == strcmp(type_name, kScreenMagnifierPartial))
290 return ash::MAGNIFIER_PARTIAL; 290 return ash::MAGNIFIER_PARTIAL;
291 else 291 else
292 return ash::MAGNIFIER_OFF; 292 return ash::MAGNIFIER_OFF;
293 } 293 }
(...skipping 14 matching lines...) Expand all
308 if (IsSpokenFeedbackEnabled()) 308 if (IsSpokenFeedbackEnabled())
309 Speak(utterance); 309 Speak(utterance);
310 } 310 }
311 311
312 void ShowAccessibilityHelp(Browser* browser) { 312 void ShowAccessibilityHelp(Browser* browser) {
313 chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL)); 313 chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL));
314 } 314 }
315 315
316 } // namespace accessibility 316 } // namespace accessibility
317 } // namespace chromeos 317 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/magnifier/magnification_controller.cc ('k') | chrome/browser/chromeos/accessibility/magnification_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698