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, |
| 29 PREDEFINED_CURSOR, |
25 PROPERTY, | 30 PROPERTY, |
26 REMOVE_TRANSIENT_WINDOW_FROM_PARENT, | 31 REMOVE_TRANSIENT_WINDOW_FROM_PARENT, |
27 VISIBLE, | 32 VISIBLE, |
28 }; | 33 }; |
29 | 34 |
30 // InFlightChange is used to track function calls to the server and take the | 35 // InFlightChange is used to track function calls to the server and take the |
31 // appropriate action when the call fails, or the same property changes while | 36 // appropriate action when the call fails, or the same property changes while |
32 // waiting for the response. When a function is called on the server an | 37 // waiting for the response. When a function is called on the server an |
33 // InFlightChange is created. The function call is complete when | 38 // InFlightChange is created. The function call is complete when |
34 // OnChangeCompleted() is received from the server. The following may occur | 39 // OnChangeCompleted() is received from the server. The following may occur |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 void SetRevertValueFrom(const InFlightChange& change) override; | 129 void SetRevertValueFrom(const InFlightChange& change) override; |
125 void Revert() override; | 130 void Revert() override; |
126 | 131 |
127 private: | 132 private: |
128 const std::string property_name_; | 133 const std::string property_name_; |
129 mojo::Array<uint8_t> revert_value_; | 134 mojo::Array<uint8_t> revert_value_; |
130 | 135 |
131 DISALLOW_COPY_AND_ASSIGN(InFlightPropertyChange); | 136 DISALLOW_COPY_AND_ASSIGN(InFlightPropertyChange); |
132 }; | 137 }; |
133 | 138 |
| 139 class InFlightPredefinedCursorChange : public InFlightChange { |
| 140 public: |
| 141 InFlightPredefinedCursorChange(Window* window, mojom::Cursor revert_value); |
| 142 ~InFlightPredefinedCursorChange() override; |
| 143 |
| 144 // InFlightChange: |
| 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 |
134 class InFlightVisibleChange : public InFlightChange { | 154 class InFlightVisibleChange : public InFlightChange { |
135 public: | 155 public: |
136 InFlightVisibleChange(Window* window, const bool revert_value); | 156 InFlightVisibleChange(Window* window, const bool revert_value); |
137 | 157 |
138 // InFlightChange: | 158 // InFlightChange: |
139 void SetRevertValueFrom(const InFlightChange& change) override; | 159 void SetRevertValueFrom(const InFlightChange& change) override; |
140 void Revert() override; | 160 void Revert() override; |
141 | 161 |
142 private: | 162 private: |
143 Window* window_; | 163 Window* window_; |
144 bool revert_visible_; | 164 bool revert_visible_; |
145 | 165 |
146 DISALLOW_COPY_AND_ASSIGN(InFlightVisibleChange); | 166 DISALLOW_COPY_AND_ASSIGN(InFlightVisibleChange); |
147 }; | 167 }; |
148 | 168 |
149 } // namespace mus | 169 } // namespace mus |
150 | 170 |
151 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ | 171 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_ |
OLD | NEW |