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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ash/public/cpp/shelf_types.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "ash/public/cpp/shelf_types.h" 5 #include "ash/public/cpp/shelf_types.h"
6 6
7 #include "base/logging.h"
8
7 namespace ash { 9 namespace ash {
8 10
9 bool IsValidShelfItemType(int64_t type) { 11 bool IsValidShelfItemType(int64_t type) {
10 return type == TYPE_APP_PANEL || type == TYPE_PINNED_APP || 12 return type == TYPE_APP_PANEL || type == TYPE_PINNED_APP ||
11 type == TYPE_APP_LIST || type == TYPE_BROWSER_SHORTCUT || 13 type == TYPE_APP_LIST || type == TYPE_BROWSER_SHORTCUT ||
12 type == TYPE_APP || type == TYPE_DIALOG || type == TYPE_UNDEFINED; 14 type == TYPE_APP || type == TYPE_DIALOG || type == TYPE_UNDEFINED;
13 } 15 }
14 16
17 ShelfID::ShelfID(const std::string& app_id, const std::string& launch_id)
18 : app_id(app_id), launch_id(launch_id) {
19 DCHECK(launch_id.empty() || !app_id.empty()) << "launch ids require app ids.";
20 }
21
22 ShelfID::~ShelfID() = default;
23
24 ShelfID::ShelfID(const ShelfID& other) = default;
25
26 ShelfID::ShelfID(ShelfID&& other) = default;
27
28 ShelfID& ShelfID::operator=(const ShelfID& other) = default;
29
30 bool ShelfID::operator==(const ShelfID& other) const {
31 return app_id == other.app_id && launch_id == other.launch_id;
32 }
33
34 bool ShelfID::operator!=(const ShelfID& other) const {
35 return !(*this == other);
36 }
37
38 bool ShelfID::operator<(const ShelfID& other) const {
39 return app_id < other.app_id ||
40 (app_id == other.app_id && launch_id < other.launch_id);
41 }
42
43 bool ShelfID::IsNull() const {
44 return app_id.empty() && launch_id.empty();
45 }
46
15 } // namespace ash 47 } // namespace ash
OLDNEW
« 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