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

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 11280236: A11y: Add the option to always show the a11y tray menu regardless of the state of a11y features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 | Annotate | Revision Log
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/ui/ash/chrome_shell_delegate.h" 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
6 6
7 #include "ash/launcher/launcher_types.h" 7 #include "ash/launcher/launcher_types.h"
8 #include "ash/magnifier/magnifier_constants.h" 8 #include "ash/magnifier/magnifier_constants.h"
9 #include "ash/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "ash/wm/stacking_controller.h" 10 #include "ash/wm/stacking_controller.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 chrome::NOTIFICATION_SESSION_STARTED, 93 chrome::NOTIFICATION_SESSION_STARTED,
94 content::NotificationService::AllSources()); 94 content::NotificationService::AllSources());
95 #endif 95 #endif
96 } 96 }
97 97
98 ChromeShellDelegate::~ChromeShellDelegate() { 98 ChromeShellDelegate::~ChromeShellDelegate() {
99 if (instance_ == this) 99 if (instance_ == this)
100 instance_ = NULL; 100 instance_ = NULL;
101 } 101 }
102 102
103 bool ChromeShellDelegate::IsUserLoggedIn() { 103 bool ChromeShellDelegate::IsUserLoggedIn() const {
104 #if defined(OS_CHROMEOS) 104 #if defined(OS_CHROMEOS)
105 // When running a Chrome OS build outside of a device (i.e. on a developer's 105 // When running a Chrome OS build outside of a device (i.e. on a developer's
106 // workstation) and not running as login-manager, pretend like we're always 106 // workstation) and not running as login-manager, pretend like we're always
107 // logged in. 107 // logged in.
108 if (!base::chromeos::IsRunningOnChromeOS() && 108 if (!base::chromeos::IsRunningOnChromeOS() &&
109 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { 109 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) {
110 return true; 110 return true;
111 } 111 }
112 112
113 return chromeos::UserManager::Get()->IsUserLoggedIn(); 113 return chromeos::UserManager::Get()->IsUserLoggedIn();
114 #else 114 #else
115 return true; 115 return true;
116 #endif 116 #endif
117 } 117 }
118 118
119 // Returns true if we're logged in and browser has been started 119 // Returns true if we're logged in and browser has been started
120 bool ChromeShellDelegate::IsSessionStarted() { 120 bool ChromeShellDelegate::IsSessionStarted() const {
121 #if defined(OS_CHROMEOS) 121 #if defined(OS_CHROMEOS)
122 return chromeos::UserManager::Get()->IsSessionStarted(); 122 return chromeos::UserManager::Get()->IsSessionStarted();
123 #else 123 #else
124 return true; 124 return true;
125 #endif 125 #endif
126 } 126 }
127 127
128 bool ChromeShellDelegate::IsFirstRunAfterBoot() { 128 bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
129 #if defined(OS_CHROMEOS) 129 #if defined(OS_CHROMEOS)
130 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot); 130 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot);
131 #else 131 #else
132 return false; 132 return false;
133 #endif 133 #endif
134 } 134 }
135 135
136 bool ChromeShellDelegate::CanLockScreen() { 136 bool ChromeShellDelegate::CanLockScreen() const {
137 #if defined(OS_CHROMEOS) 137 #if defined(OS_CHROMEOS)
138 return chromeos::UserManager::Get()->CanCurrentUserLock(); 138 return chromeos::UserManager::Get()->CanCurrentUserLock();
139 #else 139 #else
140 return false; 140 return false;
141 #endif 141 #endif
142 } 142 }
143 143
144 void ChromeShellDelegate::LockScreen() { 144 void ChromeShellDelegate::LockScreen() {
145 #if defined(OS_CHROMEOS) 145 #if defined(OS_CHROMEOS)
146 if (CanLockScreen()) { 146 if (CanLockScreen()) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 366
367 void ChromeShellDelegate::SetMagnifier(ash::MagnifierType type) { 367 void ChromeShellDelegate::SetMagnifier(ash::MagnifierType type) {
368 #if defined(OS_CHROMEOS) 368 #if defined(OS_CHROMEOS)
369 chromeos::accessibility::SetMagnifier(type); 369 chromeos::accessibility::SetMagnifier(type);
370 #endif 370 #endif
371 } 371 }
372 372
373 bool ChromeShellDelegate::ShouldAlwaysShowAccessibilityMenu() const { 373 bool ChromeShellDelegate::ShouldAlwaysShowAccessibilityMenu() const {
374 #if defined(OS_CHROMEOS) 374 #if defined(OS_CHROMEOS)
375 // TODO(yoshiki): Add the checkbox on chrome://settings. crbug.com/158287 375 if (!IsUserLoggedIn())
376 return false; 376 return true;
377
378 Profile* profile = ProfileManager::GetDefaultProfile();
379 if (!profile)
380 return false;
381
382 PrefService* user_pref_service = profile->GetPrefs();
383 return user_pref_service &&
384 user_pref_service->GetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu);
377 #else 385 #else
378 return false; 386 return false;
379 #endif 387 #endif
380 } 388 }
381 389
382 app_list::AppListViewDelegate* 390 app_list::AppListViewDelegate*
383 ChromeShellDelegate::CreateAppListViewDelegate() { 391 ChromeShellDelegate::CreateAppListViewDelegate() {
384 DCHECK(ash::Shell::HasInstance()); 392 DCHECK(ash::Shell::HasInstance());
385 // Shell will own the created delegate, and the delegate will own 393 // Shell will own the created delegate, and the delegate will own
386 // the controller. 394 // the controller.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 ash::Shell::GetInstance()->ShowLauncher(); 572 ash::Shell::GetInstance()->ShowLauncher();
565 break; 573 break;
566 default: 574 default:
567 NOTREACHED() << "Unexpected notification " << type; 575 NOTREACHED() << "Unexpected notification " << type;
568 } 576 }
569 #else 577 #else
570 // MSVC++ warns about switch statements without any cases. 578 // MSVC++ warns about switch statements without any cases.
571 NOTREACHED() << "Unexpected notification " << type; 579 NOTREACHED() << "Unexpected notification " << type;
572 #endif 580 #endif
573 } 581 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.h ('k') | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698