OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_STRUCT_TRAITS_H_ | 5 #ifndef ASH_PUBLIC_CPP_SHELF_STRUCT_TRAITS_H_ |
6 #define ASH_PUBLIC_CPP_SHELF_STRUCT_TRAITS_H_ | 6 #define ASH_PUBLIC_CPP_SHELF_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "ash/public/cpp/ash_public_export.h" | 8 #include "ash/public/cpp/ash_public_export.h" |
9 #include "ash/public/cpp/shelf_item.h" | 9 #include "ash/public/cpp/shelf_item.h" |
10 #include "ash/public/cpp/shelf_types.h" | 10 #include "ash/public/cpp/shelf_types.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 *out = ash::LAUNCH_FROM_APP_LIST_SEARCH; | 248 *out = ash::LAUNCH_FROM_APP_LIST_SEARCH; |
249 return true; | 249 return true; |
250 } | 250 } |
251 NOTREACHED(); | 251 NOTREACHED(); |
252 return false; | 252 return false; |
253 } | 253 } |
254 }; | 254 }; |
255 | 255 |
256 template <> | 256 template <> |
257 struct ASH_PUBLIC_EXPORT | 257 struct ASH_PUBLIC_EXPORT |
| 258 StructTraits<ash::mojom::ShelfIDDataView, ash::ShelfID> { |
| 259 static const std::string& app_id(const ash::ShelfID& i) { return i.app_id; } |
| 260 static const std::string& launch_id(const ash::ShelfID& i) { |
| 261 return i.launch_id; |
| 262 } |
| 263 static bool Read(ash::mojom::ShelfIDDataView data, ash::ShelfID* out); |
| 264 }; |
| 265 |
| 266 template <> |
| 267 struct ASH_PUBLIC_EXPORT |
258 StructTraits<ash::mojom::ShelfItemDataView, ShelfItem> { | 268 StructTraits<ash::mojom::ShelfItemDataView, ShelfItem> { |
259 static ash::ShelfItemType type(const ShelfItem& i) { return i.type; } | 269 static ash::ShelfItemType type(const ShelfItem& i) { return i.type; } |
260 static const SkBitmap& image(const ShelfItem& i); | 270 static const SkBitmap& image(const ShelfItem& i); |
261 static ash::ShelfID shelf_id(const ShelfItem& i) { return i.id; } | |
262 static ash::ShelfItemStatus status(const ShelfItem& i) { return i.status; } | 271 static ash::ShelfItemStatus status(const ShelfItem& i) { return i.status; } |
263 static const std::string& app_id(const ShelfItem& i) { | 272 static const ash::ShelfID& shelf_id(const ShelfItem& i) { return i.id; } |
264 return i.app_launch_id.app_id(); | |
265 } | |
266 static const std::string& launch_id(const ShelfItem& i) { | |
267 return i.app_launch_id.launch_id(); | |
268 } | |
269 static const base::string16& title(const ShelfItem& i) { return i.title; } | 273 static const base::string16& title(const ShelfItem& i) { return i.title; } |
270 static bool shows_tooltip(const ShelfItem& i) { return i.shows_tooltip; } | 274 static bool shows_tooltip(const ShelfItem& i) { return i.shows_tooltip; } |
271 static bool pinned_by_policy(const ShelfItem& i) { | 275 static bool pinned_by_policy(const ShelfItem& i) { |
272 return i.pinned_by_policy; | 276 return i.pinned_by_policy; |
273 } | 277 } |
274 | 278 |
275 static bool Read(ash::mojom::ShelfItemDataView data, ShelfItem* out); | 279 static bool Read(ash::mojom::ShelfItemDataView data, ShelfItem* out); |
276 }; | 280 }; |
277 | 281 |
278 } // namespace mojo | 282 } // namespace mojo |
279 | 283 |
280 #endif // ASH_PUBLIC_CPP_SHELF_STRUCT_TRAITS_H_ | 284 #endif // ASH_PUBLIC_CPP_SHELF_STRUCT_TRAITS_H_ |
OLD | NEW |