Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: extensions/shell/browser/shell_desktop_controller.h

Issue 696063008: Refactor ShellDesktopController and ShellNativeAppWindow to allow for non-aura implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
7
8 #include <vector>
9
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"
16
17 #if defined(OS_CHROMEOS)
18 #include "chromeos/dbus/power_manager_client.h"
19 #include "ui/display/chromeos/display_configurator.h"
20 #endif
21
22 namespace aura {
23 class TestScreen;
24 class Window;
25 class WindowTreeHost;
26 namespace client {
27 class DefaultCaptureClient;
28 class FocusClient;
29 }
30 }
31
32 namespace content {
33 class BrowserContext;
34 }
35
36 namespace gfx {
37 class Size;
38 }
39
40 #if defined(OS_CHROMEOS)
41 namespace ui {
42 class UserActivityPowerManagerNotifier;
43 }
44 #endif
45
46 namespace wm {
47 class CompoundEventFilter;
48 class CursorManager;
49 class InputMethodEventFilter;
50 class UserActivityDetector;
51 }
52
53 namespace extensions {
54 class AppWindowClient;
55 class Extension;
56
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 ~ShellDesktopController() override;
68
69 // DesktopController:
70 aura::WindowTreeHost* GetHost() override;
71 AppWindow* CreateAppWindow(content::BrowserContext* context,
72 const Extension* extension) override;
73 void AddAppWindow(aura::Window* window) override;
74 void RemoveAppWindow(AppWindow* window) override;
75 void CloseAppWindows() override;
76
77 // aura::client::WindowTreeClient overrides:
78 aura::Window* GetDefaultParent(aura::Window* context,
79 aura::Window* window,
80 const gfx::Rect& bounds) override;
81
82 #if defined(OS_CHROMEOS)
83 // chromeos::PowerManagerClient::Observer overrides:
84 virtual void PowerButtonEventReceived(bool down,
85 const base::TimeTicks& timestamp)
86 override;
87
88 // ui::DisplayConfigurator::Observer overrides.
89 virtual void OnDisplayModeChanged(const std::vector<
90 ui::DisplayConfigurator::DisplayState>& displays) override;
91 #endif
92
93 // aura::WindowTreeHostObserver overrides:
94 void OnHostCloseRequested(const aura::WindowTreeHost* host) override;
95
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();
100
101 private:
102 // Creates the window that hosts the app.
103 void CreateRootWindow();
104
105 // Closes and destroys the root window hosting the app.
106 void DestroyRootWindow();
107
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();
111
112 #if defined(OS_CHROMEOS)
113 scoped_ptr<ui::DisplayConfigurator> display_configurator_;
114 #endif
115
116 scoped_ptr<aura::TestScreen> test_screen_;
117
118 scoped_ptr<aura::WindowTreeHost> host_;
119
120 scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
121
122 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
123
124 scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
125
126 scoped_ptr<aura::client::FocusClient> focus_client_;
127
128 scoped_ptr<wm::CursorManager> cursor_manager_;
129
130 scoped_ptr<wm::UserActivityDetector> user_activity_detector_;
131 #if defined(OS_CHROMEOS)
132 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
133 #endif
134
135 scoped_ptr<AppWindowClient> app_window_client_;
136
137 // NativeAppWindow::Close() deletes the AppWindow.
138 std::vector<AppWindow*> app_windows_;
139
140 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController);
141 };
142
143 } // namespace extensions
144
145 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698