summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-06 20:19:29 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-06 20:19:29 +0000
commitcd1c78349190f4084424fe9790f2548b0d52167a (patch)
treed2786ce9f424ddf04ebca6be6d3183bb3463c875 /chrome/browser
parent0ef42ff9d9de850a881cfa66f96d4217695a2186 (diff)
downloadchromium_src-cd1c78349190f4084424fe9790f2548b0d52167a.zip
chromium_src-cd1c78349190f4084424fe9790f2548b0d52167a.tar.gz
chromium_src-cd1c78349190f4084424fe9790f2548b0d52167a.tar.bz2
Add a ping delay time master preference.
BUG=1953127 Review URL: http://codereview.chromium.org/149135 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_main.cc5
-rw-r--r--chrome/browser/rlz/rlz.cc17
-rw-r--r--chrome/browser/rlz/rlz.h17
3 files changed, 26 insertions, 13 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 0222697..349a226 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -51,6 +51,7 @@
#include "chrome/common/pref_service.h"
#include "chrome/common/result_codes.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "chrome/installer/util/master_preferences.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/net_resources.h"
@@ -663,10 +664,12 @@ int BrowserMain(const MainFunctionParams& parameters) {
win_util::ScopedCOMInitializer com_initializer;
+ int delay = 0;
+ installer_util::GetDistributionPingDelay(FilePath(), delay);
// Init the RLZ library. This just binds the dll and schedules a task on the
// file thread to be run sometime later. If this is the first run we record
// the installation event.
- RLZTracker::InitRlzDelayed(base::DIR_MODULE, is_first_run);
+ RLZTracker::InitRlzDelayed(base::DIR_MODULE, is_first_run, delay);
#endif
// Config the network module so it has access to resources.
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 96ea0c2..a280be2 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -287,13 +287,22 @@ bool RLZTracker::InitRlz(int directory_key) {
return LoadRLZLibrary(directory_key);
}
-bool RLZTracker::InitRlzDelayed(int directory_key, bool first_run) {
+bool RLZTracker::InitRlzDelayed(int directory_key, bool first_run, int delay) {
+ // Maximum and minimum delay we would allow to be set through master
+ // preferences. Somewhat arbitrary, may need to be adjusted in future.
+ const int kMaxDelay = 200 * 1000;
+ const int kMinDelay = 20 * 1000;
+
+ delay *= 1000;
+ delay = (delay < kMinDelay) ? kMinDelay : delay;
+ delay = (delay > kMaxDelay) ? kMaxDelay : delay;
+
if (!OmniBoxUsageObserver::used())
new OmniBoxUsageObserver();
+
// Schedule the delayed init items.
- const int kNinetySeconds = 90 * 1000;
MessageLoop::current()->PostDelayedTask(FROM_HERE,
- new DelayedInitTask(directory_key, first_run), kNinetySeconds);
+ new DelayedInitTask(directory_key, first_run), delay);
return true;
}
diff --git a/chrome/browser/rlz/rlz.h b/chrome/browser/rlz/rlz.h
index f9936ba..b4f1b9c4 100644
--- a/chrome/browser/rlz/rlz.h
+++ b/chrome/browser/rlz/rlz.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_RLZ_RLZ_H__
-#define CHROME_BROWSER_RLZ_RLZ_H__
+#ifndef CHROME_BROWSER_RLZ_RLZ_H_
+#define CHROME_BROWSER_RLZ_RLZ_H_
#include <string>
@@ -69,10 +69,11 @@ class RLZTracker {
// This function is intended primarily for testing.
static bool InitRlz(int directory_key);
- // Like InitRlz() this function the RLZ library services for use in chrome.
- // Besides binding the dll, it schedules a delayed task that performs the
- // daily ping and registers the some events when 'first-run' is true.
- static bool InitRlzDelayed(int directory_key, bool first_run);
+ // Like InitRlz() this function initializes the RLZ library services for use
+ // in chrome. Besides binding the dll, it schedules a delayed task (delayed
+ // by |delay| seconds) that performs the daily ping and registers some events
+ // when 'first-run' is true.
+ static bool InitRlzDelayed(int directory_key, bool first_run, int delay);
// Records an RLZ event. Some events can be access point independent.
// Returns false it the event could not be recorded. Requires write access
@@ -96,4 +97,4 @@ class RLZTracker {
DISALLOW_IMPLICIT_CONSTRUCTORS(RLZTracker);
};
-#endif // CHROME_BROWSER_RLZ_RLZ_H__
+#endif // CHROME_BROWSER_RLZ_RLZ_H_