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

Side by Side Diff: services/view_manager/server_view.h

Issue 1082943002: Adds a ServerViewObserver interface (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cleanup Created 5 years, 8 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 SERVICES_VIEW_MANAGER_SERVER_VIEW_H_ 5 #ifndef SERVICES_VIEW_MANAGER_SERVER_VIEW_H_
6 #define SERVICES_VIEW_MANAGER_SERVER_VIEW_H_ 6 #define SERVICES_VIEW_MANAGER_SERVER_VIEW_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/observer_list.h"
11 #include "cc/surfaces/surface_id.h" 12 #include "cc/surfaces/surface_id.h"
12 #include "mojo/services/view_manager/public/interfaces/view_manager.mojom.h" 13 #include "mojo/services/view_manager/public/interfaces/view_manager.mojom.h"
13 #include "services/view_manager/ids.h" 14 #include "services/view_manager/ids.h"
14 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/transform.h" 16 #include "ui/gfx/transform.h"
16 17
17 namespace view_manager { 18 namespace view_manager {
18 19
19 class ServerViewDelegate; 20 class ServerViewDelegate;
21 class ServerViewObserver;
20 22
21 // Server side representation of a view. Delegate is informed of interesting 23 // Server side representation of a view. Delegate is informed of interesting
22 // events. 24 // events.
23 // 25 //
24 // It is assumed that all functions that mutate the tree have validated the 26 // It is assumed that all functions that mutate the tree have validated the
25 // mutation is possible before hand. For example, Reorder() assumes the supplied 27 // mutation is possible before hand. For example, Reorder() assumes the supplied
26 // view is a child and not already in position. 28 // view is a child and not already in position.
27 class ServerView { 29 class ServerView {
28 public: 30 public:
29 ServerView(ServerViewDelegate* delegate, const ViewId& id); 31 ServerView(ServerViewDelegate* delegate, const ViewId& id);
30 virtual ~ServerView(); 32 virtual ~ServerView();
31 33
34 void AddObserver(ServerViewObserver* observer);
35 void RemoveObserver(ServerViewObserver* observer);
36
32 const ViewId& id() const { return id_; } 37 const ViewId& id() const { return id_; }
33 38
34 void Add(ServerView* child); 39 void Add(ServerView* child);
35 void Remove(ServerView* child); 40 void Remove(ServerView* child);
36 void Reorder(ServerView* child, 41 void Reorder(ServerView* child,
37 ServerView* relative, 42 ServerView* relative,
38 mojo::OrderDirection direction); 43 mojo::OrderDirection direction);
39 44
40 const gfx::Rect& bounds() const { return bounds_; } 45 const gfx::Rect& bounds() const { return bounds_; }
41 void SetBounds(const gfx::Rect& bounds); 46 void SetBounds(const gfx::Rect& bounds);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 ServerView* parent_; 99 ServerView* parent_;
95 Views children_; 100 Views children_;
96 bool visible_; 101 bool visible_;
97 gfx::Rect bounds_; 102 gfx::Rect bounds_;
98 cc::SurfaceId surface_id_; 103 cc::SurfaceId surface_id_;
99 float opacity_; 104 float opacity_;
100 gfx::Transform transform_; 105 gfx::Transform transform_;
101 106
102 std::map<std::string, std::vector<uint8_t>> properties_; 107 std::map<std::string, std::vector<uint8_t>> properties_;
103 108
109 ObserverList<ServerViewObserver> observers_;
110
104 DISALLOW_COPY_AND_ASSIGN(ServerView); 111 DISALLOW_COPY_AND_ASSIGN(ServerView);
105 }; 112 };
106 113
107 } // namespace view_manager 114 } // namespace view_manager
108 115
109 #endif // SERVICES_VIEW_MANAGER_SERVER_VIEW_H_ 116 #endif // SERVICES_VIEW_MANAGER_SERVER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698