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

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

Issue 2860503002: mash: Replace int ShelfIDs with AppLaunchID strings. (Closed)
Patch Set: Restore AppLaunchId class via using ShelfID = AppLaunchId; cleanup. 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
Index: ash/public/cpp/app_launch_id.cc
diff --git a/ash/public/cpp/app_launch_id.cc b/ash/public/cpp/app_launch_id.cc
index fc437c3afe5deb63f1808241b80a8cf0d23f7f13..a32cb6dfc4cf2eead20c927b3efc5c94860ef5bb 100644
--- a/ash/public/cpp/app_launch_id.cc
+++ b/ash/public/cpp/app_launch_id.cc
@@ -11,15 +11,30 @@ namespace ash {
AppLaunchId::AppLaunchId(const std::string& app_id,
const std::string& launch_id)
: app_id_(app_id), launch_id_(launch_id) {
- DCHECK(!app_id.empty());
+ DCHECK(launch_id.empty() || !app_id.empty()) << "launch ids require app ids.";
}
-AppLaunchId::AppLaunchId(const std::string& app_id) : app_id_(app_id) {
- DCHECK(!app_id.empty());
-}
+AppLaunchId::AppLaunchId(const std::string& app_id) : app_id_(app_id) {}
James Cook 2017/05/04 16:38:48 optional: = default (and below)
msw 2017/05/04 19:05:56 Doneish, it works for the empty-arg default ctor a
AppLaunchId::AppLaunchId() {}
AppLaunchId::~AppLaunchId() {}
+bool AppLaunchId::operator==(const AppLaunchId& other) const {
+ return app_id_ == other.app_id_ && launch_id_ == other.launch_id_;
+}
+
+bool AppLaunchId::operator!=(const AppLaunchId& other) const {
+ return !(*this == other);
+}
+
+bool AppLaunchId::operator<(const AppLaunchId& other) const {
+ return app_id_ < other.app_id_ ||
+ (app_id_ == other.app_id_ && launch_id_ < other.launch_id_);
+}
+
+bool AppLaunchId::IsEmpty() const {
+ return app_id_.empty() && launch_id_.empty();
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698