| 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/views/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/views/ash/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher_types.h" | 7 #include "ash/launcher/launcher_types.h" |
| 8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
| 9 #include "ash/wm/partial_screenshot_view.h" | 9 #include "ash/wm/partial_screenshot_view.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h" | 15 #include "chrome/browser/ui/views/ash/app_list/app_list_view_delegate.h" |
| 15 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h" | 16 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_delegate.h" |
| 16 #include "chrome/browser/ui/views/ash/status_area_host_aura.h" | 17 #include "chrome/browser/ui/views/ash/status_area_host_aura.h" |
| 17 #include "chrome/browser/ui/views/ash/window_positioner.h" | 18 #include "chrome/browser/ui/views/ash/window_positioner.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 21 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // workstation), pretend like we're always logged in. | 83 // workstation), pretend like we're always logged in. |
| 83 if (!base::chromeos::IsRunningOnChromeOS()) | 84 if (!base::chromeos::IsRunningOnChromeOS()) |
| 84 return true; | 85 return true; |
| 85 | 86 |
| 86 return chromeos::UserManager::Get()->IsUserLoggedIn(); | 87 return chromeos::UserManager::Get()->IsUserLoggedIn(); |
| 87 #else | 88 #else |
| 88 return true; | 89 return true; |
| 89 #endif | 90 #endif |
| 90 } | 91 } |
| 91 | 92 |
| 93 void ChromeShellDelegate::LockScreen() { |
| 92 #if defined(OS_CHROMEOS) | 94 #if defined(OS_CHROMEOS) |
| 93 void ChromeShellDelegate::LockScreen() { | |
| 94 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { | 95 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
| 95 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 96 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 96 NotifyScreenLockRequested(); | 97 NotifyScreenLockRequested(); |
| 97 } | 98 } |
| 99 #endif |
| 98 } | 100 } |
| 101 |
| 102 void ChromeShellDelegate::UnlockScreen() { |
| 103 // This is used only for testing thus far. |
| 104 NOTIMPLEMENTED(); |
| 105 } |
| 106 |
| 107 bool ChromeShellDelegate::IsScreenLocked() const { |
| 108 #if defined(OS_CHROMEOS) |
| 109 if (!chromeos::ScreenLocker::default_screen_locker()) |
| 110 return false; |
| 111 return chromeos::ScreenLocker::default_screen_locker()->locked(); |
| 112 #else |
| 113 return false; |
| 99 #endif | 114 #endif |
| 115 } |
| 100 | 116 |
| 101 void ChromeShellDelegate::Exit() { | 117 void ChromeShellDelegate::Exit() { |
| 102 BrowserList::AttemptUserExit(); | 118 BrowserList::AttemptUserExit(); |
| 103 } | 119 } |
| 104 | 120 |
| 105 ash::AppListViewDelegate* | 121 ash::AppListViewDelegate* |
| 106 ChromeShellDelegate::CreateAppListViewDelegate() { | 122 ChromeShellDelegate::CreateAppListViewDelegate() { |
| 107 // Shell will own the created delegate. | 123 // Shell will own the created delegate. |
| 108 return new AppListViewDelegate; | 124 return new AppListViewDelegate; |
| 109 } | 125 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 ash::Shell::GetInstance()->CreateLauncher(); | 169 ash::Shell::GetInstance()->CreateLauncher(); |
| 154 break; | 170 break; |
| 155 default: | 171 default: |
| 156 NOTREACHED() << "Unexpected notification " << type; | 172 NOTREACHED() << "Unexpected notification " << type; |
| 157 } | 173 } |
| 158 #else | 174 #else |
| 159 // MSVC++ warns about switch statements without any cases. | 175 // MSVC++ warns about switch statements without any cases. |
| 160 NOTREACHED() << "Unexpected notification " << type; | 176 NOTREACHED() << "Unexpected notification " << type; |
| 161 #endif | 177 #endif |
| 162 } | 178 } |
| OLD | NEW |