Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [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 | #ifndef CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_ |
| 6 | #define CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_ |
| 7 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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" |
| 17 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 18 | class Browser; |
| 19 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 20 | namespace ash { |
| 21 | class WindowPositioner; |
| 22 | } |
| 23 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 24 | namespace content { |
| 25 | class WebContents; |
| 26 | } |
| 27 | |
| 28 | namespace keyboard { |
| 29 | class KeyboardControllerProxy; |
| 30 | } |
| 31 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 32 | class ChromeLauncherController; |
| 33 | |
| 34 | class ChromeShellDelegate : public ash::ShellDelegate, |
| 35 | public content::NotificationObserver { |
| 36 | public: |
| 37 | ChromeShellDelegate(); |
| 38 | virtual ~ChromeShellDelegate(); |
| 39 | |
| 40 | static ChromeShellDelegate* instance() { return instance_; } |
| 41 | |
| 42 | ash::WindowPositioner* window_positioner() { |
| 43 | return window_positioner_.get(); |
| 44 | } |
| 45 | |
| 46 | // ash::ShellDelegate overrides; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 47 | virtual bool IsFirstRunAfterBoot() const OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 48 | virtual bool IsMultiProfilesEnabled() const OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 49 | virtual bool IsRunningInForcedAppMode() const OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 50 | virtual void PreInit() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 51 | virtual void Shutdown() OVERRIDE; |
| 52 | virtual void Exit() OVERRIDE; |
| 53 | virtual void NewTab() OVERRIDE; |
| 54 | virtual void NewWindow(bool is_incognito) OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 55 | virtual void ToggleFullscreen() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 56 | virtual void ToggleMaximized() OVERRIDE; |
| 57 | virtual void OpenFileManager(bool as_dialog) OVERRIDE; |
| 58 | virtual void OpenCrosh() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 59 | virtual void RestoreTab() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 60 | virtual void ShowKeyboardOverlay() OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 61 | virtual keyboard::KeyboardControllerProxy* |
| 62 | CreateKeyboardControllerProxy() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 63 | virtual void ShowTaskManager() OVERRIDE; |
| 64 | virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 65 | virtual void ToggleHighContrast() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 66 | virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 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; |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 74 | virtual void SetLargeCursorEnabled(bool enabled) OVERRIDE; |
| 75 | virtual bool IsLargeCursorEnabled() const OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 76 | virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 77 | virtual void SilenceSpokenFeedback() const OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 84 | virtual ash::SessionStateDelegate* CreateSessionStateDelegate() OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 91 | virtual void SaveScreenMagnifierScale(double scale) OVERRIDE; |
| 92 | virtual double GetSavedScreenMagnifierScale() OVERRIDE; |
| 93 | virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 94 | virtual ash::RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; |
| 95 | virtual string16 GetProductName() const OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 96 | |
| 97 | // content::NotificationObserver override: |
| 98 | virtual void Observe(int type, |
| 99 | const content::NotificationSource& source, |
| 100 | const content::NotificationDetails& details) OVERRIDE; |
| 101 | |
| 102 | private: |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 103 | class TabRestoreHelper; |
| 104 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 105 | void PlatformInit(); |
| 106 | |
| 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(); |
| 110 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 111 | static ChromeShellDelegate* instance_; |
| 112 | |
| 113 | content::NotificationRegistrar registrar_; |
| 114 | |
| 115 | scoped_ptr<ash::WindowPositioner> window_positioner_; |
| 116 | |
| 117 | base::WeakPtrFactory<ChromeShellDelegate> weak_factory_; |
| 118 | |
| 119 | ChromeLauncherController* launcher_delegate_; |
| 120 | |
Torne (Richard Coles) | a93a17c | 2013-05-15 11:34:50 +0100 | [diff] [blame] | 121 | scoped_ptr<TabRestoreHelper> tab_restore_helper_; |
| 122 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 123 | DISALLOW_COPY_AND_ASSIGN(ChromeShellDelegate); |
| 124 | }; |
| 125 | |
| 126 | #endif // CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_ |