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.
5 #include "ash/shell/shell_delegate_impl.h"
7 #include "ash/accessibility_delegate.h"
8 #include "ash/caps_lock_delegate_stub.h"
9 #include "ash/default_accessibility_delegate.h"
10 #include "ash/default_user_wallpaper_delegate.h"
11 #include "ash/host/root_window_host_factory.h"
12 #include "ash/keyboard_controller_proxy_stub.h"
13 #include "ash/media_delegate.h"
14 #include "ash/new_window_delegate.h"
15 #include "ash/session_state_delegate.h"
16 #include "ash/session_state_delegate_stub.h"
17 #include "ash/shell/context_menu.h"
18 #include "ash/shell/example_factory.h"
19 #include "ash/shell/launcher_delegate_impl.h"
20 #include "ash/shell/toplevel_window.h"
21 #include "ash/shell_window_ids.h"
22 #include "ash/system/tray/default_system_tray_delegate.h"
23 #include "ash/wm/window_state.h"
24 #include "base/message_loop/message_loop.h"
25 #include "ui/aura/window.h"
26 #include "ui/views/corewm/input_method_event_filter.h"
32 class NewWindowDelegateImpl : public NewWindowDelegate {
34 NewWindowDelegateImpl() {}
35 virtual ~NewWindowDelegateImpl() {}
37 virtual void NewTab() OVERRIDE {}
38 virtual void NewWindow(bool incognito) OVERRIDE {
39 ash::shell::ToplevelWindow::CreateParams create_params;
40 create_params.can_resize = true;
41 create_params.can_maximize = true;
42 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params);
44 virtual void OpenFileManager() OVERRIDE {}
45 virtual void OpenCrosh() OVERRIDE {}
46 virtual void RestoreTab() OVERRIDE {}
47 virtual void ShowKeyboardOverlay() OVERRIDE {}
48 virtual void ShowTaskManager() OVERRIDE {}
49 virtual void OpenFeedbackPage() OVERRIDE {}
52 DISALLOW_COPY_AND_ASSIGN(NewWindowDelegateImpl);
55 class MediaDelegateImpl : public MediaDelegate {
57 MediaDelegateImpl() {}
58 virtual ~MediaDelegateImpl() {}
60 virtual void HandleMediaNextTrack() OVERRIDE {}
61 virtual void HandleMediaPlayPause() OVERRIDE {}
62 virtual void HandleMediaPrevTrack() OVERRIDE {}
65 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
70 ShellDelegateImpl::ShellDelegateImpl()
72 launcher_delegate_(NULL) {
75 ShellDelegateImpl::~ShellDelegateImpl() {
78 void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
80 if (launcher_delegate_)
81 launcher_delegate_->set_watcher(watcher);
84 bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
88 bool ShellDelegateImpl::IsIncognitoAllowed() const {
92 bool ShellDelegateImpl::IsMultiProfilesEnabled() const {
96 bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
100 void ShellDelegateImpl::PreInit() {
103 void ShellDelegateImpl::Shutdown() {
106 void ShellDelegateImpl::Exit() {
107 base::MessageLoopForUI::current()->Quit();
110 keyboard::KeyboardControllerProxy*
111 ShellDelegateImpl::CreateKeyboardControllerProxy() {
112 return new KeyboardControllerProxyStub();
115 content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() {
116 return Shell::GetInstance()->browser_context();
119 app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() {
120 return ash::shell::CreateAppListViewDelegate();
123 ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(
124 ash::LauncherModel* model) {
125 launcher_delegate_ = new LauncherDelegateImpl(watcher_);
126 return launcher_delegate_;
129 ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
130 return new DefaultSystemTrayDelegate;
133 ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() {
134 return new DefaultUserWallpaperDelegate();
137 ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() {
138 return new CapsLockDelegateStub;
141 ash::SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() {
142 return new SessionStateDelegateStub;
145 ash::AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() {
146 return new internal::DefaultAccessibilityDelegate;
149 ash::NewWindowDelegate* ShellDelegateImpl::CreateNewWindowDelegate() {
150 return new NewWindowDelegateImpl;
153 ash::MediaDelegate* ShellDelegateImpl::CreateMediaDelegate() {
154 return new MediaDelegateImpl;
157 aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
161 void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) {
164 ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::Window* root) {
165 return new ContextMenu(root);
168 RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() {
169 return RootWindowHostFactory::Create();
172 base::string16 ShellDelegateImpl::GetProductName() const {
173 return base::string16();