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

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

Issue 1070693002: Partial revert of "Added metrics to count the number of items in the shelf." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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/shelf/shelf_delegate.h"
8 #include "ash/shelf/shelf_item_types.h"
9 #include "ash/shelf/shelf_layout_manager.h" 7 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_model.h"
11 #include "ash/shelf/shelf_view.h" 8 #include "ash/shelf/shelf_view.h"
12 #include "ash/shelf/shelf_widget.h" 9 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 10 #include "ash/shell.h"
14 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
15 #include "ash/wm/window_state.h" 12 #include "ash/wm/window_state.h"
16 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
17 #include "base/metrics/user_metrics.h" 14 #include "base/metrics/user_metrics.h"
18 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
19 16
20 namespace ash { 17 namespace ash {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 kShellWindowId_AlwaysOnTopContainer == current_container_id) && 114 kShellWindowId_AlwaysOnTopContainer == current_container_id) &&
118 child_window_state->IsMaximizedOrFullscreen()) { 115 child_window_state->IsMaximizedOrFullscreen()) {
119 maximized_or_fullscreen_window_present = true; 116 maximized_or_fullscreen_window_present = true;
120 break; 117 break;
121 } 118 }
122 } 119 }
123 } 120 }
124 return visible_window_count; 121 return visible_window_count;
125 } 122 }
126 123
127 void RecordShelfItemCounts() {
128 ShelfDelegate* shelf_delegate = Shell::GetInstance()->GetShelfDelegate();
129 int pinned_item_count = 0;
130 int unpinned_item_count = 0;
131
132 for (const ShelfItem& shelf_item :
133 Shell::GetInstance()->shelf_model()->items()) {
134 if (shelf_item.type != TYPE_APP_LIST) {
135 if (shelf_delegate->IsAppPinned(
136 shelf_delegate->GetAppIDForShelfID(shelf_item.id)))
137 ++pinned_item_count;
138 else
139 ++unpinned_item_count;
140 }
141 }
142
143 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfItems",
144 pinned_item_count + unpinned_item_count);
145 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfPinnedItems", pinned_item_count);
146 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfUnpinnedItems",
147 unpinned_item_count);
148 }
149
150 } // namespace 124 } // namespace
151 125
152 UserMetricsRecorder::UserMetricsRecorder() { 126 UserMetricsRecorder::UserMetricsRecorder() {
153 timer_.Start(FROM_HERE, 127 timer_.Start(FROM_HERE,
154 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 128 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
155 this, 129 this,
156 &UserMetricsRecorder::RecordPeriodicMetrics); 130 &UserMetricsRecorder::RecordPeriodicMetrics);
157 } 131 }
158 132
159 UserMetricsRecorder::~UserMetricsRecorder() { 133 UserMetricsRecorder::~UserMetricsRecorder() {
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 -1), 528 -1),
555 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT); 529 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT);
556 } 530 }
557 531
558 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay", 532 UMA_HISTOGRAM_COUNTS_100("Ash.NumberOfVisibleWindowsInPrimaryDisplay",
559 GetNumVisibleWindowsInPrimaryDisplay()); 533 GetNumVisibleWindowsInPrimaryDisplay());
560 534
561 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime", 535 UMA_HISTOGRAM_ENUMERATION("Ash.ActiveWindowShowTypeOverTime",
562 GetActiveWindowState(), 536 GetActiveWindowState(),
563 ACTIVE_WINDOW_STATE_TYPE_COUNT); 537 ACTIVE_WINDOW_STATE_TYPE_COUNT);
564
565 RecordShelfItemCounts();
566 } 538 }
567 539
568 } // namespace ash 540 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698