OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return false; | 109 return false; |
110 } | 110 } |
111 | 111 |
112 return true; | 112 return true; |
113 } | 113 } |
114 | 114 |
115 void BrowserMonitor::OnEndSession(LPARAM lparam) { | 115 void BrowserMonitor::OnEndSession(LPARAM lparam) { |
116 DCHECK_EQ(main_thread_, base::MessageLoopProxy::current()); | 116 DCHECK_EQ(main_thread_, base::MessageLoopProxy::current()); |
117 | 117 |
118 exit_funnel_.RecordEvent(L"WatcherLogoff"); | 118 exit_funnel_.RecordEvent(L"WatcherLogoff"); |
| 119 if (lparam & ENDSESSION_CLOSEAPP) |
| 120 exit_funnel_.RecordEvent(L"ES_CloseApp"); |
| 121 if (lparam & ENDSESSION_CRITICAL) |
| 122 exit_funnel_.RecordEvent(L"ES_Critical"); |
| 123 if (lparam & ENDSESSION_LOGOFF) |
| 124 exit_funnel_.RecordEvent(L"ES_Logoff"); |
| 125 const LPARAM kKnownBits = |
| 126 ENDSESSION_CLOSEAPP | ENDSESSION_CRITICAL | ENDSESSION_LOGOFF; |
| 127 if (lparam & ~kKnownBits) |
| 128 exit_funnel_.RecordEvent(L"ES_Other"); |
119 | 129 |
120 // Belt-and-suspenders; make sure our message loop exits ASAP. | 130 // Belt-and-suspenders; make sure our message loop exits ASAP. |
121 if (browser_exited_) | 131 if (browser_exited_) |
122 run_loop_->Quit(); | 132 run_loop_->Quit(); |
123 } | 133 } |
124 | 134 |
125 void BrowserMonitor::Watch() { | 135 void BrowserMonitor::Watch() { |
126 // This needs to run on an IO thread. | 136 // This needs to run on an IO thread. |
127 DCHECK_NE(main_thread_, base::MessageLoopProxy::current()); | 137 DCHECK_NE(main_thread_, base::MessageLoopProxy::current()); |
128 | 138 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 199 |
190 // Wind logging down. | 200 // Wind logging down. |
191 logging::LogEventProvider::Uninitialize(); | 201 logging::LogEventProvider::Uninitialize(); |
192 | 202 |
193 return 0; | 203 return 0; |
194 } | 204 } |
195 | 205 |
196 static_assert(base::is_same<decltype(&WatcherMain), | 206 static_assert(base::is_same<decltype(&WatcherMain), |
197 browser_watcher::WatcherMainFunction>::value, | 207 browser_watcher::WatcherMainFunction>::value, |
198 "WatcherMain() has wrong type"); | 208 "WatcherMain() has wrong type"); |
OLD | NEW |