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

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

Issue 2089183003: mus: Introduce API for embedder to dispatch event to the embeded client. Base URL: https://chromium.googlesource.com/chromium/src.git@mus-parent-window-receives-child-event
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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Windows are owned by the WindowTreeClient. See WindowTreeClientDelegate for 44 // Windows are owned by the WindowTreeClient. See WindowTreeClientDelegate for
45 // details on ownership. 45 // details on ownership.
46 // 46 //
47 // TODO(beng): Right now, you'll have to implement a WindowObserver to track 47 // TODO(beng): Right now, you'll have to implement a WindowObserver to track
48 // destruction and NULL any pointers you have. 48 // destruction and NULL any pointers you have.
49 // Investigate some kind of smart pointer or weak pointer for these. 49 // Investigate some kind of smart pointer or weak pointer for these.
50 class Window { 50 class Window {
51 public: 51 public:
52 using Children = std::vector<Window*>; 52 using Children = std::vector<Window*>;
53 using EmbedCallback = base::Callback<void(bool)>; 53 using EmbedCallback = base::Callback<void(bool, mojom::InputEventHandlerPtr)>;
54 using PropertyDeallocator = void (*)(int64_t value); 54 using PropertyDeallocator = void (*)(int64_t value);
55 using SharedProperties = std::map<std::string, std::vector<uint8_t>>; 55 using SharedProperties = std::map<std::string, std::vector<uint8_t>>;
56 56
57 // Destroys this window and all its children. Destruction is allowed for 57 // Destroys this window and all its children. Destruction is allowed for
58 // windows that were created by this connection, or the roots. For windows 58 // windows that were created by this connection, or the roots. For windows
59 // from other connections (except the roots), Destroy() does nothing. If the 59 // from other connections (except the roots), Destroy() does nothing. If the
60 // destruction is allowed observers are notified and the Window is 60 // destruction is allowed observers are notified and the Window is
61 // immediately deleted. 61 // immediately deleted.
62 void Destroy(); 62 void Destroy();
63 63
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool HasFocus() const; 209 bool HasFocus() const;
210 void SetCanFocus(bool can_focus); 210 void SetCanFocus(bool can_focus);
211 211
212 // Embedding. See window_tree.mojom for details. 212 // Embedding. See window_tree.mojom for details.
213 void Embed(mus::mojom::WindowTreeClientPtr client, uint32_t flags = 0); 213 void Embed(mus::mojom::WindowTreeClientPtr client, uint32_t flags = 0);
214 214
215 // NOTE: callback is run synchronously if Embed() is not allowed on this 215 // NOTE: callback is run synchronously if Embed() is not allowed on this
216 // Window. 216 // Window.
217 void Embed(mus::mojom::WindowTreeClientPtr client, 217 void Embed(mus::mojom::WindowTreeClientPtr client,
218 const EmbedCallback& callback, 218 const EmbedCallback& callback,
219 uint32_t flags = 0); 219 uint32_t flags);
220 220
221 // TODO(sky): this API is only applicable to the WindowManager. Move it 221 // TODO(sky): this API is only applicable to the WindowManager. Move it
222 // to a better place. 222 // to a better place.
223 void RequestClose(); 223 void RequestClose();
224 224
225 // Returns an internal name, set by a client app when it creates a window. 225 // Returns an internal name, set by a client app when it creates a window.
226 std::string GetName() const; 226 std::string GetName() const;
227 227
228 // Used to identify this Window on the server. Clients can not change this
229 // value.
230 Id server_id() const { return server_id_; }
231
228 protected: 232 protected:
229 // This class is subclassed only by test classes that provide a public ctor. 233 // This class is subclassed only by test classes that provide a public ctor.
230 Window(); 234 Window();
231 ~Window(); 235 ~Window();
232 236
233 private: 237 private:
234 friend class WindowPrivate; 238 friend class WindowPrivate;
235 friend class WindowTreeClient; 239 friend class WindowTreeClient;
236 friend class WindowTreeClientPrivate; 240 friend class WindowTreeClientPrivate;
237 241
238 Window(WindowTreeClient* client, Id id); 242 Window(WindowTreeClient* client, Id id);
239 243
240 // Used to identify this Window on the server. Clients can not change this
241 // value.
242 Id server_id() const { return server_id_; }
243
244 // Applies a shared property change locally and forwards to the server. If 244 // Applies a shared property change locally and forwards to the server. If
245 // |data| is null, this property is deleted. 245 // |data| is null, this property is deleted.
246 void SetSharedPropertyInternal(const std::string& name, 246 void SetSharedPropertyInternal(const std::string& name,
247 const std::vector<uint8_t>* data); 247 const std::vector<uint8_t>* data);
248 // Called by the public {Set,Get,Clear}Property functions. 248 // Called by the public {Set,Get,Clear}Property functions.
249 int64_t SetLocalPropertyInternal(const void* key, 249 int64_t SetLocalPropertyInternal(const void* key,
250 const char* name, 250 const char* name,
251 PropertyDeallocator deallocator, 251 PropertyDeallocator deallocator,
252 int64_t value, 252 int64_t value,
253 int64_t default_value); 253 int64_t default_value);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 }; 347 };
348 348
349 std::map<const void*, Value> prop_map_; 349 std::map<const void*, Value> prop_map_;
350 350
351 DISALLOW_COPY_AND_ASSIGN(Window); 351 DISALLOW_COPY_AND_ASSIGN(Window);
352 }; 352 };
353 353
354 } // namespace mus 354 } // namespace mus
355 355
356 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ 356 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/window_tree_client.cc ('k') | components/mus/public/cpp/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698