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

Side by Side Diff: ash/metrics/user_metrics_recorder.cc

Issue 2169533002: mash: Migrate shelf app list button to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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/first_run/first_run_helper_impl.cc ('k') | ash/metrics/user_metrics_recorder_unittest.cc » ('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/metrics/user_metrics_recorder.h" 5 #include "ash/metrics/user_metrics_recorder.h"
6 6
7 #include "ash/common/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/shelf/shelf_item_types.h" 8 #include "ash/common/shelf/shelf_item_types.h"
9 #include "ash/common/shelf/shelf_model.h" 9 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 return visible_window_count; 155 return visible_window_count;
156 } 156 }
157 157
158 // Records the number of items in the shelf as an UMA statistic. 158 // Records the number of items in the shelf as an UMA statistic.
159 void RecordShelfItemCounts() { 159 void RecordShelfItemCounts() {
160 ShelfDelegate* shelf_delegate = Shell::GetInstance()->GetShelfDelegate(); 160 ShelfDelegate* shelf_delegate = Shell::GetInstance()->GetShelfDelegate();
161 int pinned_item_count = 0; 161 int pinned_item_count = 0;
162 int unpinned_item_count = 0; 162 int unpinned_item_count = 0;
163 163
164 for (const ShelfItem& shelf_item : 164 for (const ShelfItem& shelf_item : WmShell::Get()->shelf_model()->items()) {
165 Shell::GetInstance()->shelf_model()->items()) {
166 if (shelf_item.type != TYPE_APP_LIST) { 165 if (shelf_item.type != TYPE_APP_LIST) {
167 // Internal ash apps do not have an app id and thus will always be counted 166 // Internal ash apps do not have an app id and thus will always be counted
168 // as unpinned. 167 // as unpinned.
169 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) && 168 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) &&
170 shelf_delegate->IsAppPinned( 169 shelf_delegate->IsAppPinned(
171 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) { 170 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) {
172 ++pinned_item_count; 171 ++pinned_item_count;
173 } else { 172 } else {
174 ++unpinned_item_count; 173 ++unpinned_item_count;
175 } 174 }
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 return IsUserActive() && !IsKioskModeActive(); 624 return IsUserActive() && !IsKioskModeActive();
626 } 625 }
627 626
628 void UserMetricsRecorder::StartTimer() { 627 void UserMetricsRecorder::StartTimer() {
629 timer_.Start(FROM_HERE, 628 timer_.Start(FROM_HERE,
630 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 629 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
631 this, &UserMetricsRecorder::RecordPeriodicMetrics); 630 this, &UserMetricsRecorder::RecordPeriodicMetrics);
632 } 631 }
633 632
634 } // namespace ash 633 } // namespace ash
OLDNEW
« no previous file with comments | « ash/first_run/first_run_helper_impl.cc ('k') | ash/metrics/user_metrics_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698