OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 const char kNumItemsEnabledHistogramName[] = | 15 const char kNumItemsEnabledHistogramName[] = |
15 "Ash.Shelf.Menu.NumItemsEnabledUponSelection"; | 16 "Ash.Shelf.Menu.NumItemsEnabledUponSelection"; |
16 | 17 |
17 const char kSelectedMenuItemIndexHistogramName[] = | 18 const char kSelectedMenuItemIndexHistogramName[] = |
18 "Ash.Shelf.Menu.SelectedMenuItemIndex"; | 19 "Ash.Shelf.Menu.SelectedMenuItemIndex"; |
19 | 20 |
20 } // namespace | 21 } // namespace |
21 | 22 |
22 LauncherApplicationMenuItemModel::LauncherApplicationMenuItemModel( | 23 LauncherApplicationMenuItemModel::LauncherApplicationMenuItemModel( |
23 ChromeLauncherAppMenuItems item_list) | 24 ChromeLauncherAppMenuItems item_list) |
24 : ash::ShelfMenuModel(this), | 25 : ash::ShelfMenuModel(this), launcher_items_(std::move(item_list)) { |
25 launcher_items_(item_list.Pass()) { | |
26 Build(); | 26 Build(); |
27 } | 27 } |
28 | 28 |
29 LauncherApplicationMenuItemModel::~LauncherApplicationMenuItemModel() { | 29 LauncherApplicationMenuItemModel::~LauncherApplicationMenuItemModel() { |
30 } | 30 } |
31 | 31 |
32 bool LauncherApplicationMenuItemModel::IsCommandActive(int command_id) const { | 32 bool LauncherApplicationMenuItemModel::IsCommandActive(int command_id) const { |
33 DCHECK(command_id >= 0); | 33 DCHECK(command_id >= 0); |
34 DCHECK(static_cast<size_t>(command_id) < launcher_items_.size()); | 34 DCHECK(static_cast<size_t>(command_id) < launcher_items_.size()); |
35 return launcher_items_[command_id]->IsActive(); | 35 return launcher_items_[command_id]->IsActive(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return num_menu_items_enabled; | 89 return num_menu_items_enabled; |
90 } | 90 } |
91 | 91 |
92 void LauncherApplicationMenuItemModel::RecordMenuItemSelectedMetrics( | 92 void LauncherApplicationMenuItemModel::RecordMenuItemSelectedMetrics( |
93 int command_id, | 93 int command_id, |
94 int num_menu_items_enabled) { | 94 int num_menu_items_enabled) { |
95 UMA_HISTOGRAM_COUNTS_100(kSelectedMenuItemIndexHistogramName, command_id); | 95 UMA_HISTOGRAM_COUNTS_100(kSelectedMenuItemIndexHistogramName, command_id); |
96 UMA_HISTOGRAM_COUNTS_100(kNumItemsEnabledHistogramName, | 96 UMA_HISTOGRAM_COUNTS_100(kNumItemsEnabledHistogramName, |
97 num_menu_items_enabled); | 97 num_menu_items_enabled); |
98 } | 98 } |
OLD | NEW |