OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_PUBLIC_CPP_SHELF_TYPES_H_ | 5 #ifndef ASH_PUBLIC_CPP_SHELF_TYPES_H_ |
6 #define ASH_PUBLIC_CPP_SHELF_TYPES_H_ | 6 #define ASH_PUBLIC_CPP_SHELF_TYPES_H_ |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // A shelf item that needs user's attention. | 131 // A shelf item that needs user's attention. |
132 STATUS_ATTENTION, | 132 STATUS_ATTENTION, |
133 }; | 133 }; |
134 | 134 |
135 // A unique shelf item id composed of an |app_id| and a |launch_id|. | 135 // A unique shelf item id composed of an |app_id| and a |launch_id|. |
136 // |app_id| is the non-empty application id associated with a set of windows. | 136 // |app_id| is the non-empty application id associated with a set of windows. |
137 // |launch_id| is passed on app launch, to support multiple shelf items per app. | 137 // |launch_id| is passed on app launch, to support multiple shelf items per app. |
138 // As an example, a remote desktop client may want each remote application to | 138 // As an example, a remote desktop client may want each remote application to |
139 // have its own icon. | 139 // have its own icon. |
140 struct ASH_PUBLIC_EXPORT ShelfID { | 140 struct ASH_PUBLIC_EXPORT ShelfID { |
141 ShelfID(const std::string& app_id = std::string(), | 141 explicit ShelfID(const std::string& app_id = std::string(), |
142 const std::string& launch_id = std::string()); | 142 const std::string& launch_id = std::string()); |
143 ~ShelfID(); | 143 ~ShelfID(); |
144 | 144 |
145 ShelfID(const ShelfID& other); | 145 ShelfID(const ShelfID& other); |
146 ShelfID(ShelfID&& other); | 146 ShelfID(ShelfID&& other); |
147 ShelfID& operator=(const ShelfID& other); | 147 ShelfID& operator=(const ShelfID& other); |
148 bool operator==(const ShelfID& other) const; | 148 bool operator==(const ShelfID& other) const; |
149 bool operator!=(const ShelfID& other) const; | 149 bool operator!=(const ShelfID& other) const; |
150 bool operator<(const ShelfID& other) const; | 150 bool operator<(const ShelfID& other) const; |
151 | 151 |
152 // Returns true if both the application id and launch id are empty. | 152 // Returns true if both the application id and launch id are empty. |
153 // This is often used to determine if the id is invalid. | 153 // This is often used to determine if the id is invalid. |
154 bool IsNull() const; | 154 bool IsNull() const; |
155 | 155 |
| 156 // Functions to [de]serialize ids as a string for window property usage, etc. |
| 157 // Serialization appends ids with a delimeter that must not be used in ids. |
| 158 // Deserialization returns an empty/null/default id for a null string input. |
| 159 std::string Serialize() const; |
| 160 static ShelfID Deserialize(const std::string* string); |
| 161 |
156 // The application id associated with a set of windows. | 162 // The application id associated with a set of windows. |
157 std::string app_id; | 163 std::string app_id; |
158 // An id passed on app launch, to support multiple shelf items per app. | 164 // An id passed on app launch, to support multiple shelf items per app. |
159 std::string launch_id; | 165 std::string launch_id; |
160 }; | 166 }; |
161 | 167 |
162 } // namespace ash | 168 } // namespace ash |
163 | 169 |
164 #endif // ASH_PUBLIC_CPP_SHELF_TYPES_H_ | 170 #endif // ASH_PUBLIC_CPP_SHELF_TYPES_H_ |
OLD | NEW |