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/test/test_shell_delegate.h"
9 #include "ash/caps_lock_delegate_stub.h"
10 #include "ash/default_accessibility_delegate.h"
11 #include "ash/host/root_window_host_factory.h"
12 #include "ash/media_delegate.h"
13 #include "ash/new_window_delegate.h"
14 #include "ash/session_state_delegate.h"
15 #include "ash/shell.h"
16 #include "ash/shell/keyboard_controller_proxy_stub.h"
17 #include "ash/shell_window_ids.h"
18 #include "ash/test/test_session_state_delegate.h"
19 #include "ash/test/test_shelf_delegate.h"
20 #include "ash/test/test_system_tray_delegate.h"
21 #include "ash/test/test_user_wallpaper_delegate.h"
22 #include "ash/wm/window_state.h"
23 #include "ash/wm/window_util.h"
24 #include "base/logging.h"
25 #include "content/public/test/test_browser_context.h"
26 #include "ui/app_list/app_list_model.h"
27 #include "ui/app_list/app_list_view_delegate.h"
28 #include "ui/app_list/test/app_list_test_view_delegate.h"
29 #include "ui/aura/window.h"
35 class NewWindowDelegateImpl
: public NewWindowDelegate
{
36 virtual void NewTab() OVERRIDE
{}
37 virtual void NewWindow(bool incognito
) OVERRIDE
{}
38 virtual void OpenFileManager() OVERRIDE
{}
39 virtual void OpenCrosh() OVERRIDE
{}
40 virtual void RestoreTab() OVERRIDE
{}
41 virtual void ShowKeyboardOverlay() OVERRIDE
{}
42 virtual void ShowTaskManager() OVERRIDE
{}
43 virtual void OpenFeedbackPage() OVERRIDE
{}
46 class MediaDelegateImpl
: public MediaDelegate
{
48 virtual void HandleMediaNextTrack() OVERRIDE
{}
49 virtual void HandleMediaPlayPause() OVERRIDE
{}
50 virtual void HandleMediaPrevTrack() OVERRIDE
{}
55 TestShellDelegate::TestShellDelegate()
56 : num_exit_requests_(0),
57 multi_profiles_enabled_(false),
58 test_session_state_delegate_(NULL
) {
61 TestShellDelegate::~TestShellDelegate() {
64 bool TestShellDelegate::IsFirstRunAfterBoot() const {
68 bool TestShellDelegate::IsIncognitoAllowed() const {
72 bool TestShellDelegate::IsMultiProfilesEnabled() const {
73 return multi_profiles_enabled_
;
76 bool TestShellDelegate::IsRunningInForcedAppMode() const {
80 void TestShellDelegate::PreInit() {
83 void TestShellDelegate::Shutdown() {
86 void TestShellDelegate::Exit() {
90 keyboard::KeyboardControllerProxy
*
91 TestShellDelegate::CreateKeyboardControllerProxy() {
92 return new KeyboardControllerProxyStub();
95 content::BrowserContext
* TestShellDelegate::GetCurrentBrowserContext() {
96 current_browser_context_
.reset(new content::TestBrowserContext());
97 return current_browser_context_
.get();
100 app_list::AppListViewDelegate
* TestShellDelegate::CreateAppListViewDelegate() {
101 return new app_list::test::AppListTestViewDelegate
;
104 ShelfDelegate
* TestShellDelegate::CreateShelfDelegate(ShelfModel
* model
) {
105 return new TestShelfDelegate(model
);
108 SystemTrayDelegate
* TestShellDelegate::CreateSystemTrayDelegate() {
109 return new TestSystemTrayDelegate
;
112 UserWallpaperDelegate
* TestShellDelegate::CreateUserWallpaperDelegate() {
113 return new TestUserWallpaperDelegate();
116 CapsLockDelegate
* TestShellDelegate::CreateCapsLockDelegate() {
117 return new CapsLockDelegateStub
;
120 SessionStateDelegate
* TestShellDelegate::CreateSessionStateDelegate() {
121 DCHECK(!test_session_state_delegate_
);
122 test_session_state_delegate_
= new TestSessionStateDelegate();
123 return test_session_state_delegate_
;
126 AccessibilityDelegate
* TestShellDelegate::CreateAccessibilityDelegate() {
127 return new internal::DefaultAccessibilityDelegate();
130 NewWindowDelegate
* TestShellDelegate::CreateNewWindowDelegate() {
131 return new NewWindowDelegateImpl
;
134 MediaDelegate
* TestShellDelegate::CreateMediaDelegate() {
135 return new MediaDelegateImpl
;
138 aura::client::UserActionClient
* TestShellDelegate::CreateUserActionClient() {
142 void TestShellDelegate::RecordUserMetricsAction(UserMetricsAction action
) {
145 ui::MenuModel
* TestShellDelegate::CreateContextMenu(aura::Window
* root
) {
149 RootWindowHostFactory
* TestShellDelegate::CreateRootWindowHostFactory() {
150 return RootWindowHostFactory::Create();
153 base::string16
TestShellDelegate::GetProductName() const {
154 return base::string16();
157 TestSessionStateDelegate
* TestShellDelegate::test_session_state_delegate() {
158 return test_session_state_delegate_
;