| 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 MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "geometry/public/interfaces/geometry.mojom.h" |
| 12 #include "mojo/public/cpp/bindings/array.h" | 13 #include "mojo/public/cpp/bindings/array.h" |
| 13 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 14 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
| 14 #include "mojo/services/geometry/public/interfaces/geometry.mojom.h" | 15 #include "surfaces/public/interfaces/surface_id.mojom.h" |
| 15 #include "mojo/services/surfaces/public/interfaces/surface_id.mojom.h" | 16 #include "view_manager/public/cpp/types.h" |
| 16 #include "mojo/services/view_manager/public/cpp/types.h" | 17 #include "view_manager/public/interfaces/view_manager.mojom.h" |
| 17 #include "mojo/services/view_manager/public/interfaces/view_manager_constants.mo
jom.h" | 18 #include "view_manager/public/interfaces/view_manager_constants.mojom.h" |
| 18 | 19 |
| 19 namespace mojo { | 20 namespace mojo { |
| 20 | 21 |
| 21 class ServiceProviderImpl; | 22 class ServiceProviderImpl; |
| 22 class View; | 23 class View; |
| 23 class ViewManager; | 24 class ViewManager; |
| 24 class ViewObserver; | 25 class ViewObserver; |
| 25 | 26 |
| 26 // Defined in view_property.h (which we do not include) | 27 // Defined in view_property.h (which we do not include) |
| 27 template <typename T> | 28 template <typename T> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 45 Id id() const { return id_; } | 46 Id id() const { return id_; } |
| 46 | 47 |
| 47 // Geometric disposition. | 48 // Geometric disposition. |
| 48 const Rect& bounds() const { return bounds_; } | 49 const Rect& bounds() const { return bounds_; } |
| 49 void SetBounds(const Rect& bounds); | 50 void SetBounds(const Rect& bounds); |
| 50 | 51 |
| 51 // Visibility (also see IsDrawn()). When created views are hidden. | 52 // Visibility (also see IsDrawn()). When created views are hidden. |
| 52 bool visible() const { return visible_; } | 53 bool visible() const { return visible_; } |
| 53 void SetVisible(bool value); | 54 void SetVisible(bool value); |
| 54 | 55 |
| 56 const ViewportMetrics& viewport_metrics() { return *viewport_metrics_; } |
| 57 |
| 55 // Returns the set of string to bag of byte properties. These properties are | 58 // Returns the set of string to bag of byte properties. These properties are |
| 56 // shared with the view manager. | 59 // shared with the view manager. |
| 57 const SharedProperties& shared_properties() const { return properties_; } | 60 const SharedProperties& shared_properties() const { return properties_; } |
| 58 // Sets a property. If |data| is null, this property is deleted. | 61 // Sets a property. If |data| is null, this property is deleted. |
| 59 void SetSharedProperty(const std::string& name, | 62 void SetSharedProperty(const std::string& name, |
| 60 const std::vector<uint8_t>* data); | 63 const std::vector<uint8_t>* data); |
| 61 | 64 |
| 62 // Sets the |value| of the given window |property|. Setting to the default | 65 // Sets the |value| of the given window |property|. Setting to the default |
| 63 // value (e.g., NULL) removes the property. The caller is responsible for the | 66 // value (e.g., NULL) removes the property. The caller is responsible for the |
| 64 // lifetime of any object set as a property on the View. | 67 // lifetime of any object set as a property on the View. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void NotifyViewVisibilityChangedUp(View* target); | 168 void NotifyViewVisibilityChangedUp(View* target); |
| 166 | 169 |
| 167 ViewManager* manager_; | 170 ViewManager* manager_; |
| 168 Id id_; | 171 Id id_; |
| 169 View* parent_; | 172 View* parent_; |
| 170 Children children_; | 173 Children children_; |
| 171 | 174 |
| 172 ObserverList<ViewObserver> observers_; | 175 ObserverList<ViewObserver> observers_; |
| 173 | 176 |
| 174 Rect bounds_; | 177 Rect bounds_; |
| 178 ViewportMetricsPtr viewport_metrics_; |
| 175 | 179 |
| 176 bool visible_; | 180 bool visible_; |
| 177 | 181 |
| 178 SharedProperties properties_; | 182 SharedProperties properties_; |
| 179 | 183 |
| 180 // Drawn state is derived from the visible state and the parent's visible | 184 // Drawn state is derived from the visible state and the parent's visible |
| 181 // state. This field is only used if the view has no parent (eg it's a root). | 185 // state. This field is only used if the view has no parent (eg it's a root). |
| 182 bool drawn_; | 186 bool drawn_; |
| 183 | 187 |
| 184 // Value struct to keep the name and deallocator for this property. | 188 // Value struct to keep the name and deallocator for this property. |
| 185 // Key cannot be used for this purpose because it can be char* or | 189 // Key cannot be used for this purpose because it can be char* or |
| 186 // WindowProperty<>. | 190 // WindowProperty<>. |
| 187 struct Value { | 191 struct Value { |
| 188 const char* name; | 192 const char* name; |
| 189 int64 value; | 193 int64 value; |
| 190 PropertyDeallocator deallocator; | 194 PropertyDeallocator deallocator; |
| 191 }; | 195 }; |
| 192 | 196 |
| 193 std::map<const void*, Value> prop_map_; | 197 std::map<const void*, Value> prop_map_; |
| 194 | 198 |
| 195 DISALLOW_COPY_AND_ASSIGN(View); | 199 DISALLOW_COPY_AND_ASSIGN(View); |
| 196 }; | 200 }; |
| 197 | 201 |
| 198 } // namespace mojo | 202 } // namespace mojo |
| 199 | 203 |
| 200 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ | 204 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ |
| OLD | NEW |