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

Side by Side Diff: chrome/browser/safe_browsing/malware_details_history.h

Issue 349153006: Port HistoryService::QueryRedirects{From,To} to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_
7 7
8 // This class gets redirect chain for urls from the history service. 8 // This class gets redirect chain for urls from the history service.
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/memory/linked_ptr.h" 15 #include "base/memory/linked_ptr.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/sequenced_task_runner_helpers.h" 17 #include "base/sequenced_task_runner_helpers.h"
18 #include "base/task/cancelable_task_tracker.h"
18 #include "chrome/browser/history/history_service.h" 19 #include "chrome/browser/history/history_service.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 #include "net/base/completion_callback.h" 23 #include "net/base/completion_callback.h"
23 24
24 namespace safe_browsing { 25 namespace safe_browsing {
25 typedef std::vector<GURL> RedirectChain; 26 typedef std::vector<GURL> RedirectChain;
26 } 27 }
27 28
(...skipping 24 matching lines...) Expand all
52 53
53 private: 54 private:
54 friend struct content::BrowserThread::DeleteOnThread< 55 friend struct content::BrowserThread::DeleteOnThread<
55 content::BrowserThread::UI>; 56 content::BrowserThread::UI>;
56 friend class base::DeleteHelper<MalwareDetailsRedirectsCollector>; 57 friend class base::DeleteHelper<MalwareDetailsRedirectsCollector>;
57 58
58 virtual ~MalwareDetailsRedirectsCollector(); 59 virtual ~MalwareDetailsRedirectsCollector();
59 60
60 void StartGetRedirects(const std::vector<GURL>& urls); 61 void StartGetRedirects(const std::vector<GURL>& urls);
61 void GetRedirects(const GURL& url); 62 void GetRedirects(const GURL& url);
62 void OnGotQueryRedirectsTo(HistoryService::Handle handle, 63 void OnGotQueryRedirectsTo(const GURL& url,
63 GURL url, 64 const history::RedirectList* redirect_list);
64 bool success,
65 history::RedirectList* redirect_list);
66 65
67 // Posts the callback method back to IO thread when redirects collecting 66 // Posts the callback method back to IO thread when redirects collecting
68 // is all done. 67 // is all done.
69 void AllDone(); 68 void AllDone();
70 69
71 Profile* profile_; 70 Profile* profile_;
72 CancelableRequestConsumer request_consumer_; 71 base::CancelableTaskTracker request_tracker_;
73 72
74 // Method we call when we are done. The caller must be alive for the 73 // Method we call when we are done. The caller must be alive for the
75 // whole time, we are modifying its state (see above). 74 // whole time, we are modifying its state (see above).
76 base::Closure callback_; 75 base::Closure callback_;
77 76
78 // Sets to true once StartHistoryCollection is called 77 // Sets to true once StartHistoryCollection is called
79 bool has_started_; 78 bool has_started_;
80 79
81 // The urls we need to get redirects for 80 // The urls we need to get redirects for
82 std::vector<GURL> urls_; 81 std::vector<GURL> urls_;
83 // The iterator goes over urls_ 82 // The iterator goes over urls_
84 std::vector<GURL>::iterator urls_it_; 83 std::vector<GURL>::iterator urls_it_;
85 // The collected directs from history service 84 // The collected directs from history service
86 std::vector<safe_browsing::RedirectChain> redirects_urls_; 85 std::vector<safe_browsing::RedirectChain> redirects_urls_;
87 86
88 content::NotificationRegistrar registrar_; 87 content::NotificationRegistrar registrar_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsRedirectsCollector); 89 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsRedirectsCollector);
91 }; 90 };
92 91
93 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ 92 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | chrome/browser/safe_browsing/malware_details_history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698