| 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/metrics/pointer_metrics_recorder.h" | 7 #include "ash/common/metrics/pointer_metrics_recorder.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 maximized_or_fullscreen_window_present = true; | 162 maximized_or_fullscreen_window_present = true; |
| 163 break; | 163 break; |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 return visible_window_count; | 167 return visible_window_count; |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Records the number of items in the shelf as an UMA statistic. | 170 // Records the number of items in the shelf as an UMA statistic. |
| 171 void RecordShelfItemCounts() { | 171 void RecordShelfItemCounts() { |
| 172 ShelfDelegate* shelf_delegate = WmShell::Get()->shelf_delegate(); | 172 ShelfDelegate* shelf_delegate = Shell::Get()->shelf_delegate(); |
| 173 DCHECK(shelf_delegate); | 173 DCHECK(shelf_delegate); |
| 174 | 174 |
| 175 int pinned_item_count = 0; | 175 int pinned_item_count = 0; |
| 176 int unpinned_item_count = 0; | 176 int unpinned_item_count = 0; |
| 177 | 177 |
| 178 for (const ShelfItem& shelf_item : WmShell::Get()->shelf_model()->items()) { | 178 for (const ShelfItem& shelf_item : Shell::Get()->shelf_model()->items()) { |
| 179 if (shelf_item.type != TYPE_APP_LIST) { | 179 if (shelf_item.type != TYPE_APP_LIST) { |
| 180 // Internal ash apps do not have an app id and thus will always be counted | 180 // Internal ash apps do not have an app id and thus will always be counted |
| 181 // as unpinned. | 181 // as unpinned. |
| 182 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) && | 182 if (shelf_delegate->HasShelfIDToAppIDMapping(shelf_item.id) && |
| 183 shelf_delegate->IsAppPinned( | 183 shelf_delegate->IsAppPinned( |
| 184 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) { | 184 shelf_delegate->GetAppIDForShelfID(shelf_item.id))) { |
| 185 ++pinned_item_count; | 185 ++pinned_item_count; |
| 186 } else { | 186 } else { |
| 187 ++unpinned_item_count; | 187 ++unpinned_item_count; |
| 188 } | 188 } |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); | 641 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); |
| 642 } | 642 } |
| 643 | 643 |
| 644 void UserMetricsRecorder::StartTimer() { | 644 void UserMetricsRecorder::StartTimer() { |
| 645 timer_.Start(FROM_HERE, | 645 timer_.Start(FROM_HERE, |
| 646 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 646 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
| 647 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 647 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
| 648 } | 648 } |
| 649 | 649 |
| 650 } // namespace ash | 650 } // namespace ash |
| OLD | NEW |