| 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/shelf/shelf_item_types.h" | 7 #include "ash/common/shelf/shelf_item_types.h" |
| 8 #include "ash/common/shelf/shelf_model.h" | 8 #include "ash/common/shelf/shelf_model.h" |
| 9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_OTHER; | 67 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_OTHER; |
| 68 break; | 68 break; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 return active_window_state_type; | 71 return active_window_state_type; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Returns true if kiosk mode is active. | 74 // Returns true if kiosk mode is active. |
| 75 bool IsKioskModeActive() { | 75 bool IsKioskModeActive() { |
| 76 return Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() == | 76 return Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() == |
| 77 user::LOGGED_IN_KIOSK_APP; | 77 LoginStatus::KIOSK_APP; |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Returns true if there is an active user and their session isn't currently | 80 // Returns true if there is an active user and their session isn't currently |
| 81 // locked. | 81 // locked. |
| 82 bool IsUserActive() { | 82 bool IsUserActive() { |
| 83 switch (Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus()) { | 83 switch (Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus()) { |
| 84 case user::LOGGED_IN_NONE: | 84 case LoginStatus::NOT_LOGGED_IN: |
| 85 case user::LOGGED_IN_LOCKED: | 85 case LoginStatus::LOCKED: |
| 86 return false; | 86 return false; |
| 87 case user::LOGGED_IN_USER: | 87 case LoginStatus::USER: |
| 88 case user::LOGGED_IN_OWNER: | 88 case LoginStatus::OWNER: |
| 89 case user::LOGGED_IN_GUEST: | 89 case LoginStatus::GUEST: |
| 90 case user::LOGGED_IN_PUBLIC: | 90 case LoginStatus::PUBLIC: |
| 91 case user::LOGGED_IN_SUPERVISED: | 91 case LoginStatus::SUPERVISED: |
| 92 case user::LOGGED_IN_KIOSK_APP: | 92 case LoginStatus::KIOSK_APP: |
| 93 return true; | 93 return true; |
| 94 } | 94 } |
| 95 NOTREACHED(); | 95 NOTREACHED(); |
| 96 return false; | 96 return false; |
| 97 } | 97 } |
| 98 | 98 |
| 99 // Array of window container ids that contain visible windows to be counted for | 99 // Array of window container ids that contain visible windows to be counted for |
| 100 // UMA statistics. Note the containers are ordered from top most visible | 100 // UMA statistics. Note the containers are ordered from top most visible |
| 101 // container to the lowest to allow the |GetNumVisibleWindows| method to short | 101 // container to the lowest to allow the |GetNumVisibleWindows| method to short |
| 102 // circuit when processing a maximized or fullscreen window. | 102 // circuit when processing a maximized or fullscreen window. |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 return IsUserActive() && !IsKioskModeActive(); | 660 return IsUserActive() && !IsKioskModeActive(); |
| 661 } | 661 } |
| 662 | 662 |
| 663 void UserMetricsRecorder::StartTimer() { | 663 void UserMetricsRecorder::StartTimer() { |
| 664 timer_.Start(FROM_HERE, | 664 timer_.Start(FROM_HERE, |
| 665 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 665 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
| 666 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 666 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
| 667 } | 667 } |
| 668 | 668 |
| 669 } // namespace ash | 669 } // namespace ash |
| OLD | NEW |