| 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/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 Loading... |
| 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(); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 ash::Shell::GetInstance()->ShowLauncher(); | 567 ash::Shell::GetInstance()->ShowLauncher(); |
| 560 break; | 568 break; |
| 561 default: | 569 default: |
| 562 NOTREACHED() << "Unexpected notification " << type; | 570 NOTREACHED() << "Unexpected notification " << type; |
| 563 } | 571 } |
| 564 #else | 572 #else |
| 565 // MSVC++ warns about switch statements without any cases. | 573 // MSVC++ warns about switch statements without any cases. |
| 566 NOTREACHED() << "Unexpected notification " << type; | 574 NOTREACHED() << "Unexpected notification " << type; |
| 567 #endif | 575 #endif |
| 568 } | 576 } |
| OLD | NEW |