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 COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ |
6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "mojo/public/cpp/bindings/array.h" | 13 #include "mojo/public/cpp/bindings/array.h" |
14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
15 | 15 |
16 namespace mus { | 16 namespace mus { |
17 | 17 |
18 namespace mojom { | |
19 enum Cursor : int32_t; | |
20 } | |
21 | |
18 class Window; | 22 class Window; |
19 | 23 |
20 enum class ChangeType { | 24 enum class ChangeType { |
21 ADD_TRANSIENT_WINDOW, | 25 ADD_TRANSIENT_WINDOW, |
22 BOUNDS, | 26 BOUNDS, |
23 DELETE_WINDOW, | 27 DELETE_WINDOW, |
24 NEW_WINDOW, | 28 NEW_WINDOW, |
25 PROPERTY, | 29 PROPERTY, |
26 REMOVE_TRANSIENT_WINDOW_FROM_PARENT | 30 REMOVE_TRANSIENT_WINDOW_FROM_PARENT, |
31 PREDEFINED_CURSOR | |
sky
2015/12/02 21:42:35
nit: keep sorted.
| |
27 }; | 32 }; |
28 | 33 |
29 // InFlightChange is used to track function calls to the server and take the | 34 // InFlightChange is used to track function calls to the server and take the |
30 // appropriate action when the call fails, or the same property changes while | 35 // appropriate action when the call fails, or the same property changes while |
31 // waiting for the response. When a function is called on the server an | 36 // waiting for the response. When a function is called on the server an |
32 // InFlightChange is created. The function call is complete when | 37 // InFlightChange is created. The function call is complete when |
33 // OnChangeCompleted() is received from the server. The following may occur | 38 // OnChangeCompleted() is received from the server. The following may occur |
34 // while waiting for a response: | 39 // while waiting for a response: |
35 // . A new value is encountered from the server. For example, the bounds of | 40 // . A new value is encountered from the server. For example, the bounds of |
36 // a window is locally changed and while waiting for the ack | 41 // a window is locally changed and while waiting for the ack |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 void SetRevertValueFrom(const InFlightChange& change) override; | 128 void SetRevertValueFrom(const InFlightChange& change) override; |
124 void Revert() override; | 129 void Revert() override; |
125 | 130 |
126 private: | 131 private: |
127 const std::string property_name_; | 132 const std::string property_name_; |
128 mojo::Array<uint8_t> revert_value_; | 133 mojo::Array<uint8_t> revert_value_; |
129 | 134 |
130 DISALLOW_COPY_AND_ASSIGN(InFlightPropertyChange); | 135 DISALLOW_COPY_AND_ASSIGN(InFlightPropertyChange); |
131 }; | 136 }; |
132 | 137 |
138 class InFlightPredefinedCursorChange : public InFlightChange { | |
139 public: | |
140 InFlightPredefinedCursorChange(Window* window, mojom::Cursor revert_value); | |
141 ~InFlightPredefinedCursorChange() override; | |
142 | |
143 // InFlightChange: | |
144 bool Matches(const InFlightChange& change) const override; | |
145 void SetRevertValueFrom(const InFlightChange& change) override; | |
146 void Revert() override; | |
147 | |
148 private: | |
149 mojom::Cursor revert_cursor_; | |
150 | |
151 DISALLOW_COPY_AND_ASSIGN(InFlightPredefinedCursorChange); | |
152 }; | |
153 | |
133 } // namespace mus | 154 } // namespace mus |
134 | 155 |
135 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ | 156 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ |
OLD | NEW |