[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "ash/shell/shell_delegate_impl.h" |
| 6 | |
| 7 | #include "ash/shell/example_factory.h" |
| 8 | #include "ash/shell/launcher_delegate_impl.h" |
[email protected] | b77236f7 | 2012-03-25 03:07:19 | [diff] [blame] | 9 | #include "ash/shell/toplevel_window.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 10 | #include "ash/shell_window_ids.h" |
| 11 | #include "ash/wm/partial_screenshot_view.h" |
| 12 | #include "base/message_loop.h" |
| 13 | #include "ui/aura/window.h" |
| 14 | |
| 15 | namespace ash { |
| 16 | namespace shell { |
| 17 | |
| 18 | ShellDelegateImpl::ShellDelegateImpl() |
| 19 | : watcher_(NULL), |
| 20 | launcher_delegate_(NULL), |
| 21 | locked_(false) { |
| 22 | } |
| 23 | |
| 24 | ShellDelegateImpl::~ShellDelegateImpl() { |
| 25 | } |
| 26 | |
| 27 | void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) { |
| 28 | watcher_ = watcher; |
| 29 | if (launcher_delegate_) |
| 30 | launcher_delegate_->set_watcher(watcher); |
| 31 | } |
| 32 | |
[email protected] | 1720a44 | 2012-03-25 22:03:47 | [diff] [blame] | 33 | bool ShellDelegateImpl::IsUserLoggedIn() { |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 34 | return true; |
| 35 | } |
| 36 | |
| 37 | void ShellDelegateImpl::LockScreen() { |
| 38 | ash::shell::CreateLockScreen(); |
| 39 | locked_ = true; |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 40 | ash::Shell::GetInstance()->UpdateShelfVisibility(); |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | void ShellDelegateImpl::UnlockScreen() { |
| 44 | locked_ = false; |
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 45 | ash::Shell::GetInstance()->UpdateShelfVisibility(); |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | bool ShellDelegateImpl::IsScreenLocked() const { |
| 49 | return locked_; |
| 50 | } |
| 51 | |
[email protected] | 3528b7d | 2012-04-18 10:46:36 | [diff] [blame^] | 52 | void ShellDelegateImpl::OpenFileManager() { |
| 53 | } |
| 54 | |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 55 | void ShellDelegateImpl::Exit() { |
| 56 | MessageLoopForUI::current()->Quit(); |
| 57 | } |
| 58 | |
[email protected] | b77236f7 | 2012-03-25 03:07:19 | [diff] [blame] | 59 | void ShellDelegateImpl::NewWindow(bool incognito) { |
| 60 | ash::shell::ToplevelWindow::CreateParams create_params; |
| 61 | create_params.can_resize = true; |
| 62 | create_params.can_maximize = true; |
| 63 | ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); |
| 64 | } |
| 65 | |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 66 | ash::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() { |
| 67 | return ash::shell::CreateAppListViewDelegate(); |
| 68 | } |
| 69 | |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 70 | void ShellDelegateImpl::StartPartialScreenshot( |
| 71 | ash::ScreenshotDelegate* screenshot_delegate) { |
| 72 | ash::PartialScreenshotView::StartPartialScreenshot(screenshot_delegate); |
| 73 | } |
| 74 | |
| 75 | ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate( |
| 76 | ash::LauncherModel* model) { |
| 77 | launcher_delegate_ = new LauncherDelegateImpl(watcher_); |
| 78 | return launcher_delegate_; |
| 79 | } |
| 80 | |
| 81 | ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate( |
| 82 | ash::SystemTray* tray) { |
| 83 | return NULL; |
| 84 | } |
| 85 | |
| 86 | ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { |
| 87 | return NULL; |
| 88 | } |
| 89 | |
| 90 | } // namespace shell |
| 91 | } // namespace ash |