blob: 74595250bf2c433431802c936fb993348673d07c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_
#define EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "extensions/shell/browser/desktop_controller.h"
#include "ui/aura/client/window_tree_client.h"
#include "ui/aura/window_tree_host_observer.h"
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/power_manager_client.h"
#include "ui/display/chromeos/display_configurator.h"
#endif
namespace aura {
class Window;
class WindowTreeHost;
namespace client {
class DefaultCaptureClient;
class FocusClient;
}
}
namespace content {
class BrowserContext;
}
namespace gfx {
class Size;
}
namespace ui {
class UserActivityDetector;
#if defined(OS_CHROMEOS)
class UserActivityPowerManagerNotifier;
#endif
}
namespace wm {
class CompoundEventFilter;
class CursorManager;
}
namespace extensions {
class AppWindowClient;
class Extension;
class ShellScreen;
// Handles desktop-related tasks for app_shell.
class ShellDesktopControllerAura
: public DesktopController,
public aura::client::WindowTreeClient,
#if defined(OS_CHROMEOS)
public chromeos::PowerManagerClient::Observer,
public ui::DisplayConfigurator::Observer,
#endif
public aura::WindowTreeHostObserver {
public:
ShellDesktopControllerAura();
~ShellDesktopControllerAura() override;
// DesktopController:
gfx::Size GetWindowSize() override;
AppWindow* CreateAppWindow(content::BrowserContext* context,
const Extension* extension) override;
void AddAppWindow(gfx::NativeWindow window) override;
void RemoveAppWindow(AppWindow* window) override;
void CloseAppWindows() override;
// aura::client::WindowTreeClient overrides:
aura::Window* GetDefaultParent(aura::Window* context,
aura::Window* window,
const gfx::Rect& bounds) override;
#if defined(OS_CHROMEOS)
// chromeos::PowerManagerClient::Observer overrides:
void PowerButtonEventReceived(bool down,
const base::TimeTicks& timestamp) override;
// ui::DisplayConfigurator::Observer overrides.
void OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& displays) override;
#endif
// aura::WindowTreeHostObserver overrides:
void OnHostCloseRequested(const aura::WindowTreeHost* host) override;
protected:
// Creates and sets the aura clients and window manager stuff. Subclass may
// initialize different sets of the clients.
virtual void InitWindowManager();
private:
// Creates the window that hosts the app.
void CreateRootWindow();
// Closes and destroys the root window hosting the app.
void DestroyRootWindow();
// Returns the dimensions (in pixels) of the primary display, or an empty size
// if the dimensions can't be determined or no display is connected.
gfx::Size GetPrimaryDisplaySize();
#if defined(OS_CHROMEOS)
scoped_ptr<ui::DisplayConfigurator> display_configurator_;
#endif
scoped_ptr<ShellScreen> screen_;
scoped_ptr<aura::WindowTreeHost> host_;
scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
scoped_ptr<aura::client::FocusClient> focus_client_;
scoped_ptr<wm::CursorManager> cursor_manager_;
scoped_ptr<ui::UserActivityDetector> user_activity_detector_;
#if defined(OS_CHROMEOS)
scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
#endif
scoped_ptr<AppWindowClient> app_window_client_;
// NativeAppWindow::Close() deletes the AppWindow.
std::vector<AppWindow*> app_windows_;
DISALLOW_COPY_AND_ASSIGN(ShellDesktopControllerAura);
};
} // namespace extensions
#endif // EXTENSIONS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_AURA_H_
|