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

Side by Side Diff: components/mus/public/cpp/window_tree_connection.h

Issue 2018823002: Eliminate WindowTreeConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@connection
Patch Set: . Created 4 years, 6 months 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 COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <string>
12 #include <vector>
13
14 #include "components/mus/common/types.h"
15 #include "components/mus/public/interfaces/input_event_constants.mojom.h"
16 #include "components/mus/public/interfaces/window_tree.mojom.h"
17 #include "mojo/public/cpp/bindings/interface_request.h"
18
19 namespace gfx {
20 class Point;
21 }
22
23 namespace shell {
24 class Connector;
25 }
26
27 namespace mus {
28
29 class Window;
30 class WindowManagerDelegate;
31 class WindowTreeConnectionObserver;
32 class WindowTreeDelegate;
33
34 // Encapsulates a connection to a window tree. A unique connection is made
35 // every time an app is embedded.
36 class WindowTreeConnection {
37 public:
38 enum class CreateType {
39 // Indicates Create() should wait for OnEmbed(). If true, the
40 // WindowTreeConnection returned from Create() will have its root, otherwise
41 // the WindowTreeConnection will get the root at a later time.
42 WAIT_FOR_EMBED,
43 DONT_WAIT_FOR_EMBED
44 };
45
46 virtual ~WindowTreeConnection() {}
47
48 // Creates a WindowTreeConnection with no roots. Use this to establish a
49 // connection directly to mus and create top level windows.
50 static WindowTreeConnection* Create(WindowTreeDelegate* delegate,
51 shell::Connector* connector);
52
53 // Creates a WindowTreeConnection to service the specified request for
54 // a WindowTreeClient. Use this to be embedded in another app.
55 static WindowTreeConnection* Create(
56 WindowTreeDelegate* delegate,
57 mojo::InterfaceRequest<mojom::WindowTreeClient> request,
58 CreateType create_type);
59
60 // Create a WindowTreeConnection that is going to serve as the WindowManager.
61 static WindowTreeConnection* CreateForWindowManager(
62 WindowTreeDelegate* delegate,
63 mojo::InterfaceRequest<mojom::WindowTreeClient> request,
64 CreateType create_type,
65 WindowManagerDelegate* window_manager_delegate);
66
67 // Sets whether this is deleted when there are no roots. The default is to
68 // delete when there are no roots.
69 virtual void SetDeleteOnNoRoots(bool value) = 0;
70
71 // Returns the root of this connection.
72 virtual const std::set<Window*>& GetRoots() = 0;
73
74 // Returns the Window with input capture; null if no window has requested
75 // input capture, or if another app has capture.
76 virtual Window* GetCaptureWindow() = 0;
77
78 // Returns the focused window; null if focus is not yet known or another app
79 // is focused.
80 virtual Window* GetFocusedWindow() = 0;
81
82 // Sets focus to null. This does nothing if focus is currently null.
83 virtual void ClearFocus() = 0;
84
85 // Returns the current location of the mouse on screen. Note: this method may
86 // race the asynchronous initialization; but in that case we return (0, 0).
87 virtual gfx::Point GetCursorScreenPoint() = 0;
88
89 // See description in window_tree.mojom. When an existing event observer is
90 // updated or cleared then any future events from the server for that observer
91 // will be ignored.
92 virtual void SetEventObserver(mojom::EventMatcherPtr matcher) = 0;
93
94 // Creates and returns a new Window (which is owned by the window server).
95 // Windows are initially hidden, use SetVisible(true) to show.
96 Window* NewWindow() { return NewWindow(nullptr); }
97 virtual Window* NewWindow(
98 const std::map<std::string, std::vector<uint8_t>>* properties) = 0;
99 virtual Window* NewTopLevelWindow(
100 const std::map<std::string, std::vector<uint8_t>>* properties) = 0;
101
102 virtual void AddObserver(WindowTreeConnectionObserver* observer) = 0;
103 virtual void RemoveObserver(WindowTreeConnectionObserver* observer) = 0;
104 };
105
106 } // namespace mus
107
108 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/window_tree_client_observer.h ('k') | components/mus/public/cpp/window_tree_connection_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698