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

Side by Side Diff: ash/common/shelf/app_list_shelf_item_delegate.cc

Issue 2750463009: mash: Fix ShelfItem mojo struct; add enums and traits. (Closed)
Patch Set: Address comment. Created 3 years, 9 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/BUILD.gn ('k') | ash/common/shelf/shelf_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/shelf/app_list_shelf_item_delegate.h" 5 #include "ash/common/shelf/app_list_shelf_item_delegate.h"
6 6
7 #include "ash/common/shelf/shelf_model.h" 7 #include "ash/common/shelf/shelf_model.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/strings/grit/ash_strings.h" 9 #include "ash/strings/grit/ash_strings.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "ui/app_list/app_list_switches.h" 11 #include "ui/app_list/app_list_switches.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 13
14 namespace ash { 14 namespace ash {
15 15
16 // static 16 // static
17 void AppListShelfItemDelegate::CreateAppListItemAndDelegate(ShelfModel* model) { 17 void AppListShelfItemDelegate::CreateAppListItemAndDelegate(ShelfModel* model) {
18 // Add the app list item to the shelf model. 18 // Add the app list item to the shelf model.
19 ShelfItem item; 19 ShelfItem item;
20 item.type = TYPE_APP_LIST; 20 item.type = TYPE_APP_LIST;
21 item.title = l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE); 21 item.title = l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE);
22 int index = model->Add(item); 22 int index = model->Add(item);
23 DCHECK_GE(index, 0); 23 DCHECK_GE(index, 0);
24 24
25 // Create an AppListShelfItemDelegate for that item. 25 // Create an AppListShelfItemDelegate for that item.
26 ShelfID id = model->items()[index].id; 26 ShelfID id = model->items()[index].id;
27 DCHECK_GE(id, 0); 27 DCHECK_NE(id, kInvalidShelfID);
28 model->SetShelfItemDelegate(id, base::MakeUnique<AppListShelfItemDelegate>()); 28 model->SetShelfItemDelegate(id, base::MakeUnique<AppListShelfItemDelegate>());
29 } 29 }
30 30
31 AppListShelfItemDelegate::AppListShelfItemDelegate() {} 31 AppListShelfItemDelegate::AppListShelfItemDelegate() {}
32 32
33 AppListShelfItemDelegate::~AppListShelfItemDelegate() {} 33 AppListShelfItemDelegate::~AppListShelfItemDelegate() {}
34 34
35 void AppListShelfItemDelegate::ItemSelected( 35 void AppListShelfItemDelegate::ItemSelected(
36 std::unique_ptr<ui::Event> event, 36 std::unique_ptr<ui::Event> event,
37 int64_t display_id, 37 int64_t display_id,
38 ShelfLaunchSource source, 38 ShelfLaunchSource source,
39 const ItemSelectedCallback& callback) { 39 const ItemSelectedCallback& callback) {
40 Shell::Get()->ToggleAppList(); 40 Shell::Get()->ToggleAppList();
41 callback.Run(SHELF_ACTION_APP_LIST_SHOWN, base::nullopt); 41 callback.Run(SHELF_ACTION_APP_LIST_SHOWN, base::nullopt);
42 } 42 }
43 43
44 void AppListShelfItemDelegate::ExecuteCommand(uint32_t command_id, 44 void AppListShelfItemDelegate::ExecuteCommand(uint32_t command_id,
45 int32_t event_flags) { 45 int32_t event_flags) {
46 // This delegate does not support showing an application menu. 46 // This delegate does not support showing an application menu.
47 NOTIMPLEMENTED(); 47 NOTIMPLEMENTED();
48 } 48 }
49 49
50 void AppListShelfItemDelegate::Close() {} 50 void AppListShelfItemDelegate::Close() {}
51 51
52 } // namespace ash 52 } // namespace ash
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/common/shelf/shelf_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698