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 "components/browser_watcher/exit_funnel_win.h" | 5 #include "components/browser_watcher/exit_funnel_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stdint.h> |
8 | 9 |
9 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 | 12 |
12 namespace browser_watcher { | 13 namespace browser_watcher { |
13 | 14 |
14 ExitFunnel::ExitFunnel() { | 15 ExitFunnel::ExitFunnel() { |
15 } | 16 } |
16 | 17 |
17 ExitFunnel::~ExitFunnel() { | 18 ExitFunnel::~ExitFunnel() { |
(...skipping 29 matching lines...) Expand all Loading... |
47 return false; | 48 return false; |
48 } | 49 } |
49 | 50 |
50 return true; | 51 return true; |
51 } | 52 } |
52 | 53 |
53 bool ExitFunnel::RecordEvent(const base::char16* event_name) { | 54 bool ExitFunnel::RecordEvent(const base::char16* event_name) { |
54 if (!key_.Valid()) | 55 if (!key_.Valid()) |
55 return false; | 56 return false; |
56 | 57 |
57 int64 now = base::Time::Now().ToInternalValue(); | 58 int64_t now = base::Time::Now().ToInternalValue(); |
58 | 59 |
59 LONG res = key_.WriteValue(event_name, &now, sizeof(now), REG_QWORD); | 60 LONG res = key_.WriteValue(event_name, &now, sizeof(now), REG_QWORD); |
60 if (res != ERROR_SUCCESS) { | 61 if (res != ERROR_SUCCESS) { |
61 LOG(ERROR) << "Unable to write value " << event_name << " error " << res; | 62 LOG(ERROR) << "Unable to write value " << event_name << " error " << res; |
62 return false; | 63 return false; |
63 } | 64 } |
64 | 65 |
65 return true; | 66 return true; |
66 } | 67 } |
67 | 68 |
68 bool ExitFunnel::RecordSingleEvent(const base::char16* registry_path, | 69 bool ExitFunnel::RecordSingleEvent(const base::char16* registry_path, |
69 const base::char16* event_name) { | 70 const base::char16* event_name) { |
70 ExitFunnel funnel; | 71 ExitFunnel funnel; |
71 | 72 |
72 if (!funnel.Init(registry_path, base::GetCurrentProcessHandle())) | 73 if (!funnel.Init(registry_path, base::GetCurrentProcessHandle())) |
73 return false; | 74 return false; |
74 | 75 |
75 return funnel.RecordEvent(event_name); | 76 return funnel.RecordEvent(event_name); |
76 } | 77 } |
77 | 78 |
78 } // namespace browser_watcher | 79 } // namespace browser_watcher |
OLD | NEW |