Chromium Code Reviews| 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/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 Loading... | |
| 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(); |
|
msw
2016/07/23 00:02:36
Couldn't this now be null if no shelves have calle
James Cook
2016/07/23 00:38:03
Added DCHECKs.
I thought the lazy construction be
| |
| 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 : WmShell::Get()->shelf_model()->items()) { | 164 for (const ShelfItem& shelf_item : WmShell::Get()->shelf_model()->items()) { |
| 165 if (shelf_item.type != TYPE_APP_LIST) { | 165 if (shelf_item.type != TYPE_APP_LIST) { |
| 166 // 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 |
| 167 // as unpinned. | 167 // as unpinned. |
| 168 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) && | 168 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) && |
| 169 shelf_delegate->IsAppPinned( | 169 shelf_delegate->IsAppPinned( |
| 170 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) { | 170 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 return IsUserActive() && !IsKioskModeActive(); | 624 return IsUserActive() && !IsKioskModeActive(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 void UserMetricsRecorder::StartTimer() { | 627 void UserMetricsRecorder::StartTimer() { |
| 628 timer_.Start(FROM_HERE, | 628 timer_.Start(FROM_HERE, |
| 629 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 629 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
| 630 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 630 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
| 631 } | 631 } |
| 632 | 632 |
| 633 } // namespace ash | 633 } // namespace ash |
| OLD | NEW |