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

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

Issue 9404021: rlz: Remove #include <windows.h> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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/rlz/rlz.h ('k') | chrome/browser/rlz/rlz_unittest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work 5 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work
6 // with or without the DLL being present. If the DLL is not present the 6 // with or without the DLL being present. If the DLL is not present the
7 // functions do nothing and just return false. 7 // functions do nothing and just return false.
8 8
9 #include "chrome/browser/rlz/rlz.h" 9 #include "chrome/browser/rlz/rlz.h"
10 10
11 #include <windows.h>
12 #include <process.h>
13
14 #include <algorithm> 11 #include <algorithm>
15 12
16 #include "base/bind.h" 13 #include "base/bind.h"
17 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
18 #include "base/file_path.h" 15 #include "base/file_path.h"
19 #include "base/message_loop.h" 16 #include "base/message_loop.h"
20 #include "base/path_service.h" 17 #include "base/path_service.h"
21 #include "base/string_util.h" 18 #include "base/string_util.h"
22 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
23 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 schedule_ping = true; 221 schedule_ping = true;
225 } 222 }
226 223
227 already_ran_ = true; 224 already_ran_ = true;
228 225
229 if (schedule_ping) 226 if (schedule_ping)
230 ScheduleFinancialPing(); 227 ScheduleFinancialPing();
231 } 228 }
232 229
233 void RLZTracker::ScheduleFinancialPing() { 230 void RLZTracker::ScheduleFinancialPing() {
234 // Investigate why _beginthread() is used here, and not chrome's threading 231 // TODO(thakis): Once akalin's TaskRunner around PostTask() is done,
235 // API. Tracked in bug http://crbug.com/106213 232 // use that instead of the file thread.
236 _beginthread(PingNow, 0, this); 233 BrowserThread::PostTask(
237 } 234 BrowserThread::FILE,
238 235 FROM_HERE,
239 // static 236 base::Bind(&RLZTracker::PingNowImpl, base::Unretained(this)));
240 void _cdecl RLZTracker::PingNow(void* arg) {
241 RLZTracker* tracker = reinterpret_cast<RLZTracker*>(arg);
242 tracker->PingNowImpl();
243 } 237 }
244 238
245 void RLZTracker::PingNowImpl() { 239 void RLZTracker::PingNowImpl() {
246 // This is the entry point of a background thread, so I/O is allowed.
247 base::ThreadRestrictions::ScopedAllowIO allow_io;
248
249 string16 lang; 240 string16 lang;
250 GoogleUpdateSettings::GetLanguage(&lang); 241 GoogleUpdateSettings::GetLanguage(&lang);
251 if (lang.empty()) 242 if (lang.empty())
252 lang = L"en"; 243 lang = L"en";
253 string16 referral; 244 string16 referral;
254 GoogleUpdateSettings::GetReferral(&referral); 245 GoogleUpdateSettings::GetReferral(&referral);
255 246
256 std::string brand; 247 std::string brand;
257 if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand) && 248 if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand) &&
258 SendFinancialPing(brand, lang, referral)) { 249 SendFinancialPing(brand, lang, referral)) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 base::Bind(base::IgnoreResult(&RLZTracker::GetAccessPointRlz), point, 393 base::Bind(base::IgnoreResult(&RLZTracker::GetAccessPointRlz), point,
403 not_used)); 394 not_used));
404 return true; 395 return true;
405 } 396 }
406 397
407 // static 398 // static
408 void RLZTracker::CleanupRlz() { 399 void RLZTracker::CleanupRlz() {
409 GetInstance()->rlz_cache_.clear(); 400 GetInstance()->rlz_cache_.clear();
410 GetInstance()->registrar_.RemoveAll(); 401 GetInstance()->registrar_.RemoveAll();
411 } 402 }
OLDNEW
« no previous file with comments | « chrome/browser/rlz/rlz.h ('k') | chrome/browser/rlz/rlz_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698