| OLD | NEW |
| 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 "cc/surfaces/surface_id.h" | 11 #include "cc/surfaces/surface_id.h" |
| 12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 13 #include "services/view_manager/ids.h" | 13 #include "services/view_manager/ids.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/transform.h" |
| 15 | 16 |
| 16 namespace mojo { | 17 namespace mojo { |
| 17 namespace service { | 18 namespace service { |
| 18 | 19 |
| 19 class ServerViewDelegate; | 20 class ServerViewDelegate; |
| 20 | 21 |
| 21 // Server side representation of a view. Delegate is informed of interesting | 22 // Server side representation of a view. Delegate is informed of interesting |
| 22 // events. | 23 // events. |
| 23 // | 24 // |
| 24 // It is assumed that all functions that mutate the tree have validated the | 25 // It is assumed that all functions that mutate the tree have validated the |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 bool Contains(const ServerView* view) const; | 57 bool Contains(const ServerView* view) const; |
| 57 | 58 |
| 58 // Returns true if the window is visible. This does not consider visibility | 59 // Returns true if the window is visible. This does not consider visibility |
| 59 // of any ancestors. | 60 // of any ancestors. |
| 60 bool visible() const { return visible_; } | 61 bool visible() const { return visible_; } |
| 61 void SetVisible(bool value); | 62 void SetVisible(bool value); |
| 62 | 63 |
| 63 float opacity() const { return opacity_; } | 64 float opacity() const { return opacity_; } |
| 64 void SetOpacity(float value); | 65 void SetOpacity(float value); |
| 65 | 66 |
| 67 const gfx::Transform& transform() const { return transform_; } |
| 68 void SetTransform(const gfx::Transform& transform); |
| 69 |
| 66 const std::map<std::string, std::vector<uint8_t>>& properties() const { | 70 const std::map<std::string, std::vector<uint8_t>>& properties() const { |
| 67 return properties_; | 71 return properties_; |
| 68 } | 72 } |
| 69 void SetProperty(const std::string& name, const std::vector<uint8_t>* value); | 73 void SetProperty(const std::string& name, const std::vector<uint8_t>* value); |
| 70 | 74 |
| 71 // Returns true if this view is attached to |root| and all ancestors are | 75 // Returns true if this view is attached to |root| and all ancestors are |
| 72 // visible. | 76 // visible. |
| 73 bool IsDrawn(const ServerView* root) const; | 77 bool IsDrawn(const ServerView* root) const; |
| 74 | 78 |
| 75 void SetSurfaceId(cc::SurfaceId surface_id); | 79 void SetSurfaceId(cc::SurfaceId surface_id); |
| 76 const cc::SurfaceId surface_id() const { return surface_id_; } | 80 const cc::SurfaceId& surface_id() const { return surface_id_; } |
| 77 | 81 |
| 78 #if !defined(NDEBUG) | 82 #if !defined(NDEBUG) |
| 79 std::string GetDebugWindowHierarchy() const; | 83 std::string GetDebugWindowHierarchy() const; |
| 80 void BuildDebugInfo(const std::string& depth, std::string* result) const; | 84 void BuildDebugInfo(const std::string& depth, std::string* result) const; |
| 81 #endif | 85 #endif |
| 82 | 86 |
| 83 private: | 87 private: |
| 84 typedef std::vector<ServerView*> Views; | 88 typedef std::vector<ServerView*> Views; |
| 85 | 89 |
| 86 // Implementation of removing a view. Doesn't send any notification. | 90 // Implementation of removing a view. Doesn't send any notification. |
| 87 void RemoveImpl(ServerView* view); | 91 void RemoveImpl(ServerView* view); |
| 88 | 92 |
| 89 ServerViewDelegate* delegate_; | 93 ServerViewDelegate* delegate_; |
| 90 const ViewId id_; | 94 const ViewId id_; |
| 91 ServerView* parent_; | 95 ServerView* parent_; |
| 92 Views children_; | 96 Views children_; |
| 93 bool visible_; | 97 bool visible_; |
| 94 gfx::Rect bounds_; | 98 gfx::Rect bounds_; |
| 95 cc::SurfaceId surface_id_; | 99 cc::SurfaceId surface_id_; |
| 96 float opacity_; | 100 float opacity_; |
| 101 gfx::Transform transform_; |
| 97 | 102 |
| 98 std::map<std::string, std::vector<uint8_t>> properties_; | 103 std::map<std::string, std::vector<uint8_t>> properties_; |
| 99 | 104 |
| 100 DISALLOW_COPY_AND_ASSIGN(ServerView); | 105 DISALLOW_COPY_AND_ASSIGN(ServerView); |
| 101 }; | 106 }; |
| 102 | 107 |
| 103 } // namespace service | 108 } // namespace service |
| 104 } // namespace mojo | 109 } // namespace mojo |
| 105 | 110 |
| 106 #endif // SERVICES_VIEW_MANAGER_SERVER_VIEW_H_ | 111 #endif // SERVICES_VIEW_MANAGER_SERVER_VIEW_H_ |
| OLD | NEW |