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

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

Issue 9699054: rlz: Hook up on mac, switch to chrome's network stack on win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
11 #if defined(OS_WIN) 11 #if defined(OS_WIN) || defined(OS_MACOSX)
12 12
13 #include <map> 13 #include <map>
14 #include <string> 14 #include <string>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
18 #include "base/string16.h" 18 #include "base/string16.h"
19 #include "base/threading/sequenced_worker_pool.h"
19 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
21 #include "rlz/lib/rlz_lib.h" 22 #include "rlz/lib/rlz_lib.h"
22 23
23 // RLZ is a library which is used to measure distribution scenarios. 24 // RLZ is a library which is used to measure distribution scenarios.
24 // Its job is to record certain lifetime events in the registry and to send 25 // Its job is to record certain lifetime events in the registry and to send
25 // them encoded as a compact string at most twice. The sent data does 26 // them encoded as a compact string at most twice. The sent data does
26 // not contain information that can be used to identify a user or to infer 27 // not contain information that can be used to identify a user or to infer
27 // browsing habits. The API in this file is a wrapper around the open source 28 // browsing habits. The API in this file is a wrapper around the open source
28 // RLZ library which can be found at http://code.google.com/p/rlz. 29 // RLZ library which can be found at http://code.google.com/p/rlz.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Tracker used for testing purposes only. If this value is non-NULL, it 120 // Tracker used for testing purposes only. If this value is non-NULL, it
120 // will be returned from GetInstance() instead of the regular singleton. 121 // will be returned from GetInstance() instead of the regular singleton.
121 static RLZTracker* tracker_; 122 static RLZTracker* tracker_;
122 123
123 // Configuation data for RLZ tracker. Set by call to Init(). 124 // Configuation data for RLZ tracker. Set by call to Init().
124 bool first_run_; 125 bool first_run_;
125 bool send_ping_immediately_; 126 bool send_ping_immediately_;
126 bool google_default_search_; 127 bool google_default_search_;
127 bool google_default_homepage_; 128 bool google_default_homepage_;
128 129
130 // Unique sequence token so that tasks posted by RLZTracker are executed
131 // sequentially in the blocking pool.
132 base::SequencedWorkerPool::SequenceToken worker_pool_token_;
133
129 // Keeps track if the RLZ tracker has already performed its delayed 134 // Keeps track if the RLZ tracker has already performed its delayed
130 // initialization. 135 // initialization.
131 bool already_ran_; 136 bool already_ran_;
132 137
133 // Keeps a cache of RLZ access point strings, since they rarely change. 138 // Keeps a cache of RLZ access point strings, since they rarely change.
134 // The cache must be protected by a lock since it may be accessed from 139 // The cache must be protected by a lock since it may be accessed from
135 // the UI thread for reading and the IO thread for reading and/or writing. 140 // the UI thread for reading and the IO thread for reading and/or writing.
136 base::Lock cache_lock_; 141 base::Lock cache_lock_;
137 std::map<rlz_lib::AccessPoint, string16> rlz_cache_; 142 std::map<rlz_lib::AccessPoint, string16> rlz_cache_;
138 143
139 // Keeps track of whether the omnibox or host page have been used. 144 // Keeps track of whether the omnibox or host page have been used.
140 bool omnibox_used_; 145 bool omnibox_used_;
141 bool homepage_used_; 146 bool homepage_used_;
142 147
143 content::NotificationRegistrar registrar_; 148 content::NotificationRegistrar registrar_;
144 149
145 DISALLOW_COPY_AND_ASSIGN(RLZTracker); 150 DISALLOW_COPY_AND_ASSIGN(RLZTracker);
146 }; 151 };
147 152
148 #endif // defined(OS_WIN) 153 #endif // defined(OS_WIN) || defined(OS_MACOSX)
149 154
150 #endif // CHROME_BROWSER_RLZ_RLZ_H_ 155 #endif // CHROME_BROWSER_RLZ_RLZ_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698