OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/app_list_shelf_item_delegate.h" | 5 #include "ash/shelf/app_list_shelf_item_delegate.h" |
6 | 6 |
7 #include <utility> | |
8 | |
7 #include "ash/shelf/shelf_model.h" | 9 #include "ash/shelf/shelf_model.h" |
8 #include "ash/shell.h" | 10 #include "ash/shell.h" |
9 #include "ash/strings/grit/ash_strings.h" | 11 #include "ash/strings/grit/ash_strings.h" |
10 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
11 #include "ui/app_list/app_list_switches.h" | 13 #include "ui/app_list/app_list_switches.h" |
12 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
13 | 15 |
14 namespace ash { | 16 namespace ash { |
15 | 17 |
16 namespace { | 18 namespace { |
(...skipping 17 matching lines...) Expand all Loading... | |
34 // Create an AppListShelfItemDelegate for that item. | 36 // Create an AppListShelfItemDelegate for that item. |
35 model->SetShelfItemDelegate(item.id, | 37 model->SetShelfItemDelegate(item.id, |
36 base::MakeUnique<AppListShelfItemDelegate>()); | 38 base::MakeUnique<AppListShelfItemDelegate>()); |
37 } | 39 } |
38 | 40 |
39 AppListShelfItemDelegate::AppListShelfItemDelegate() | 41 AppListShelfItemDelegate::AppListShelfItemDelegate() |
40 : ShelfItemDelegate(ShelfID(kAppListId)) {} | 42 : ShelfItemDelegate(ShelfID(kAppListId)) {} |
41 | 43 |
42 AppListShelfItemDelegate::~AppListShelfItemDelegate() {} | 44 AppListShelfItemDelegate::~AppListShelfItemDelegate() {} |
43 | 45 |
44 void AppListShelfItemDelegate::ItemSelected( | 46 void AppListShelfItemDelegate::ItemSelected(std::unique_ptr<ui::Event> event, |
45 std::unique_ptr<ui::Event> event, | 47 int64_t display_id, |
46 int64_t display_id, | 48 ShelfLaunchSource source, |
47 ShelfLaunchSource source, | 49 ItemSelectedCallback callback) { |
48 const ItemSelectedCallback& callback) { | |
49 Shell::Get()->ToggleAppList(); | 50 Shell::Get()->ToggleAppList(); |
50 callback.Run(SHELF_ACTION_APP_LIST_SHOWN, base::nullopt); | 51 std::move(callback).Run(SHELF_ACTION_APP_LIST_SHOWN, base::nullopt); |
James Cook
2017/05/09 18:30:40
Aside: I know this decision has already been made,
tzik
2017/05/11 08:15:20
Yes, it's very helpful. Kudos goes to dcheng.
| |
51 } | 52 } |
52 | 53 |
53 void AppListShelfItemDelegate::ExecuteCommand(uint32_t command_id, | 54 void AppListShelfItemDelegate::ExecuteCommand(uint32_t command_id, |
54 int32_t event_flags) { | 55 int32_t event_flags) { |
55 // This delegate does not support showing an application menu. | 56 // This delegate does not support showing an application menu. |
56 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
57 } | 58 } |
58 | 59 |
59 void AppListShelfItemDelegate::Close() {} | 60 void AppListShelfItemDelegate::Close() {} |
60 | 61 |
61 } // namespace ash | 62 } // namespace ash |
OLD | NEW |