Remove app_shell chrome.shell API and ShellAppWindow
[chromium-blink-merge.git] / extensions / shell / browser / shell_desktop_controller.h
blob6e0d1c502cde63a603012849ee63841a3a862ced
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;
55 // Handles desktop-related tasks for app_shell.
56 class ShellDesktopController : public DesktopController,
57 public aura::client::WindowTreeClient,
58 #if defined(OS_CHROMEOS)
59 public chromeos::PowerManagerClient::Observer,
60 public ui::DisplayConfigurator::Observer,
61 #endif
62 public aura::WindowTreeHostObserver {
63 public:
64 ShellDesktopController();
65 virtual ~ShellDesktopController();
67 // DesktopController:
68 virtual aura::WindowTreeHost* GetHost() OVERRIDE;
69 virtual AppWindow* CreateAppWindow(content::BrowserContext* context,
70 const Extension* extension) OVERRIDE;
71 virtual void AddAppWindow(aura::Window* window) OVERRIDE;
72 virtual void CloseAppWindows() OVERRIDE;
74 // aura::client::WindowTreeClient overrides:
75 virtual aura::Window* GetDefaultParent(aura::Window* context,
76 aura::Window* window,
77 const gfx::Rect& bounds) OVERRIDE;
79 #if defined(OS_CHROMEOS)
80 // chromeos::PowerManagerClient::Observer overrides:
81 virtual void PowerButtonEventReceived(bool down,
82 const base::TimeTicks& timestamp)
83 OVERRIDE;
85 // ui::DisplayConfigurator::Observer overrides.
86 virtual void OnDisplayModeChanged(const std::vector<
87 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE;
88 #endif
90 // aura::WindowTreeHostObserver overrides:
91 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE;
93 protected:
94 // Creates and sets the aura clients and window manager stuff. Subclass may
95 // initialize different sets of the clients.
96 virtual void InitWindowManager();
98 private:
99 // Creates the window that hosts the app.
100 void CreateRootWindow();
102 // Closes and destroys the root window hosting the app.
103 void DestroyRootWindow();
105 // Returns the dimensions (in pixels) of the primary display, or an empty size
106 // if the dimensions can't be determined or no display is connected.
107 gfx::Size GetPrimaryDisplaySize();
109 #if defined(OS_CHROMEOS)
110 scoped_ptr<ui::DisplayConfigurator> display_configurator_;
111 #endif
113 scoped_ptr<aura::TestScreen> test_screen_;
115 scoped_ptr<aura::WindowTreeHost> host_;
117 scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
119 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
121 scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
123 scoped_ptr<aura::client::FocusClient> focus_client_;
125 scoped_ptr<wm::CursorManager> cursor_manager_;
127 scoped_ptr<wm::UserActivityDetector> user_activity_detector_;
128 #if defined(OS_CHROMEOS)
129 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
130 #endif
132 // The desktop supports a single app window.
133 AppWindow* app_window_; // NativeAppWindow::Close() deletes this.
135 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController);
138 } // namespace extensions
140 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_