Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: ash/metrics/user_metrics_recorder.cc

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Yet another Rebase ... Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_item_types.h" 10 #include "ash/common/shelf/shelf_item_types.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // Time in seconds between calls to "RecordPeriodicMetrics". 31 // Time in seconds between calls to "RecordPeriodicMetrics".
32 const int kAshPeriodicMetricsTimeInSeconds = 30 * 60; 32 const int kAshPeriodicMetricsTimeInSeconds = 30 * 60;
33 33
34 enum ActiveWindowStateType { 34 enum ActiveWindowStateType {
35 ACTIVE_WINDOW_STATE_TYPE_NO_ACTIVE_WINDOW, 35 ACTIVE_WINDOW_STATE_TYPE_NO_ACTIVE_WINDOW,
36 ACTIVE_WINDOW_STATE_TYPE_OTHER, 36 ACTIVE_WINDOW_STATE_TYPE_OTHER,
37 ACTIVE_WINDOW_STATE_TYPE_MAXIMIZED, 37 ACTIVE_WINDOW_STATE_TYPE_MAXIMIZED,
38 ACTIVE_WINDOW_STATE_TYPE_FULLSCREEN, 38 ACTIVE_WINDOW_STATE_TYPE_FULLSCREEN,
39 ACTIVE_WINDOW_STATE_TYPE_SNAPPED, 39 ACTIVE_WINDOW_STATE_TYPE_SNAPPED,
40 ACTIVE_WINDOW_STATE_TYPE_DOCKED,
41 ACTIVE_WINDOW_STATE_TYPE_PINNED, 40 ACTIVE_WINDOW_STATE_TYPE_PINNED,
42 ACTIVE_WINDOW_STATE_TYPE_TRUSTED_PINNED, 41 ACTIVE_WINDOW_STATE_TYPE_TRUSTED_PINNED,
43 ACTIVE_WINDOW_STATE_TYPE_COUNT, 42 ACTIVE_WINDOW_STATE_TYPE_COUNT,
44 }; 43 };
45 44
46 ActiveWindowStateType GetActiveWindowState() { 45 ActiveWindowStateType GetActiveWindowState() {
47 ActiveWindowStateType active_window_state_type = 46 ActiveWindowStateType active_window_state_type =
48 ACTIVE_WINDOW_STATE_TYPE_NO_ACTIVE_WINDOW; 47 ACTIVE_WINDOW_STATE_TYPE_NO_ACTIVE_WINDOW;
49 wm::WindowState* active_window_state = ash::wm::GetActiveWindowState(); 48 wm::WindowState* active_window_state = ash::wm::GetActiveWindowState();
50 if (active_window_state) { 49 if (active_window_state) {
51 switch (active_window_state->GetStateType()) { 50 switch (active_window_state->GetStateType()) {
52 case wm::WINDOW_STATE_TYPE_MAXIMIZED: 51 case wm::WINDOW_STATE_TYPE_MAXIMIZED:
53 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_MAXIMIZED; 52 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_MAXIMIZED;
54 break; 53 break;
55 case wm::WINDOW_STATE_TYPE_FULLSCREEN: 54 case wm::WINDOW_STATE_TYPE_FULLSCREEN:
56 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_FULLSCREEN; 55 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_FULLSCREEN;
57 break; 56 break;
58 case wm::WINDOW_STATE_TYPE_LEFT_SNAPPED: 57 case wm::WINDOW_STATE_TYPE_LEFT_SNAPPED:
59 case wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED: 58 case wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED:
60 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_SNAPPED; 59 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_SNAPPED;
61 break; 60 break;
62 case wm::WINDOW_STATE_TYPE_DOCKED:
63 case wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED:
64 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_DOCKED;
65 break;
66 case wm::WINDOW_STATE_TYPE_PINNED: 61 case wm::WINDOW_STATE_TYPE_PINNED:
67 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_PINNED; 62 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_PINNED;
68 break; 63 break;
69 case wm::WINDOW_STATE_TYPE_TRUSTED_PINNED: 64 case wm::WINDOW_STATE_TYPE_TRUSTED_PINNED:
70 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_TRUSTED_PINNED; 65 active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_TRUSTED_PINNED;
71 break; 66 break;
72 case wm::WINDOW_STATE_TYPE_DEFAULT: 67 case wm::WINDOW_STATE_TYPE_DEFAULT:
73 case wm::WINDOW_STATE_TYPE_NORMAL: 68 case wm::WINDOW_STATE_TYPE_NORMAL:
74 case wm::WINDOW_STATE_TYPE_MINIMIZED: 69 case wm::WINDOW_STATE_TYPE_MINIMIZED:
75 case wm::WINDOW_STATE_TYPE_INACTIVE: 70 case wm::WINDOW_STATE_TYPE_INACTIVE:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 108 }
114 NOTREACHED(); 109 NOTREACHED();
115 return false; 110 return false;
116 } 111 }
117 112
118 // Array of window container ids that contain visible windows to be counted for 113 // Array of window container ids that contain visible windows to be counted for
119 // UMA statistics. Note the containers are ordered from top most visible 114 // UMA statistics. Note the containers are ordered from top most visible
120 // container to the lowest to allow the |GetNumVisibleWindows| method to short 115 // container to the lowest to allow the |GetNumVisibleWindows| method to short
121 // circuit when processing a maximized or fullscreen window. 116 // circuit when processing a maximized or fullscreen window.
122 int kVisibleWindowContainerIds[] = { 117 int kVisibleWindowContainerIds[] = {
123 kShellWindowId_PanelContainer, kShellWindowId_DockedContainer, 118 kShellWindowId_PanelContainer,
124 kShellWindowId_AlwaysOnTopContainer, kShellWindowId_DefaultContainer}; 119 kShellWindowId_AlwaysOnTopContainer,
120 kShellWindowId_DefaultContainer
121 };
125 122
126 // Returns an approximate count of how many windows are currently visible in the 123 // Returns an approximate count of how many windows are currently visible in the
127 // primary root window. 124 // primary root window.
128 int GetNumVisibleWindowsInPrimaryDisplay() { 125 int GetNumVisibleWindowsInPrimaryDisplay() {
129 int visible_window_count = 0; 126 int visible_window_count = 0;
130 bool maximized_or_fullscreen_window_present = false; 127 bool maximized_or_fullscreen_window_present = false;
131 128
132 for (const int& current_container_id : kVisibleWindowContainerIds) { 129 for (const int& current_container_id : kVisibleWindowContainerIds) {
133 if (maximized_or_fullscreen_window_present) 130 if (maximized_or_fullscreen_window_present)
134 break; 131 break;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive(); 643 return IsUserActive() && !IsKioskModeActive() && !IsArcKioskModeActive();
647 } 644 }
648 645
649 void UserMetricsRecorder::StartTimer() { 646 void UserMetricsRecorder::StartTimer() {
650 timer_.Start(FROM_HERE, 647 timer_.Start(FROM_HERE,
651 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds), 648 base::TimeDelta::FromSeconds(kAshPeriodicMetricsTimeInSeconds),
652 this, &UserMetricsRecorder::RecordPeriodicMetrics); 649 this, &UserMetricsRecorder::RecordPeriodicMetrics);
653 } 650 }
654 651
655 } // namespace ash 652 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698