| Index: ash/public/cpp/shelf_types.cc
|
| diff --git a/ash/public/cpp/shelf_types.cc b/ash/public/cpp/shelf_types.cc
|
| index a4cb0fd44fd23a19918f47c12e9868625cd41a02..53d683239caf45fcfd8a4f7b5dce63ff02048523 100644
|
| --- a/ash/public/cpp/shelf_types.cc
|
| +++ b/ash/public/cpp/shelf_types.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "ash/public/cpp/shelf_types.h"
|
|
|
| +#include "base/logging.h"
|
| +
|
| namespace ash {
|
|
|
| bool IsValidShelfItemType(int64_t type) {
|
| @@ -12,4 +14,34 @@ bool IsValidShelfItemType(int64_t type) {
|
| type == TYPE_APP || type == TYPE_DIALOG || type == TYPE_UNDEFINED;
|
| }
|
|
|
| +ShelfID::ShelfID(const std::string& app_id, const std::string& launch_id)
|
| + : app_id(app_id), launch_id(launch_id) {
|
| + DCHECK(launch_id.empty() || !app_id.empty()) << "launch ids require app ids.";
|
| +}
|
| +
|
| +ShelfID::~ShelfID() = default;
|
| +
|
| +ShelfID::ShelfID(const ShelfID& other) = default;
|
| +
|
| +ShelfID::ShelfID(ShelfID&& other) = default;
|
| +
|
| +ShelfID& ShelfID::operator=(const ShelfID& other) = default;
|
| +
|
| +bool ShelfID::operator==(const ShelfID& other) const {
|
| + return app_id == other.app_id && launch_id == other.launch_id;
|
| +}
|
| +
|
| +bool ShelfID::operator!=(const ShelfID& other) const {
|
| + return !(*this == other);
|
| +}
|
| +
|
| +bool ShelfID::operator<(const ShelfID& other) const {
|
| + return app_id < other.app_id ||
|
| + (app_id == other.app_id && launch_id < other.launch_id);
|
| +}
|
| +
|
| +bool ShelfID::IsNull() const {
|
| + return app_id.empty() && launch_id.empty();
|
| +}
|
| +
|
| } // namespace ash
|
|
|