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

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

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

Powered by Google App Engine
This is Rietveld 408576698