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

Side by Side Diff: chrome/browser/history/history_service.h

Issue 349153006: Port HistoryService::QueryRedirects{From,To} to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/task/cancelable_task_tracker.h" 21 #include "base/task/cancelable_task_tracker.h"
22 #include "base/threading/thread_checker.h" 22 #include "base/threading/thread_checker.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "chrome/browser/common/cancelable_request.h" 24 #include "chrome/browser/common/cancelable_request.h"
droger 2014/06/23 16:50:35 Is this still needed?
sdefresne 2014/06/24 13:41:00 Yes, there are still many usage of CancelableReque
25 #include "chrome/browser/history/delete_directive_handler.h" 25 #include "chrome/browser/history/delete_directive_handler.h"
26 #include "chrome/browser/history/history_types.h" 26 #include "chrome/browser/history/history_types.h"
27 #include "chrome/browser/history/typed_url_syncable_service.h" 27 #include "chrome/browser/history/typed_url_syncable_service.h"
28 #include "chrome/common/ref_counted_util.h" 28 #include "chrome/common/ref_counted_util.h"
29 #include "components/favicon_base/favicon_callback.h" 29 #include "components/favicon_base/favicon_callback.h"
30 #include "components/history/core/browser/history_client.h" 30 #include "components/history/core/browser/history_client.h"
31 #include "components/keyed_service/core/keyed_service.h" 31 #include "components/keyed_service/core/keyed_service.h"
32 #include "components/search_engines/template_url_id.h" 32 #include "components/search_engines/template_url_id.h"
33 #include "components/visitedlink/browser/visitedlink_delegate.h" 33 #include "components/visitedlink/browser/visitedlink_delegate.h"
34 #include "content/public/browser/download_manager_delegate.h" 34 #include "content/public/browser/download_manager_delegate.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // the original page. If A redirects to B which redirects to C, the vector 266 // the original page. If A redirects to B which redirects to C, the vector
267 // will contain [B, C], and A will be in 'from_url'. 267 // will contain [B, C], and A will be in 'from_url'.
268 // 268 //
269 // For QueryRedirectsTo, the order is reversed. For A->B->C, the vector will 269 // For QueryRedirectsTo, the order is reversed. For A->B->C, the vector will
270 // contain [B, A] and C will be in 'to_url'. 270 // contain [B, A] and C will be in 'to_url'.
271 // 271 //
272 // If there is no such URL in the database or the most recent visit has no 272 // If there is no such URL in the database or the most recent visit has no
273 // redirect, the vector will be empty. If the history system failed for 273 // redirect, the vector will be empty. If the history system failed for
274 // some reason, success will additionally be false. If the given page 274 // some reason, success will additionally be false. If the given page
275 // has redirected to multiple destinations, this will pick a random one. 275 // has redirected to multiple destinations, this will pick a random one.
276 typedef base::Callback<void(Handle, 276 typedef base::Callback<void(GURL, // from_url / to_url
277 GURL, // from_url / to_url
278 bool, // success 277 bool, // success
279 history::RedirectList*)> QueryRedirectsCallback; 278 const history::RedirectList*)>
279 QueryRedirectsCallback;
280 280
281 // Schedules a query for the most recent redirect coming out of the given 281 // Schedules a query for the most recent redirect coming out of the given
282 // URL. See the RedirectQuerySource above, which is guaranteed to be called 282 // URL. See the RedirectQuerySource above, which is guaranteed to be called
283 // if the request is not canceled. 283 // if the request is not canceled.
284 Handle QueryRedirectsFrom(const GURL& from_url, 284 base::CancelableTaskTracker::TaskId QueryRedirectsFrom(
285 CancelableRequestConsumerBase* consumer, 285 const GURL& from_url,
286 const QueryRedirectsCallback& callback); 286 const QueryRedirectsCallback& callback,
287 base::CancelableTaskTracker* tracker);
287 288
288 // Schedules a query to get the most recent redirects ending at the given 289 // Schedules a query to get the most recent redirects ending at the given
289 // URL. 290 // URL.
290 Handle QueryRedirectsTo(const GURL& to_url, 291 base::CancelableTaskTracker::TaskId QueryRedirectsTo(
291 CancelableRequestConsumerBase* consumer, 292 const GURL& to_url,
292 const QueryRedirectsCallback& callback); 293 const QueryRedirectsCallback& callback,
294 base::CancelableTaskTracker* tracker);
293 295
294 typedef base::Callback< 296 typedef base::Callback<
295 void(Handle, 297 void(Handle,
296 bool, // Were we able to determine the # of visits? 298 bool, // Were we able to determine the # of visits?
297 int, // Number of visits. 299 int, // Number of visits.
298 base::Time)> // Time of first visit. Only set if bool 300 base::Time)> // Time of first visit. Only set if bool
299 // is true and int is > 0. 301 // is true and int is > 0.
300 GetVisibleVisitCountToHostCallback; 302 GetVisibleVisitCountToHostCallback;
301 303
302 // Requests the number of user-visible visits (i.e. no redirects or subframes) 304 // Requests the number of user-visible visits (i.e. no redirects or subframes)
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1036 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1035 1037
1036 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; 1038 ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
1037 1039
1038 history::DeleteDirectiveHandler delete_directive_handler_; 1040 history::DeleteDirectiveHandler delete_directive_handler_;
1039 1041
1040 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1042 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1041 }; 1043 };
1042 1044
1043 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 1045 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698