| 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_item_types.h" | 8 #include "ash/common/shelf/shelf_item_types.h" |
| 9 #include "ash/common/shelf/shelf_model.h" | 9 #include "ash/common/shelf/shelf_model.h" |
| 10 #include "ash/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| 11 #include "ash/common/system/tray/system_tray_delegate.h" | 11 #include "ash/common/system/tray/system_tray_delegate.h" |
| 12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm/wm_user_metrics_action.h" | 13 #include "ash/common/wm/wm_user_metrics_action.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_delegate.h" |
| 17 #include "ash/shelf/shelf_view.h" | 18 #include "ash/shelf/shelf_view.h" |
| 18 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 19 #include "ash/wm/window_state_aura.h" | 20 #include "ash/wm/window_state_aura.h" |
| 20 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
| 21 #include "base/metrics/user_metrics.h" | 22 #include "base/metrics/user_metrics.h" |
| 22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 23 | 24 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 case wm::WINDOW_STATE_TYPE_AUTO_POSITIONED: | 67 case wm::WINDOW_STATE_TYPE_AUTO_POSITIONED: |
| 67 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_OTHER; | 68 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_OTHER; |
| 68 break; | 69 break; |
| 69 } | 70 } |
| 70 } | 71 } |
| 71 return active_window_state_type; | 72 return active_window_state_type; |
| 72 } | 73 } |
| 73 | 74 |
| 74 // Returns true if kiosk mode is active. | 75 // Returns true if kiosk mode is active. |
| 75 bool IsKioskModeActive() { | 76 bool IsKioskModeActive() { |
| 76 return Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus() == | 77 return WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() == |
| 77 LoginStatus::KIOSK_APP; | 78 LoginStatus::KIOSK_APP; |
| 78 } | 79 } |
| 79 | 80 |
| 80 // Returns true if there is an active user and their session isn't currently | 81 // Returns true if there is an active user and their session isn't currently |
| 81 // locked. | 82 // locked. |
| 82 bool IsUserActive() { | 83 bool IsUserActive() { |
| 83 switch (Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus()) { | 84 switch (WmShell::Get()->system_tray_delegate()->GetUserLoginStatus()) { |
| 84 case LoginStatus::NOT_LOGGED_IN: | 85 case LoginStatus::NOT_LOGGED_IN: |
| 85 case LoginStatus::LOCKED: | 86 case LoginStatus::LOCKED: |
| 86 return false; | 87 return false; |
| 87 case LoginStatus::USER: | 88 case LoginStatus::USER: |
| 88 case LoginStatus::OWNER: | 89 case LoginStatus::OWNER: |
| 89 case LoginStatus::GUEST: | 90 case LoginStatus::GUEST: |
| 90 case LoginStatus::PUBLIC: | 91 case LoginStatus::PUBLIC: |
| 91 case LoginStatus::SUPERVISED: | 92 case LoginStatus::SUPERVISED: |
| 92 case LoginStatus::KIOSK_APP: | 93 case LoginStatus::KIOSK_APP: |
| 93 return true; | 94 return true; |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 return IsUserActive() && !IsKioskModeActive(); | 658 return IsUserActive() && !IsKioskModeActive(); |
| 658 } | 659 } |
| 659 | 660 |
| 660 void UserMetricsRecorder::StartTimer() { | 661 void UserMetricsRecorder::StartTimer() { |
| 661 timer_.Start(FROM_HERE, | 662 timer_.Start(FROM_HERE, |
| 662 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), | 663 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), |
| 663 this, &UserMetricsRecorder::RecordPeriodicMetrics); | 664 this, &UserMetricsRecorder::RecordPeriodicMetrics); |
| 664 } | 665 } |
| 665 | 666 |
| 666 } // namespace ash | 667 } // namespace ash |
| OLD | NEW |