OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UI_VIEW_MANAGER_VIEW_LAYOUT_REQUEST_H_ | 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_LAYOUT_REQUEST_H_ |
6 #define SERVICES_UI_VIEW_MANAGER_VIEW_LAYOUT_REQUEST_H_ | 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_LAYOUT_REQUEST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Adds a callback to this layout request. | 37 // Adds a callback to this layout request. |
38 // Must be called before dispatching. | 38 // Must be called before dispatching. |
39 void AddCallback(const ViewLayoutCallback& callback); | 39 void AddCallback(const ViewLayoutCallback& callback); |
40 | 40 |
41 // Returns true if the request has callbacks. | 41 // Returns true if the request has callbacks. |
42 bool has_callbacks() { return !callbacks_.empty(); } | 42 bool has_callbacks() { return !callbacks_.empty(); } |
43 | 43 |
44 // Sends the layout information to each client. | 44 // Sends the layout information to each client. |
45 // Must be invoked exactly once before destroying the request to prevent | 45 // Must be invoked exactly once before destroying the request to prevent |
46 // dangling callbacks. | 46 // dangling callbacks. |
47 void DispatchLayoutInfo(mojo::ui::ViewLayoutInfo* info); | 47 void DispatchLayoutInfo(mojo::ui::ViewLayoutInfoPtr info); |
48 | 48 |
49 // True if the request has been issued to the view. | 49 // True if the request has been issued to the view. |
50 // False if it is still pending in the queue. | 50 // False if it is still pending in the queue. |
51 bool issued() const { return issued_; } | 51 bool issued() const { return issued_; } |
52 void set_issued(bool value) { issued_ = value; } | 52 void set_issued(bool value) { issued_ = value; } |
53 | 53 |
54 private: | 54 private: |
55 mojo::ui::ViewLayoutParamsPtr layout_params_; | 55 mojo::ui::ViewLayoutParamsPtr layout_params_; |
56 std::vector<ViewLayoutCallback> callbacks_; | 56 std::vector<ViewLayoutCallback> callbacks_; |
57 bool was_dispatched_; | 57 bool was_dispatched_; |
58 bool issued_; | 58 bool issued_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(ViewLayoutRequest); | 60 DISALLOW_COPY_AND_ASSIGN(ViewLayoutRequest); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace view_manager | 63 } // namespace view_manager |
64 | 64 |
65 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_LAYOUT_REQUEST_H_ | 65 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_LAYOUT_REQUEST_H_ |
OLD | NEW |