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 #ifndef CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_
6 #define CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_
10 #include "ash/launcher/launcher_types.h"
11 #include "ash/shell_delegate.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h"
21 class WindowPositioner
;
29 class KeyboardControllerProxy
;
32 class ChromeLauncherController
;
34 class ChromeShellDelegate
: public ash::ShellDelegate
,
35 public content::NotificationObserver
{
37 ChromeShellDelegate();
38 virtual ~ChromeShellDelegate();
40 static ChromeShellDelegate
* instance() { return instance_
; }
42 ash::WindowPositioner
* window_positioner() {
43 return window_positioner_
.get();
46 // ash::ShellDelegate overrides;
47 virtual bool IsFirstRunAfterBoot() const OVERRIDE
;
48 virtual bool IsMultiProfilesEnabled() const OVERRIDE
;
49 virtual bool IsRunningInForcedAppMode() const OVERRIDE
;
50 virtual void PreInit() OVERRIDE
;
51 virtual void Shutdown() OVERRIDE
;
52 virtual void Exit() OVERRIDE
;
53 virtual void NewTab() OVERRIDE
;
54 virtual void NewWindow(bool is_incognito
) OVERRIDE
;
55 virtual void ToggleFullscreen() OVERRIDE
;
56 virtual void ToggleMaximized() OVERRIDE
;
57 virtual void OpenFileManager(bool as_dialog
) OVERRIDE
;
58 virtual void OpenCrosh() OVERRIDE
;
59 virtual void RestoreTab() OVERRIDE
;
60 virtual void ShowKeyboardOverlay() OVERRIDE
;
61 virtual keyboard::KeyboardControllerProxy
*
62 CreateKeyboardControllerProxy() OVERRIDE
;
63 virtual void ShowTaskManager() OVERRIDE
;
64 virtual content::BrowserContext
* GetCurrentBrowserContext() OVERRIDE
;
65 virtual void ToggleHighContrast() OVERRIDE
;
66 virtual bool IsSpokenFeedbackEnabled() const OVERRIDE
;
67 virtual void ToggleSpokenFeedback(
68 ash::AccessibilityNotificationVisibility notify
) OVERRIDE
;
69 virtual bool IsHighContrastEnabled() const OVERRIDE
;
70 virtual void SetMagnifierEnabled(bool enabled
) OVERRIDE
;
71 virtual void SetMagnifierType(ash::MagnifierType type
) OVERRIDE
;
72 virtual bool IsMagnifierEnabled() const OVERRIDE
;
73 virtual ash::MagnifierType
GetMagnifierType() const OVERRIDE
;
74 virtual void SetLargeCursorEnabled(bool enabled
) OVERRIDE
;
75 virtual bool IsLargeCursorEnabled() const OVERRIDE
;
76 virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE
;
77 virtual void SilenceSpokenFeedback() const OVERRIDE
;
78 virtual app_list::AppListViewDelegate
* CreateAppListViewDelegate() OVERRIDE
;
79 virtual ash::LauncherDelegate
* CreateLauncherDelegate(
80 ash::LauncherModel
* model
) OVERRIDE
;
81 virtual ash::SystemTrayDelegate
* CreateSystemTrayDelegate() OVERRIDE
;
82 virtual ash::UserWallpaperDelegate
* CreateUserWallpaperDelegate() OVERRIDE
;
83 virtual ash::CapsLockDelegate
* CreateCapsLockDelegate() OVERRIDE
;
84 virtual ash::SessionStateDelegate
* CreateSessionStateDelegate() OVERRIDE
;
85 virtual aura::client::UserActionClient
* CreateUserActionClient() OVERRIDE
;
86 virtual void OpenFeedbackPage() OVERRIDE
;
87 virtual void RecordUserMetricsAction(ash::UserMetricsAction action
) OVERRIDE
;
88 virtual void HandleMediaNextTrack() OVERRIDE
;
89 virtual void HandleMediaPlayPause() OVERRIDE
;
90 virtual void HandleMediaPrevTrack() OVERRIDE
;
91 virtual void SaveScreenMagnifierScale(double scale
) OVERRIDE
;
92 virtual double GetSavedScreenMagnifierScale() OVERRIDE
;
93 virtual ui::MenuModel
* CreateContextMenu(aura::RootWindow
* root
) OVERRIDE
;
94 virtual ash::RootWindowHostFactory
* CreateRootWindowHostFactory() OVERRIDE
;
95 virtual string16
GetProductName() const OVERRIDE
;
97 // content::NotificationObserver override:
98 virtual void Observe(int type
,
99 const content::NotificationSource
& source
,
100 const content::NotificationDetails
& details
) OVERRIDE
;
103 class TabRestoreHelper
;
107 // Returns the browser for active ash window if any. Otherwise it searches
108 // for a browser or create one for default profile and returns it.
109 Browser
* GetTargetBrowser();
111 static ChromeShellDelegate
* instance_
;
113 content::NotificationRegistrar registrar_
;
115 scoped_ptr
<ash::WindowPositioner
> window_positioner_
;
117 base::WeakPtrFactory
<ChromeShellDelegate
> weak_factory_
;
119 ChromeLauncherController
* launcher_delegate_
;
121 scoped_ptr
<TabRestoreHelper
> tab_restore_helper_
;
123 DISALLOW_COPY_AND_ASSIGN(ChromeShellDelegate
);
126 #endif // CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_