OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_RLZ_RLZ_H__ | 5 #ifndef CHROME_BROWSER_RLZ_RLZ_H_ |
6 #define CHROME_BROWSER_RLZ_RLZ_H__ | 6 #define CHROME_BROWSER_RLZ_RLZ_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 // RLZ is a library which is used to measure distribution scenarios. | 12 // RLZ is a library which is used to measure distribution scenarios. |
13 // Its job is to record certain lifetime events in the registry and to send | 13 // Its job is to record certain lifetime events in the registry and to send |
14 // them encoded as a compact string at most once per day. The sent data does | 14 // them encoded as a compact string at most once per day. The sent data does |
15 // not contain information that can be used to identify a user or to infer | 15 // not contain information that can be used to identify a user or to infer |
16 // browsing habits. The API in this file is a wrapper to rlz.dll which can be | 16 // browsing habits. The API in this file is a wrapper to rlz.dll which can be |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }; | 62 }; |
63 | 63 |
64 // Initializes the RLZ library services. 'directory_key' indicates the base | 64 // Initializes the RLZ library services. 'directory_key' indicates the base |
65 // directory the RLZ dll would be found. For example base::DIR_CURRENT. | 65 // directory the RLZ dll would be found. For example base::DIR_CURRENT. |
66 // If the RLZ dll is not found in this directory the code falls back to try | 66 // If the RLZ dll is not found in this directory the code falls back to try |
67 // to load it from base::DIR_EXE. | 67 // to load it from base::DIR_EXE. |
68 // Returns false if the dll could not be loaded and initialized. | 68 // Returns false if the dll could not be loaded and initialized. |
69 // This function is intended primarily for testing. | 69 // This function is intended primarily for testing. |
70 static bool InitRlz(int directory_key); | 70 static bool InitRlz(int directory_key); |
71 | 71 |
72 // Like InitRlz() this function the RLZ library services for use in chrome. | 72 // Like InitRlz() this function initializes the RLZ library services for use |
73 // Besides binding the dll, it schedules a delayed task that performs the | 73 // in chrome. Besides binding the dll, it schedules a delayed task (delayed |
74 // daily ping and registers the some events when 'first-run' is true. | 74 // by |delay| seconds) that performs the daily ping and registers some events |
75 static bool InitRlzDelayed(int directory_key, bool first_run); | 75 // when 'first-run' is true. |
| 76 static bool InitRlzDelayed(int directory_key, bool first_run, int delay); |
76 | 77 |
77 // Records an RLZ event. Some events can be access point independent. | 78 // Records an RLZ event. Some events can be access point independent. |
78 // Returns false it the event could not be recorded. Requires write access | 79 // Returns false it the event could not be recorded. Requires write access |
79 // to the HKCU registry hive on windows. | 80 // to the HKCU registry hive on windows. |
80 static bool RecordProductEvent(Product product, AccessPoint point, | 81 static bool RecordProductEvent(Product product, AccessPoint point, |
81 Event event_id); | 82 Event event_id); |
82 | 83 |
83 // Get the RLZ value of the access point. | 84 // Get the RLZ value of the access point. |
84 // Returns false if the rlz string could not be obtained. In some cases | 85 // Returns false if the rlz string could not be obtained. In some cases |
85 // an empty string can be returned which is not an error. | 86 // an empty string can be returned which is not an error. |
86 static bool GetAccessPointRlz(AccessPoint point, std::wstring* rlz); | 87 static bool GetAccessPointRlz(AccessPoint point, std::wstring* rlz); |
87 | 88 |
88 // Clear all events reported by this product. In Chrome this will be called | 89 // Clear all events reported by this product. In Chrome this will be called |
89 // when it is un-installed. | 90 // when it is un-installed. |
90 static bool ClearAllProductEvents(Product product); | 91 static bool ClearAllProductEvents(Product product); |
91 | 92 |
92 // Invoked during shutdown to clean up any state created by RLZTracker. | 93 // Invoked during shutdown to clean up any state created by RLZTracker. |
93 static void CleanupRlz(); | 94 static void CleanupRlz(); |
94 | 95 |
95 private: | 96 private: |
96 DISALLOW_IMPLICIT_CONSTRUCTORS(RLZTracker); | 97 DISALLOW_IMPLICIT_CONSTRUCTORS(RLZTracker); |
97 }; | 98 }; |
98 | 99 |
99 #endif // CHROME_BROWSER_RLZ_RLZ_H__ | 100 #endif // CHROME_BROWSER_RLZ_RLZ_H_ |
OLD | NEW |