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

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

Issue 513923004: More viewmanager renaming: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sim30 Created 6 years, 3 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 MOJO_SERVICES_VIEW_MANAGER_NODE_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_SERVER_VIEW_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_NODE_H_ 6 #define MOJO_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 "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" 11 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
12 #include "mojo/services/view_manager/ids.h" 12 #include "mojo/services/view_manager/ids.h"
13 #include "mojo/services/view_manager/view_manager_export.h" 13 #include "mojo/services/view_manager/view_manager_export.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 namespace service { 18 namespace service {
19 19
20 class NodeDelegate; 20 class ServerViewDelegate;
21 21
22 // Represents a node in the graph. Delegate is informed of interesting events. 22 // Server side representation of a view. Delegate is informed of interesting
23 // events.
23 // 24 //
24 // It is assumed that all functions that mutate the node tree have validated the 25 // It is assumed that all functions that mutate the tree have validated the
25 // value. For example, Reorder() assumes the supplied node is a child and not 26 // mutation is possible before hand. For example, Reorder() assumes the supplied
26 // already in position. 27 // view is a child and not already in position.
27 class MOJO_VIEW_MANAGER_EXPORT Node { 28 class MOJO_VIEW_MANAGER_EXPORT ServerView {
28 public: 29 public:
29 Node(NodeDelegate* delegate, const NodeId& id); 30 ServerView(ServerViewDelegate* delegate, const ViewId& id);
30 virtual ~Node(); 31 virtual ~ServerView();
31 32
32 const NodeId& id() const { return id_; } 33 const ViewId& id() const { return id_; }
33 34
34 void Add(Node* child); 35 void Add(ServerView* child);
35 void Remove(Node* child); 36 void Remove(ServerView* child);
36 void Reorder(Node* child, Node* relative, OrderDirection direction); 37 void Reorder(ServerView* child,
38 ServerView* relative,
39 OrderDirection direction);
37 40
38 const gfx::Rect& bounds() const { return bounds_; } 41 const gfx::Rect& bounds() const { return bounds_; }
39 void SetBounds(const gfx::Rect& bounds); 42 void SetBounds(const gfx::Rect& bounds);
40 43
41 const Node* parent() const { return parent_; } 44 const ServerView* parent() const { return parent_; }
42 Node* parent() { return parent_; } 45 ServerView* parent() { return parent_; }
43 46
44 const Node* GetRoot() const; 47 const ServerView* GetRoot() const;
45 Node* GetRoot() { 48 ServerView* GetRoot() {
46 return const_cast<Node*>(const_cast<const Node*>(this)->GetRoot()); 49 return const_cast<ServerView*>(
50 const_cast<const ServerView*>(this)->GetRoot());
47 } 51 }
48 52
49 std::vector<const Node*> GetChildren() const; 53 std::vector<const ServerView*> GetChildren() const;
50 std::vector<Node*> GetChildren(); 54 std::vector<ServerView*> GetChildren();
51 55
52 bool Contains(const Node* node) const; 56 bool Contains(const ServerView* view) const;
53 57
54 // Returns true if the window is visible. This does not consider visibility 58 // Returns true if the window is visible. This does not consider visibility
55 // of any ancestors. 59 // of any ancestors.
56 bool visible() const { return visible_; } 60 bool visible() const { return visible_; }
57 void SetVisible(bool value); 61 void SetVisible(bool value);
58 62
59 void SetBitmap(const SkBitmap& contents); 63 void SetBitmap(const SkBitmap& contents);
60 const SkBitmap& bitmap() const { return bitmap_; } 64 const SkBitmap& bitmap() const { return bitmap_; }
61 65
62 private: 66 private:
63 typedef std::vector<Node*> Nodes; 67 typedef std::vector<ServerView*> Views;
64 68
65 // Implementation of removing a node. Doesn't send any notification. 69 // Implementation of removing a view. Doesn't send any notification.
66 void RemoveImpl(Node* node); 70 void RemoveImpl(ServerView* view);
67 71
68 NodeDelegate* delegate_; 72 ServerViewDelegate* delegate_;
69 const NodeId id_; 73 const ViewId id_;
70 Node* parent_; 74 ServerView* parent_;
71 Nodes children_; 75 Views children_;
72 bool visible_; 76 bool visible_;
73 gfx::Rect bounds_; 77 gfx::Rect bounds_;
74 SkBitmap bitmap_; 78 SkBitmap bitmap_;
75 79
76 DISALLOW_COPY_AND_ASSIGN(Node); 80 DISALLOW_COPY_AND_ASSIGN(ServerView);
77 }; 81 };
78 82
79 } // namespace service 83 } // namespace service
80 } // namespace mojo 84 } // namespace mojo
81 85
82 #endif // MOJO_SERVICES_VIEW_MANAGER_NODE_H_ 86 #endif // MOJO_SERVICES_VIEW_MANAGER_SERVER_VIEW_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/root_node_manager.cc ('k') | mojo/services/view_manager/server_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698