OLD | NEW |
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/metrics/user_metrics_recorder_proxy.h" |
7 #include "ash/session/session_state_delegate.h" | 8 #include "ash/session/session_state_delegate.h" |
8 #include "ash/shelf/shelf_delegate.h" | 9 #include "ash/shelf/shelf_delegate.h" |
9 #include "ash/shelf/shelf_item_types.h" | 10 #include "ash/shelf/shelf_item_types.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
11 #include "ash/shelf/shelf_model.h" | 12 #include "ash/shelf/shelf_model.h" |
12 #include "ash/shelf/shelf_view.h" | 13 #include "ash/shelf/shelf_view.h" |
13 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/shell_delegate.h" |
15 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
16 #include "ash/system/tray/system_tray_delegate.h" | 18 #include "ash/system/tray/system_tray_delegate.h" |
17 #include "ash/wm/window_state.h" | 19 #include "ash/wm/window_state.h" |
18 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
19 #include "base/metrics/user_metrics.h" | 21 #include "base/metrics/user_metrics.h" |
20 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
21 | 23 |
22 namespace ash { | 24 namespace ash { |
23 | 25 |
24 namespace { | 26 namespace { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfItems", | 177 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfItems", |
176 pinned_item_count + unpinned_item_count); | 178 pinned_item_count + unpinned_item_count); |
177 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfPinnedItems", pinned_item_count); | 179 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfPinnedItems", pinned_item_count); |
178 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfUnpinnedItems", | 180 UMA_HISTOGRAM_COUNTS_100("Ash.Shelf.NumberOfUnpinnedItems", |
179 unpinned_item_count); | 181 unpinned_item_count); |
180 } | 182 } |
181 | 183 |
182 } // namespace | 184 } // namespace |
183 | 185 |
184 UserMetricsRecorder::UserMetricsRecorder() { | 186 UserMetricsRecorder::UserMetricsRecorder() { |
185 StartTimer(); | 187 Init(true); |
186 } | 188 } |
187 | 189 |
188 UserMetricsRecorder::UserMetricsRecorder(bool record_periodic_metrics) { | 190 UserMetricsRecorder::UserMetricsRecorder(bool record_periodic_metrics) { |
| 191 Init(record_periodic_metrics); |
| 192 } |
| 193 |
| 194 void UserMetricsRecorder::Init(bool record_periodic_metrics) { |
| 195 user_metrics_recorder_proxy_.reset( |
| 196 ash::Shell::GetInstance()->delegate()->CreateUserMetricsRecorderProxy()); |
189 if (record_periodic_metrics) | 197 if (record_periodic_metrics) |
190 StartTimer(); | 198 StartTimer(); |
191 } | 199 } |
192 | 200 |
193 UserMetricsRecorder::~UserMetricsRecorder() { | 201 UserMetricsRecorder::~UserMetricsRecorder() { |
194 timer_.Stop(); | 202 timer_.Stop(); |
195 } | 203 } |
196 | 204 |
197 void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) { | 205 void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) { |
198 switch (action) { | 206 switch (action) { |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 return IsUserActive() && !IsKioskModeActive(); | 639 return IsUserActive() && !IsKioskModeActive(); |
632 } | 640 } |
633 | 641 |
634 void UserMetricsRecorder::StartTimer() { | 642 void UserMetricsRecorder::StartTimer() { |
635 timer_.Start(FROM_HERE, | 643 timer_.Start(FROM_HERE, |
636 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 644 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
637 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 645 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
638 } | 646 } |
639 | 647 |
640 } // namespace ash | 648 } // namespace ash |
OLD | NEW |