| 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 COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ |
| 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ | 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "components/view_manager/public/cpp/types.h" | 12 #include "components/view_manager/public/cpp/types.h" |
| 13 #include "components/view_manager/public/interfaces/surface_id.mojom.h" | 13 #include "components/view_manager/public/interfaces/surface_id.mojom.h" |
| 14 #include "components/view_manager/public/interfaces/view_manager_constants.mojom
.h" | 14 #include "components/view_manager/public/interfaces/view_manager_constants.mojom
.h" |
| 15 #include "components/view_manager/public/interfaces/view_tree.mojom.h" | 15 #include "components/view_manager/public/interfaces/view_tree.mojom.h" |
| 16 #include "mojo/application/public/interfaces/service_provider.mojom.h" | 16 #include "mojo/application/public/interfaces/service_provider.mojom.h" |
| 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" | 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" |
| 18 #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" | 18 #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" |
| 19 #include "ui/mojo/geometry/geometry.mojom.h" | 19 #include "ui/mojo/geometry/geometry.mojom.h" |
| 20 | 20 |
| 21 namespace mojo { | 21 namespace mojo { |
| 22 | 22 |
| 23 class ServiceProviderImpl; | 23 class ServiceProviderImpl; |
| 24 class View; | 24 class View; |
| 25 class ViewObserver; | 25 class ViewObserver; |
| 26 class ViewSurface; |
| 26 class ViewTreeConnection; | 27 class ViewTreeConnection; |
| 27 | 28 |
| 28 // Defined in view_property.h (which we do not include) | 29 // Defined in view_property.h (which we do not include) |
| 29 template <typename T> | 30 template <typename T> |
| 30 struct ViewProperty; | 31 struct ViewProperty; |
| 31 | 32 |
| 32 // Views are owned by the ViewTreeConnection. See ViewTreeDelegate for details | 33 // Views are owned by the ViewTreeConnection. See ViewTreeDelegate for details |
| 33 // on ownership. | 34 // on ownership. |
| 34 // | 35 // |
| 35 // TODO(beng): Right now, you'll have to implement a ViewObserver to track | 36 // TODO(beng): Right now, you'll have to implement a ViewObserver to track |
| (...skipping 18 matching lines...) Expand all Loading... |
| 54 // Geometric disposition. | 55 // Geometric disposition. |
| 55 const Rect& bounds() const { return bounds_; } | 56 const Rect& bounds() const { return bounds_; } |
| 56 void SetBounds(const Rect& bounds); | 57 void SetBounds(const Rect& bounds); |
| 57 | 58 |
| 58 // Visibility (also see IsDrawn()). When created views are hidden. | 59 // Visibility (also see IsDrawn()). When created views are hidden. |
| 59 bool visible() const { return visible_; } | 60 bool visible() const { return visible_; } |
| 60 void SetVisible(bool value); | 61 void SetVisible(bool value); |
| 61 | 62 |
| 62 const ViewportMetrics& viewport_metrics() { return *viewport_metrics_; } | 63 const ViewportMetrics& viewport_metrics() { return *viewport_metrics_; } |
| 63 | 64 |
| 65 scoped_ptr<ViewSurface> RequestSurface(); |
| 66 |
| 64 // Returns the set of string to bag of byte properties. These properties are | 67 // Returns the set of string to bag of byte properties. These properties are |
| 65 // shared with the view manager. | 68 // shared with the view manager. |
| 66 const SharedProperties& shared_properties() const { return properties_; } | 69 const SharedProperties& shared_properties() const { return properties_; } |
| 67 // Sets a property. If |data| is null, this property is deleted. | 70 // Sets a property. If |data| is null, this property is deleted. |
| 68 void SetSharedProperty(const std::string& name, | 71 void SetSharedProperty(const std::string& name, |
| 69 const std::vector<uint8_t>* data); | 72 const std::vector<uint8_t>* data); |
| 70 | 73 |
| 71 // Sets the |value| of the given window |property|. Setting to the default | 74 // Sets the |value| of the given window |property|. Setting to the default |
| 72 // value (e.g., NULL) removes the property. The caller is responsible for the | 75 // value (e.g., NULL) removes the property. The caller is responsible for the |
| 73 // lifetime of any object set as a property on the View. | 76 // lifetime of any object set as a property on the View. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void RemoveChild(View* child); | 119 void RemoveChild(View* child); |
| 117 | 120 |
| 118 void Reorder(View* relative, OrderDirection direction); | 121 void Reorder(View* relative, OrderDirection direction); |
| 119 void MoveToFront(); | 122 void MoveToFront(); |
| 120 void MoveToBack(); | 123 void MoveToBack(); |
| 121 | 124 |
| 122 bool Contains(View* child) const; | 125 bool Contains(View* child) const; |
| 123 | 126 |
| 124 View* GetChildById(Id id); | 127 View* GetChildById(Id id); |
| 125 | 128 |
| 126 void SetSurfaceId(SurfaceIdPtr id); | |
| 127 | |
| 128 void SetTextInputState(TextInputStatePtr state); | 129 void SetTextInputState(TextInputStatePtr state); |
| 129 void SetImeVisibility(bool visible, TextInputStatePtr state); | 130 void SetImeVisibility(bool visible, TextInputStatePtr state); |
| 130 | 131 |
| 131 // Focus. | 132 // Focus. |
| 132 void SetFocus(); | 133 void SetFocus(); |
| 133 bool HasFocus() const; | 134 bool HasFocus() const; |
| 134 | 135 |
| 135 // Embedding. See view_tree.mojom for details. | 136 // Embedding. See view_tree.mojom for details. |
| 136 void Embed(ViewTreeClientPtr client); | 137 void Embed(ViewTreeClientPtr client); |
| 137 | 138 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 }; | 211 }; |
| 211 | 212 |
| 212 std::map<const void*, Value> prop_map_; | 213 std::map<const void*, Value> prop_map_; |
| 213 | 214 |
| 214 MOJO_DISALLOW_COPY_AND_ASSIGN(View); | 215 MOJO_DISALLOW_COPY_AND_ASSIGN(View); |
| 215 }; | 216 }; |
| 216 | 217 |
| 217 } // namespace mojo | 218 } // namespace mojo |
| 218 | 219 |
| 219 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ | 220 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_H_ |
| OLD | NEW |