Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Unified Diff: ash/public/cpp/shelf_types.cc

Issue 2865743002: ash: Rename AppLaunchId to ShelfID. (Closed)
Patch Set: Address comment. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/public/cpp/shelf_types.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ash/public/cpp/shelf_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698