Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / shell / browser / shell_desktop_controller.h
bloba0d5b6ab9277db55c3cb742f22484754c9c68d87
1 // Copyright 2014 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 EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "extensions/shell/browser/desktop_controller.h"
12 #include "ui/aura/client/window_tree_client.h"
13 #include "ui/aura/window_tree_host_observer.h"
15 #if defined(OS_CHROMEOS)
16 #include "chromeos/dbus/power_manager_client.h"
17 #include "ui/display/chromeos/display_configurator.h"
18 #endif
20 namespace aura {
21 class TestScreen;
22 class Window;
23 class WindowTreeHost;
24 namespace client {
25 class DefaultCaptureClient;
26 class FocusClient;
30 namespace content {
31 class BrowserContext;
34 namespace gfx {
35 class Size;
38 #if defined(OS_CHROMEOS)
39 namespace ui {
40 class UserActivityPowerManagerNotifier;
42 #endif
44 namespace wm {
45 class CompoundEventFilter;
46 class CursorManager;
47 class InputMethodEventFilter;
48 class UserActivityDetector;
51 namespace extensions {
53 class Extension;
54 class ShellAppWindow;
55 class ShellAppWindowController;
57 // Handles desktop-related tasks for app_shell.
58 class ShellDesktopController : public DesktopController,
59 public aura::client::WindowTreeClient,
60 #if defined(OS_CHROMEOS)
61 public chromeos::PowerManagerClient::Observer,
62 public ui::DisplayConfigurator::Observer,
63 #endif
64 public aura::WindowTreeHostObserver {
65 public:
66 ShellDesktopController();
67 virtual ~ShellDesktopController();
69 // DesktopController:
70 virtual aura::WindowTreeHost* GetHost() OVERRIDE;
71 virtual ShellAppWindow* CreateAppWindow(content::BrowserContext* context,
72 const Extension* extension) OVERRIDE;
73 virtual void CloseAppWindows() OVERRIDE;
75 // aura::client::WindowTreeClient overrides:
76 virtual aura::Window* GetDefaultParent(aura::Window* context,
77 aura::Window* window,
78 const gfx::Rect& bounds) OVERRIDE;
80 #if defined(OS_CHROMEOS)
81 // chromeos::PowerManagerClient::Observer overrides:
82 virtual void PowerButtonEventReceived(bool down,
83 const base::TimeTicks& timestamp)
84 OVERRIDE;
86 // ui::DisplayConfigurator::Observer overrides.
87 virtual void OnDisplayModeChanged(const std::vector<
88 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE;
89 #endif
91 // aura::WindowTreeHostObserver overrides:
92 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE;
94 protected:
95 // Creates and sets the aura clients and window manager stuff. Subclass may
96 // initialize different sets of the clients.
97 virtual void InitWindowManager();
99 private:
100 // Creates the window that hosts the app.
101 void CreateRootWindow();
103 // Closes and destroys the root window hosting the app.
104 void DestroyRootWindow();
106 // Returns the dimensions (in pixels) of the primary display, or an empty size
107 // if the dimensions can't be determined or no display is connected.
108 gfx::Size GetPrimaryDisplaySize();
110 #if defined(OS_CHROMEOS)
111 scoped_ptr<ui::DisplayConfigurator> display_configurator_;
112 #endif
114 scoped_ptr<aura::TestScreen> test_screen_;
116 scoped_ptr<aura::WindowTreeHost> host_;
118 scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
120 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
122 scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
124 scoped_ptr<aura::client::FocusClient> focus_client_;
126 scoped_ptr<wm::CursorManager> cursor_manager_;
128 scoped_ptr<wm::UserActivityDetector> user_activity_detector_;
129 #if defined(OS_CHROMEOS)
130 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
131 #endif
133 // The desktop supports a single app window.
134 scoped_ptr<ShellAppWindow> app_window_;
136 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController);
139 } // namespace extensions
141 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_