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

Side by Side Diff: chrome/browser/rlz/rlz.h

Issue 2755002: Link with RLZ library from open source repo.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/rlz/rlz.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "build/build_config.h"
9
10 #if defined(OS_WIN)
11
8 #include <string> 12 #include <string>
9 13
10 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "rlz/win/lib/rlz_lib.h"
11 16
12 // RLZ is a library which is used to measure distribution scenarios. 17 // 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 18 // Its job is to record certain lifetime events in the registry and to send
14 // them encoded as a compact string at most twice. The sent data does 19 // them encoded as a compact string at most twice. The sent data does
15 // not contain information that can be used to identify a user or to infer 20 // 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 21 // browsing habits. The API in this file is a wrapper around the open source
17 // removed of the system with no adverse effects on chrome. 22 // RLZ library which can be found at http://code.google.com/p/rlz.
23 //
18 // For partner or bundled installs, the RLZ might send more information 24 // For partner or bundled installs, the RLZ might send more information
19 // according to the terms disclosed in the EULA. In the Chromium build the 25 // according to the terms disclosed in the EULA.
20 // rlz.dll is not present so all the functionality becomes no-ops.
21 26
22 class RLZTracker { 27 class RLZTracker {
23 28
24 public: 29 public:
25 // An Access Point offers a way to search using Google. Other products
26 // have specific entries here so do not remove the reserved access points.
27 enum AccessPoint {
28 NO_ACCESS_POINT = 0,
29 RESERVED_ACCESS_POINT_01,
30 RESERVED_ACCESS_POINT_02,
31 RESERVED_ACCESS_POINT_03,
32 RESERVED_ACCESS_POINT_04,
33 RESERVED_ACCESS_POINT_05,
34 RESERVED_ACCESS_POINT_06,
35 RESERVED_ACCESS_POINT_07,
36 RESERVED_ACCESS_POINT_08,
37 CHROME_OMNIBOX,
38 CHROME_HOME_PAGE,
39 LAST_ACCESS_POINT
40 };
41
42 // A product is an entity which wants to gets credit for setting an access
43 // point. Currently only the browser itself is supported but installed apps
44 // could have their own entry here.
45 enum Product {
46 RESERVED_PRODUCT_01 = 1,
47 RESERVED_PRODUCT_02,
48 RESERVED_PRODUCT_03,
49 RESERVED_PRODUCT_04,
50 CHROME,
51 LAST_PRODUCT
52 };
53
54 // Life cycle events. Some of them are applicable to all access points.
55 enum Event {
56 INVALID_EVENT = 0,
57 INSTALL = 1,
58 SET_TO_GOOGLE,
59 FIRST_SEARCH,
60 REPORT_RLS,
61 LAST_EVENT
62 };
63
64 // Initializes the RLZ library services. 'directory_key' indicates the base
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
67 // to load it from base::DIR_EXE.
68 // Returns false if the dll could not be loaded and initialized.
69 //
70 // This function is intended ONLY for testing.
71 static bool InitRlz(int directory_key);
72
73 // Like InitRlz() this function initializes the RLZ library services for use 30 // Like InitRlz() this function initializes the RLZ library services for use
74 // in chrome. Besides binding the dll, it schedules a delayed task (delayed 31 // in chrome. Besides binding the dll, it schedules a delayed task (delayed
75 // by |delay| seconds) that performs the ping and registers some events 32 // by |delay| seconds) that performs the ping and registers some events
76 // when 'first-run' is true. 33 // when 'first-run' is true.
77 // 34 //
78 // If the chrome brand is organic (no partners) then the RLZ library is not 35 // If the chrome brand is organic (no partners) then the RLZ library is not
79 // loaded or initialized and the pings don't ocurr. 36 // loaded or initialized and the pings don't ocurr.
80 static bool InitRlzDelayed(int directory_key, bool first_run, int delay); 37 static bool InitRlzDelayed(bool first_run, int delay);
81 38
82 // Records an RLZ event. Some events can be access point independent. 39 // Records an RLZ event. Some events can be access point independent.
83 // Returns false it the event could not be recorded. Requires write access 40 // Returns false it the event could not be recorded. Requires write access
84 // to the HKCU registry hive on windows. 41 // to the HKCU registry hive on windows.
85 static bool RecordProductEvent(Product product, AccessPoint point, 42 static bool RecordProductEvent(rlz_lib::Product product,
86 Event event_id); 43 rlz_lib::AccessPoint point,
44 rlz_lib::Event event_id);
87 45
88 // Get the RLZ value of the access point. 46 // Get the RLZ value of the access point.
89 // Returns false if the rlz string could not be obtained. In some cases 47 // Returns false if the rlz string could not be obtained. In some cases
90 // an empty string can be returned which is not an error. 48 // an empty string can be returned which is not an error.
91 static bool GetAccessPointRlz(AccessPoint point, std::wstring* rlz); 49 static bool GetAccessPointRlz(rlz_lib::AccessPoint point, std::wstring* rlz);
92 50
93 // Clear all events reported by this product. In Chrome this will be called 51 // Clear all events reported by this product. In Chrome this will be called
94 // when it is un-installed. 52 // when it is un-installed.
95 static bool ClearAllProductEvents(Product product); 53 static bool ClearAllProductEvents(rlz_lib::Product product);
96 54
97 // Invoked during shutdown to clean up any state created by RLZTracker. 55 // Invoked during shutdown to clean up any state created by RLZTracker.
98 static void CleanupRlz(); 56 static void CleanupRlz();
99 57
100 private: 58 private:
101 DISALLOW_IMPLICIT_CONSTRUCTORS(RLZTracker); 59 DISALLOW_IMPLICIT_CONSTRUCTORS(RLZTracker);
102 }; 60 };
103 61
62 #endif // defined(OS_WIN)
63
104 #endif // CHROME_BROWSER_RLZ_RLZ_H_ 64 #endif // CHROME_BROWSER_RLZ_RLZ_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/rlz/rlz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698