| 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 <stdint.h> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 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 "geometry/public/interfaces/geometry.mojom.h" |
| 13 #include "mojo/public/cpp/bindings/array.h" | 13 #include "mojo/public/cpp/bindings/array.h" |
| 14 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 14 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
| 15 #include "surfaces/public/interfaces/surface_id.mojom.h" | 15 #include "surfaces/public/interfaces/surface_id.mojom.h" |
| 16 #include "view_manager/public/cpp/types.h" | 16 #include "view_manager/public/cpp/types.h" |
| 17 #include "view_manager/public/interfaces/view_manager.mojom.h" | 17 #include "view_manager/public/interfaces/view_manager.mojom.h" |
| 18 #include "view_manager/public/interfaces/view_manager_constants.mojom.h" | 18 #include "view_manager/public/interfaces/view_manager_constants.mojom.h" |
| 19 | 19 |
| 20 namespace mojo { | 20 namespace mojo { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 // Sets the |property| to its default value. Useful for avoiding a cast when | 81 // Sets the |property| to its default value. Useful for avoiding a cast when |
| 82 // setting to NULL. | 82 // setting to NULL. |
| 83 // | 83 // |
| 84 // These properties are only visible in the current process and are not | 84 // These properties are only visible in the current process and are not |
| 85 // shared with other mojo services. | 85 // shared with other mojo services. |
| 86 template <typename T> | 86 template <typename T> |
| 87 void ClearLocalProperty(const ViewProperty<T>* property); | 87 void ClearLocalProperty(const ViewProperty<T>* property); |
| 88 | 88 |
| 89 // Type of a function to delete a property that this view owns. | 89 // Type of a function to delete a property that this view owns. |
| 90 typedef void (*PropertyDeallocator)(int64 value); | 90 typedef void (*PropertyDeallocator)(int64_t value); |
| 91 | 91 |
| 92 // A View is drawn if the View and all its ancestors are visible and the | 92 // A View is drawn if the View and all its ancestors are visible and the |
| 93 // View is attached to the root. | 93 // View is attached to the root. |
| 94 bool IsDrawn() const; | 94 bool IsDrawn() const; |
| 95 | 95 |
| 96 // Observation. | 96 // Observation. |
| 97 void AddObserver(ViewObserver* observer); | 97 void AddObserver(ViewObserver* observer); |
| 98 void RemoveObserver(ViewObserver* observer); | 98 void RemoveObserver(ViewObserver* observer); |
| 99 | 99 |
| 100 // Tree. | 100 // Tree. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 View(); | 134 View(); |
| 135 ~View(); | 135 ~View(); |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 friend class ViewPrivate; | 138 friend class ViewPrivate; |
| 139 friend class ViewManagerClientImpl; | 139 friend class ViewManagerClientImpl; |
| 140 | 140 |
| 141 View(ViewManager* manager, Id id); | 141 View(ViewManager* manager, Id id); |
| 142 | 142 |
| 143 // Called by the public {Set,Get,Clear}Property functions. | 143 // Called by the public {Set,Get,Clear}Property functions. |
| 144 int64 SetLocalPropertyInternal(const void* key, | 144 int64_t SetLocalPropertyInternal(const void* key, |
| 145 const char* name, | 145 const char* name, |
| 146 PropertyDeallocator deallocator, | 146 PropertyDeallocator deallocator, |
| 147 int64 value, | 147 int64_t value, |
| 148 int64 default_value); | 148 int64_t default_value); |
| 149 int64 GetLocalPropertyInternal(const void* key, int64 default_value) const; | 149 int64_t GetLocalPropertyInternal(const void* key, |
| 150 int64_t default_value) const; |
| 150 | 151 |
| 151 void LocalDestroy(); | 152 void LocalDestroy(); |
| 152 void LocalAddChild(View* child); | 153 void LocalAddChild(View* child); |
| 153 void LocalRemoveChild(View* child); | 154 void LocalRemoveChild(View* child); |
| 154 // Returns true if the order actually changed. | 155 // Returns true if the order actually changed. |
| 155 bool LocalReorder(View* relative, OrderDirection direction); | 156 bool LocalReorder(View* relative, OrderDirection direction); |
| 156 void LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds); | 157 void LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds); |
| 157 void LocalSetViewportMetrics(const ViewportMetrics& old_metrics, | 158 void LocalSetViewportMetrics(const ViewportMetrics& old_metrics, |
| 158 const ViewportMetrics& new_metrics); | 159 const ViewportMetrics& new_metrics); |
| 159 void LocalSetDrawn(bool drawn); | 160 void LocalSetDrawn(bool drawn); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 186 | 187 |
| 187 // Drawn state is derived from the visible state and the parent's visible | 188 // Drawn state is derived from the visible state and the parent's visible |
| 188 // state. This field is only used if the view has no parent (eg it's a root). | 189 // state. This field is only used if the view has no parent (eg it's a root). |
| 189 bool drawn_; | 190 bool drawn_; |
| 190 | 191 |
| 191 // Value struct to keep the name and deallocator for this property. | 192 // Value struct to keep the name and deallocator for this property. |
| 192 // Key cannot be used for this purpose because it can be char* or | 193 // Key cannot be used for this purpose because it can be char* or |
| 193 // WindowProperty<>. | 194 // WindowProperty<>. |
| 194 struct Value { | 195 struct Value { |
| 195 const char* name; | 196 const char* name; |
| 196 int64 value; | 197 int64_t value; |
| 197 PropertyDeallocator deallocator; | 198 PropertyDeallocator deallocator; |
| 198 }; | 199 }; |
| 199 | 200 |
| 200 std::map<const void*, Value> prop_map_; | 201 std::map<const void*, Value> prop_map_; |
| 201 | 202 |
| 202 DISALLOW_COPY_AND_ASSIGN(View); | 203 DISALLOW_COPY_AND_ASSIGN(View); |
| 203 }; | 204 }; |
| 204 | 205 |
| 205 } // namespace mojo | 206 } // namespace mojo |
| 206 | 207 |
| 207 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ | 208 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ |
| OLD | NEW |