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

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

Issue 2177663002: mash: Move ownership of ShelfDelegate to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix wallpaper tests again 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/common/wm_shell.cc ('k') | ash/shelf/shelf.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/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_delegate.h"
8 #include "ash/common/shelf/shelf_item_types.h" 9 #include "ash/common/shelf/shelf_item_types.h"
9 #include "ash/common/shelf/shelf_model.h" 10 #include "ash/common/shelf/shelf_model.h"
10 #include "ash/common/shell_window_ids.h" 11 #include "ash/common/shell_window_ids.h"
11 #include "ash/common/system/tray/system_tray_delegate.h" 12 #include "ash/common/system/tray/system_tray_delegate.h"
12 #include "ash/common/wm/window_state.h" 13 #include "ash/common/wm/window_state.h"
13 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
14 #include "ash/metrics/desktop_task_switch_metric_recorder.h" 15 #include "ash/metrics/desktop_task_switch_metric_recorder.h"
15 #include "ash/shelf/shelf.h" 16 #include "ash/shelf/shelf.h"
16 #include "ash/shelf/shelf_delegate.h"
17 #include "ash/shelf/shelf_view.h" 17 #include "ash/shelf/shelf_view.h"
18 #include "ash/shell.h" 18 #include "ash/shell.h"
19 #include "ash/wm/window_state_aura.h" 19 #include "ash/wm/window_state_aura.h"
20 #include "base/metrics/histogram.h" 20 #include "base/metrics/histogram.h"
21 #include "base/metrics/user_metrics.h" 21 #include "base/metrics/user_metrics.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 23
24 namespace ash { 24 namespace ash {
25 25
26 namespace { 26 namespace {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 maximized_or_fullscreen_window_present = true; 150 maximized_or_fullscreen_window_present = true;
151 break; 151 break;
152 } 152 }
153 } 153 }
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 = WmShell::Get()->shelf_delegate();
161 DCHECK(shelf_delegate);
162
161 int pinned_item_count = 0; 163 int pinned_item_count = 0;
162 int unpinned_item_count = 0; 164 int unpinned_item_count = 0;
163 165
164 for (const ShelfItem& shelf_item : WmShell::Get()->shelf_model()->items()) { 166 for (const ShelfItem& shelf_item : WmShell::Get()->shelf_model()->items()) {
165 if (shelf_item.type != TYPE_APP_LIST) { 167 if (shelf_item.type != TYPE_APP_LIST) {
166 // Internal ash apps do not have an app id and thus will always be counted 168 // Internal ash apps do not have an app id and thus will always be counted
167 // as unpinned. 169 // as unpinned.
168 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) && 170 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) &&
169 shelf_delegate->IsAppPinned( 171 shelf_delegate->IsAppPinned(
170 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) { 172 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) {
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 return IsUserActive() && !IsKioskModeActive(); 626 return IsUserActive() && !IsKioskModeActive();
625 } 627 }
626 628
627 void UserMetricsRecorder::StartTimer() { 629 void UserMetricsRecorder::StartTimer() {
628 timer_.Start(FROM_HERE, 630 timer_.Start(FROM_HERE,
629 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 631 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
630 this, &UserMetricsRecorder::RecordPeriodicMetrics); 632 this, &UserMetricsRecorder::RecordPeriodicMetrics);
631 } 633 }
632 634
633 } // namespace ash 635 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_shell.cc ('k') | ash/shelf/shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698