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

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

Issue 9877017: system_request_context() has to be called on the UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « no previous file | no next file » | 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) 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 // 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
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // If instant is enabled we'll start searching as soon as the user starts 186 // If instant is enabled we'll start searching as soon as the user starts
187 // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED). 187 // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED).
188 registrar_.Add(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, 188 registrar_.Add(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED,
189 content::NotificationService::AllSources()); 189 content::NotificationService::AllSources());
190 190
191 // Register for notifications from navigations, to see if the user has used 191 // Register for notifications from navigations, to see if the user has used
192 // the home page. 192 // the home page.
193 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, 193 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING,
194 content::NotificationService::AllSources()); 194 content::NotificationService::AllSources());
195 195
196 rlz_lib::SetURLRequestContext(g_browser_process->system_request_context());
196 ScheduleDelayedInit(delay); 197 ScheduleDelayedInit(delay);
197 198
198 return true; 199 return true;
199 } 200 }
200 201
201 void RLZTracker::ScheduleDelayedInit(int delay) { 202 void RLZTracker::ScheduleDelayedInit(int delay) {
202 // The RLZTracker is a singleton object that outlives any runnable tasks 203 // The RLZTracker is a singleton object that outlives any runnable tasks
203 // that will be queued up. 204 // that will be queued up.
204 // TODO: Move to SequencedWorkerPool once http://crbug.com/119657 is fixed. 205 // TODO: Move to SequencedWorkerPool once http://crbug.com/119657 is fixed.
205 BrowserThread::PostDelayedTask( 206 BrowserThread::PostDelayedTask(
206 BrowserThread::FILE, 207 BrowserThread::FILE,
207 FROM_HERE, 208 FROM_HERE,
208 base::Bind(&RLZTracker::DelayedInit, base::Unretained(this)), 209 base::Bind(&RLZTracker::DelayedInit, base::Unretained(this)),
209 delay); 210 delay);
210 } 211 }
211 212
212 void RLZTracker::DelayedInit() { 213 void RLZTracker::DelayedInit() {
213 worker_pool_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); 214 worker_pool_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken();
214 215
215 bool schedule_ping = false; 216 bool schedule_ping = false;
216 217
217 rlz_lib::SetURLRequestContext(g_browser_process->system_request_context());
218
219 // For organic brandcodes do not use rlz at all. Empty brandcode usually 218 // For organic brandcodes do not use rlz at all. Empty brandcode usually
220 // means a chromium install. This is ok. 219 // means a chromium install. This is ok.
221 std::string brand; 220 std::string brand;
222 if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand)) { 221 if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand)) {
223 RecordProductEvents(first_run_, google_default_search_, 222 RecordProductEvents(first_run_, google_default_search_,
224 google_default_homepage_, already_ran_, 223 google_default_homepage_, already_ran_,
225 omnibox_used_, homepage_used_); 224 omnibox_used_, homepage_used_);
226 schedule_ping = true; 225 schedule_ping = true;
227 } 226 }
228 227
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 base::Bind(base::IgnoreResult(&RLZTracker::GetAccessPointRlz), point, 406 base::Bind(base::IgnoreResult(&RLZTracker::GetAccessPointRlz), point,
408 not_used)); 407 not_used));
409 return true; 408 return true;
410 } 409 }
411 410
412 // static 411 // static
413 void RLZTracker::CleanupRlz() { 412 void RLZTracker::CleanupRlz() {
414 GetInstance()->rlz_cache_.clear(); 413 GetInstance()->rlz_cache_.clear();
415 GetInstance()->registrar_.RemoveAll(); 414 GetInstance()->registrar_.RemoveAll();
416 } 415 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698