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

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

Issue 149135: Add a ping delay time master preference. (Closed)
Patch Set: Created 11 years, 5 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
« no previous file with comments | « chrome/browser/rlz/rlz.h ('k') | chrome/installer/util/master_preferences.h » ('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) 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 // 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> 11 #include <windows.h>
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 bool first_run_; 280 bool first_run_;
281 DISALLOW_IMPLICIT_CONSTRUCTORS(DelayedInitTask); 281 DISALLOW_IMPLICIT_CONSTRUCTORS(DelayedInitTask);
282 }; 282 };
283 283
284 } // namespace 284 } // namespace
285 285
286 bool RLZTracker::InitRlz(int directory_key) { 286 bool RLZTracker::InitRlz(int directory_key) {
287 return LoadRLZLibrary(directory_key); 287 return LoadRLZLibrary(directory_key);
288 } 288 }
289 289
290 bool RLZTracker::InitRlzDelayed(int directory_key, bool first_run) { 290 bool RLZTracker::InitRlzDelayed(int directory_key, bool first_run, int delay) {
291 // Maximum and minimum delay we would allow to be set through master
292 // preferences. Somewhat arbitrary, may need to be adjusted in future.
293 const int kMaxDelay = 200 * 1000;
294 const int kMinDelay = 20 * 1000;
295
296 delay *= 1000;
297 delay = (delay < kMinDelay) ? kMinDelay : delay;
298 delay = (delay > kMaxDelay) ? kMaxDelay : delay;
299
291 if (!OmniBoxUsageObserver::used()) 300 if (!OmniBoxUsageObserver::used())
292 new OmniBoxUsageObserver(); 301 new OmniBoxUsageObserver();
302
293 // Schedule the delayed init items. 303 // Schedule the delayed init items.
294 const int kNinetySeconds = 90 * 1000;
295 MessageLoop::current()->PostDelayedTask(FROM_HERE, 304 MessageLoop::current()->PostDelayedTask(FROM_HERE,
296 new DelayedInitTask(directory_key, first_run), kNinetySeconds); 305 new DelayedInitTask(directory_key, first_run), delay);
297 return true; 306 return true;
298 } 307 }
299 308
300 bool RLZTracker::RecordProductEvent(Product product, AccessPoint point, 309 bool RLZTracker::RecordProductEvent(Product product, AccessPoint point,
301 Event event) { 310 Event event) {
302 return (record_event) ? record_event(product, point, event, NULL) : false; 311 return (record_event) ? record_event(product, point, event, NULL) : false;
303 } 312 }
304 313
305 bool RLZTracker::ClearAllProductEvents(Product product) { 314 bool RLZTracker::ClearAllProductEvents(Product product) {
306 return (clear_all_events) ? clear_all_events(product, NULL) : false; 315 return (clear_all_events) ? clear_all_events(product, NULL) : false;
(...skipping 20 matching lines...) Expand all
327 cached_ommibox_rlz.assign(str_rlz); 336 cached_ommibox_rlz.assign(str_rlz);
328 } 337 }
329 *rlz = str_rlz; 338 *rlz = str_rlz;
330 return true; 339 return true;
331 } 340 }
332 341
333 // static 342 // static
334 void RLZTracker::CleanupRlz() { 343 void RLZTracker::CleanupRlz() {
335 OmniBoxUsageObserver::DeleteInstance(); 344 OmniBoxUsageObserver::DeleteInstance();
336 } 345 }
OLDNEW
« no previous file with comments | « chrome/browser/rlz/rlz.h ('k') | chrome/installer/util/master_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698