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

Side by Side Diff: chrome/browser/google/google_url_tracker.cc

Issue 9185026: Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Explicitly include base/time.h in header file. Created 8 years, 11 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
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 #include "chrome/browser/google/google_url_tracker.h" 5 #include "chrome/browser/google/google_url_tracker.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (!queue_wakeup_task_) 181 if (!queue_wakeup_task_)
182 return; 182 return;
183 183
184 // Because this function can be called during startup, when kicking off a URL 184 // Because this function can be called during startup, when kicking off a URL
185 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully 185 // fetch can eat up 20 ms of time, we delay five seconds, which is hopefully
186 // long enough to be after startup, but still get results back quickly. 186 // long enough to be after startup, but still get results back quickly.
187 // Ideally, instead of this timer, we'd do something like "check if the 187 // Ideally, instead of this timer, we'd do something like "check if the
188 // browser is starting up, and if so, come back later", but there is currently 188 // browser is starting up, and if so, come back later", but there is currently
189 // no function to do this. 189 // no function to do this.
190 static const int kStartFetchDelayMS = 5000; 190 static const int kStartFetchDelayMS = 5000;
191
191 MessageLoop::current()->PostDelayedTask(FROM_HERE, 192 MessageLoop::current()->PostDelayedTask(FROM_HERE,
192 base::Bind(&GoogleURLTracker::FinishSleep, 193 base::Bind(&GoogleURLTracker::FinishSleep,
193 weak_ptr_factory_.GetWeakPtr()), 194 weak_ptr_factory_.GetWeakPtr()),
194 kStartFetchDelayMS); 195 base::TimeDelta::FromMilliseconds(kStartFetchDelayMS));
195 } 196 }
196 197
197 void GoogleURLTracker::FinishSleep() { 198 void GoogleURLTracker::FinishSleep() {
198 in_startup_sleep_ = false; 199 in_startup_sleep_ = false;
199 StartFetchIfDesirable(); 200 StartFetchIfDesirable();
200 } 201 }
201 202
202 void GoogleURLTracker::StartFetchIfDesirable() { 203 void GoogleURLTracker::StartFetchIfDesirable() {
203 // Bail if a fetch isn't appropriate right now. This function will be called 204 // Bail if a fetch isn't appropriate right now. This function will be called
204 // again each time one of the preconditions changes, so we'll fetch 205 // again each time one of the preconditions changes, so we'll fetch
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 393
393 // |tab_contents| can be NULL during tests. 394 // |tab_contents| can be NULL during tests.
394 InfoBarTabHelper* infobar_helper = NULL; 395 InfoBarTabHelper* infobar_helper = NULL;
395 if (web_contents) { 396 if (web_contents) {
396 TabContentsWrapper* wrapper = 397 TabContentsWrapper* wrapper =
397 TabContentsWrapper::GetCurrentWrapperForContents(web_contents); 398 TabContentsWrapper::GetCurrentWrapperForContents(web_contents);
398 infobar_helper = wrapper->infobar_tab_helper(); 399 infobar_helper = wrapper->infobar_tab_helper();
399 } 400 }
400 infobar_ = (*infobar_creator_)(infobar_helper, this, fetched_google_url_); 401 infobar_ = (*infobar_creator_)(infobar_helper, this, fetched_google_url_);
401 } 402 }
OLDNEW
« no previous file with comments | « chrome/browser/feedback/feedback_util.cc ('k') | chrome/browser/history/expire_history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698