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

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

Issue 2791803002: mash: Move LauncherItemController to ash, rename ShelfItemDelegate. (Closed)
Patch Set: Sync and rebase. Created 3 years, 8 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/common/shelf/shelf_application_menu_model.h ('k') | ash/common/shelf/shelf_model.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 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/common/shelf/shelf_application_menu_model.h" 5 #include "ash/common/shelf/shelf_application_menu_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
11 11
12 #include "ash/public/cpp/shelf_item_delegate.h"
12 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
13 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
14 15
15 namespace { 16 namespace {
16 17
17 const int kInvalidCommandId = std::numeric_limits<int>::max(); 18 const int kInvalidCommandId = std::numeric_limits<int>::max();
18 19
19 } // namespace 20 } // namespace
20 21
21 namespace ash { 22 namespace ash {
22 23
23 ShelfApplicationMenuModel::ShelfApplicationMenuModel( 24 ShelfApplicationMenuModel::ShelfApplicationMenuModel(
24 const base::string16& title, 25 const base::string16& title,
25 std::vector<mojom::MenuItemPtr> items, 26 std::vector<mojom::MenuItemPtr> items,
26 mojom::ShelfItemDelegate* delegate) 27 ShelfItemDelegate* delegate)
27 : ui::SimpleMenuModel(this), items_(std::move(items)), delegate_(delegate) { 28 : ui::SimpleMenuModel(this), items_(std::move(items)), delegate_(delegate) {
28 AddSeparator(ui::SPACING_SEPARATOR); 29 AddSeparator(ui::SPACING_SEPARATOR);
29 AddItem(kInvalidCommandId, title); 30 AddItem(kInvalidCommandId, title);
30 AddSeparator(ui::SPACING_SEPARATOR); 31 AddSeparator(ui::SPACING_SEPARATOR);
31 32
32 for (size_t i = 0; i < items_.size(); i++) { 33 for (size_t i = 0; i < items_.size(); i++) {
33 mojom::MenuItem* item = items_[i].get(); 34 mojom::MenuItem* item = items_[i].get();
34 AddItem(i, item->label); 35 AddItem(i, item->label);
35 if (!item->image.isNull()) { 36 if (!item->image.isNull()) {
36 SetIcon(GetIndexOfCommandId(i), 37 SetIcon(GetIndexOfCommandId(i),
(...skipping 28 matching lines...) Expand all
65 66
66 void ShelfApplicationMenuModel::RecordMenuItemSelectedMetrics( 67 void ShelfApplicationMenuModel::RecordMenuItemSelectedMetrics(
67 int command_id, 68 int command_id,
68 int num_menu_items_enabled) { 69 int num_menu_items_enabled) {
69 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.Menu.SelectedMenuItemIndex", command_id); 70 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.Menu.SelectedMenuItemIndex", command_id);
70 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.Menu.NumItemsEnabledUponSelection", 71 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.Menu.NumItemsEnabledUponSelection",
71 num_menu_items_enabled); 72 num_menu_items_enabled);
72 } 73 }
73 74
74 } // namespace ash 75 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_application_menu_model.h ('k') | ash/common/shelf/shelf_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698