• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
8 #include <string>
9 
10 #include "ash/shelf/shelf_item_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 "base/observer_list.h"
16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h"
18 
19 class Browser;
20 
21 namespace ash {
22 class ShelfItemDelegate;
23 }
24 
25 namespace content {
26 class WebContents;
27 }
28 
29 namespace keyboard {
30 class KeyboardControllerProxy;
31 }
32 
33 #if defined(OS_CHROMEOS)
34 namespace chromeos {
35 class DisplayConfigurationObserver;
36 }
37 #endif
38 
39 class ChromeLauncherController;
40 
41 class ChromeShellDelegate : public ash::ShellDelegate,
42                             public content::NotificationObserver {
43  public:
44   ChromeShellDelegate();
45   virtual ~ChromeShellDelegate();
46 
instance()47   static ChromeShellDelegate* instance() { return instance_; }
48 
49   // ash::ShellDelegate overrides;
50   virtual bool IsFirstRunAfterBoot() const OVERRIDE;
51   virtual bool IsMultiProfilesEnabled() const OVERRIDE;
52   virtual bool IsIncognitoAllowed() const OVERRIDE;
53   virtual bool IsRunningInForcedAppMode() const OVERRIDE;
54   virtual bool IsMultiAccountEnabled() const OVERRIDE;
55   virtual void PreInit() OVERRIDE;
56   virtual void PreShutdown() OVERRIDE;
57   virtual void Exit() OVERRIDE;
58   virtual keyboard::KeyboardControllerProxy*
59       CreateKeyboardControllerProxy() OVERRIDE;
60   virtual void VirtualKeyboardActivated(bool activated) OVERRIDE;
61   virtual void AddVirtualKeyboardStateObserver(
62       ash::VirtualKeyboardStateObserver* observer) OVERRIDE;
63   virtual void RemoveVirtualKeyboardStateObserver(
64       ash::VirtualKeyboardStateObserver* observer) OVERRIDE;
65   virtual content::BrowserContext* GetActiveBrowserContext() OVERRIDE;
66   virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE;
67   virtual ash::ShelfDelegate* CreateShelfDelegate(
68       ash::ShelfModel* model) OVERRIDE;
69   virtual ash::SystemTrayDelegate* CreateSystemTrayDelegate() OVERRIDE;
70   virtual ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() OVERRIDE;
71   virtual ash::SessionStateDelegate* CreateSessionStateDelegate() OVERRIDE;
72   virtual ash::AccessibilityDelegate* CreateAccessibilityDelegate() OVERRIDE;
73   virtual ash::NewWindowDelegate* CreateNewWindowDelegate() OVERRIDE;
74   virtual ash::MediaDelegate* CreateMediaDelegate() OVERRIDE;
75   virtual ui::MenuModel* CreateContextMenu(
76       aura::Window* root,
77       ash::ShelfItemDelegate* item_delegate,
78       ash::ShelfItem* item) OVERRIDE;
79   virtual ash::GPUSupport* CreateGPUSupport() OVERRIDE;
80   virtual base::string16 GetProductName() const OVERRIDE;
81 
82   // content::NotificationObserver override:
83   virtual void Observe(int type,
84                        const content::NotificationSource& source,
85                        const content::NotificationDetails& details) OVERRIDE;
86 
87  private:
88   void PlatformInit();
89 
90   static ChromeShellDelegate* instance_;
91 
92   content::NotificationRegistrar registrar_;
93 
94   ChromeLauncherController* shelf_delegate_;
95 
96   ObserverList<ash::VirtualKeyboardStateObserver> keyboard_state_observer_list_;
97 
98 #if defined(OS_CHROMEOS)
99   scoped_ptr<chromeos::DisplayConfigurationObserver>
100       display_configuration_observer_;
101 #endif
102 
103   DISALLOW_COPY_AND_ASSIGN(ChromeShellDelegate);
104 };
105 
106 #endif  // CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_
107