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

Unified Diff: chrome/browser/rlz/rlz.cc

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: . 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/rlz/rlz.cc
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 802410696616732d46a789803ec8f6c5ba50510c..4fa1f2213df0450510df158182376bf5b8fac122 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -11,13 +11,8 @@
#include <algorithm>
#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/file_path.h"
#include "base/message_loop.h"
-#include "base/path_service.h"
#include "base/string_util.h"
-#include "base/synchronization/lock.h"
-#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
@@ -26,13 +21,31 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/env_vars.h"
-#include "chrome/installer/util/google_update_settings.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
+#if defined(OS_WIN)
+#include "chrome/installer/util/google_update_settings.h"
+#else
+namespace GoogleUpdateSettings {
+static bool GetLanguage(string16* language) {
+ // TODO(thakis): Implement.
+ NOTIMPLEMENTED();
+ return false;
+}
+
+// The referral program is defunct and not used. No need to implement these
+// functions on mac.
+static bool GetReferral(string16* referral) {
+ return true;
+}
+static bool ClearReferral() {
+ return true;
+}
+} // namespace GoogleUpdateSettings
+#endif
+
using content::BrowserThread;
using content::NavigationEntry;
@@ -148,6 +161,8 @@ bool RLZTracker::Init(bool first_run, int delay, bool google_default_search,
google_default_search_ = google_default_search;
google_default_homepage_ = google_default_homepage;
+ worker_pool_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken();
Roger Tawa OOO till Jul 10th 2012/03/24 01:10:42 The idea is to delay rlz initialization as much as
Nico 2012/03/24 01:29:47 Done. (This is just an atomic increment behind the
+
// A negative delay means that a financial ping should be sent immediately
// after a first search is recorded, without waiting for the next restart
// of chrome. However, we only want this behaviour on first run.
@@ -188,6 +203,7 @@ bool RLZTracker::Init(bool first_run, int delay, bool google_default_search,
void RLZTracker::ScheduleDelayedInit(int delay) {
// The RLZTracker is a singleton object that outlives any runnable tasks
// that will be queued up.
+ // TODO: Move to SequencedWorkerPool once http://crbug.com/119657 is fixed.
BrowserThread::PostDelayedTask(
BrowserThread::FILE,
FROM_HERE,
@@ -198,6 +214,8 @@ void RLZTracker::ScheduleDelayedInit(int delay) {
void RLZTracker::DelayedInit() {
bool schedule_ping = false;
+ rlz_lib::SetURLRequestContext(g_browser_process->system_request_context());
+
// For organic brandcodes do not use rlz at all. Empty brandcode usually
// means a chromium install. This is ok.
std::string brand;
@@ -227,10 +245,8 @@ void RLZTracker::DelayedInit() {
}
void RLZTracker::ScheduleFinancialPing() {
- // TODO(thakis): Once akalin's TaskRunner around PostTask() is done,
- // use that instead of the file thread.
- BrowserThread::PostTask(
- BrowserThread::FILE,
+ BrowserThread::GetBlockingPool()->PostSequencedWorkerTask(
+ worker_pool_token_,
FROM_HERE,
base::Bind(&RLZTracker::PingNowImpl, base::Unretained(this)));
}
@@ -385,8 +401,9 @@ bool RLZTracker::ScheduleGetAccessPointRlz(rlz_lib::AccessPoint point) {
return false;
string16* not_used = NULL;
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
+ BrowserThread::GetBlockingPool()->PostSequencedWorkerTask(
+ worker_pool_token_,
+ FROM_HERE,
base::Bind(base::IgnoreResult(&RLZTracker::GetAccessPointRlz), point,
not_used));
return true;

Powered by Google App Engine
This is Rietveld 408576698