Don't add extra app list launcher page webviews.
[chromium-blink-merge.git] / extensions / shell / browser / shell_desktop_controller_aura.h
blob9a8bc1ff4689cd2b6f56e1d46a7acea9d3b6e4ac
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_AURA_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "extensions/shell/browser/desktop_controller.h"
14 #include "ui/aura/client/window_tree_client.h"
15 #include "ui/aura/window_tree_host_observer.h"
17 #if defined(OS_CHROMEOS)
18 #include "chromeos/dbus/power_manager_client.h"
19 #include "ui/display/chromeos/display_configurator.h"
20 #endif
22 namespace aura {
23 class Window;
24 class WindowTreeHost;
25 namespace client {
26 class DefaultCaptureClient;
27 class FocusClient;
31 namespace content {
32 class BrowserContext;
35 namespace gfx {
36 class Size;
39 namespace ui {
40 class UserActivityDetector;
41 #if defined(OS_CHROMEOS)
42 class UserActivityPowerManagerNotifier;
43 #endif
46 namespace wm {
47 class CompoundEventFilter;
48 class CursorManager;
49 class InputMethodEventFilter;
52 namespace extensions {
53 class AppWindowClient;
54 class Extension;
55 class ShellScreen;
57 // Handles desktop-related tasks for app_shell.
58 class ShellDesktopControllerAura
59 : public DesktopController,
60 public aura::client::WindowTreeClient,
61 #if defined(OS_CHROMEOS)
62 public chromeos::PowerManagerClient::Observer,
63 public ui::DisplayConfigurator::Observer,
64 #endif
65 public aura::WindowTreeHostObserver {
66 public:
67 ShellDesktopControllerAura();
68 ~ShellDesktopControllerAura() override;
70 // DesktopController:
71 gfx::Size GetWindowSize() override;
72 AppWindow* CreateAppWindow(content::BrowserContext* context,
73 const Extension* extension) override;
74 void AddAppWindow(gfx::NativeWindow window) override;
75 void RemoveAppWindow(AppWindow* window) override;
76 void CloseAppWindows() override;
78 // aura::client::WindowTreeClient overrides:
79 aura::Window* GetDefaultParent(aura::Window* context,
80 aura::Window* window,
81 const gfx::Rect& bounds) override;
83 #if defined(OS_CHROMEOS)
84 // chromeos::PowerManagerClient::Observer overrides:
85 void PowerButtonEventReceived(bool down,
86 const base::TimeTicks& timestamp) override;
88 // ui::DisplayConfigurator::Observer overrides.
89 void OnDisplayModeChanged(
90 const ui::DisplayConfigurator::DisplayStateList& displays) override;
91 #endif
93 // aura::WindowTreeHostObserver overrides:
94 void OnHostCloseRequested(const aura::WindowTreeHost* host) override;
96 protected:
97 // Creates and sets the aura clients and window manager stuff. Subclass may
98 // initialize different sets of the clients.
99 virtual void InitWindowManager();
101 private:
102 // Creates the window that hosts the app.
103 void CreateRootWindow();
105 // Closes and destroys the root window hosting the app.
106 void DestroyRootWindow();
108 // Returns the dimensions (in pixels) of the primary display, or an empty size
109 // if the dimensions can't be determined or no display is connected.
110 gfx::Size GetPrimaryDisplaySize();
112 #if defined(OS_CHROMEOS)
113 scoped_ptr<ui::DisplayConfigurator> display_configurator_;
114 #endif
116 scoped_ptr<ShellScreen> screen_;
118 scoped_ptr<aura::WindowTreeHost> host_;
120 scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
122 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
124 scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
126 scoped_ptr<aura::client::FocusClient> focus_client_;
128 scoped_ptr<wm::CursorManager> cursor_manager_;
130 scoped_ptr<ui::UserActivityDetector> user_activity_detector_;
131 #if defined(OS_CHROMEOS)
132 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
133 #endif
135 scoped_ptr<AppWindowClient> app_window_client_;
137 // NativeAppWindow::Close() deletes the AppWindow.
138 std::vector<AppWindow*> app_windows_;
140 DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura);
143 } // namespace extensions
145 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_