|
OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ | |
6 #define CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ | |
7 #pragma once | |
8 | |
9 // A class that gets url redirets from the history service | |
10 | |
11 #include <string> | |
12 #include <vector> | |
13 #include "base/hash_tables.h" | |
14 #include "base/memory/linked_ptr.h" | |
15 #include "base/memory/ref_counted.h" | |
16 #include "chrome/browser/history/history.h" | |
17 #include "net/base/completion_callback.h" | |
18 | |
19 class TabContents; | |
20 | |
21 class MalwareDetailsRedirectsCollector | |
22 : public base::RefCountedThreadSafe<MalwareDetailsRedirectsCollector> { | |
23 | |
24 public: | |
25 MalwareDetailsRedirectsCollector(); | |
26 virtual ~MalwareDetailsRedirectsCollector(); | |
27 | |
28 void StartHistoryCollection(const std::vector<GURL>& urls, | |
panayiotis
2011/05/13 21:15:26
comment about the method and args.
mention that |
kewang
2011/05/16 07:11:51
Done.
| |
29 TabContents* tab_contents, | |
30 Task* callback); | |
31 | |
32 // Returns whether or not StartCacheCollection has been called. | |
33 bool HasStarted(); | |
34 | |
35 // Returns the rediret urls we get from history service | |
panayiotis
2011/05/13 21:15:26
typo: redirect
we probably want to return a refer
kewang
2011/05/16 07:11:51
Done.
| |
36 std::vector<std::vector<GURL> > GetCollectedUrls(); | |
37 | |
38 // We need to reset it in unittest | |
39 HistoryService* history_; | |
panayiotis
2011/05/13 21:15:26
maybe expose an accessor instead (GetHistory()) ?
kewang
2011/05/16 07:11:51
Put a SetHistory() for unittest.
| |
40 | |
41 private: | |
42 TabContents* tab_contents_; | |
43 | |
44 // Method we call when we are done. The caller must be alive for the | |
45 // whole time, we are modifying its state (see above). | |
46 Task* callback_; | |
47 | |
48 // Set to true once StartHistoryCollection is called | |
49 bool has_started_; | |
50 | |
51 // The urls we need to get redirects for | |
52 std::vector<GURL> urls_; | |
53 // The iterator goes over urls_ | |
54 std::vector<GURL>::iterator urls_it_; | |
55 // The collected directs from history service | |
56 std::vector<std::vector<GURL> > redirects_urls_; | |
panayiotis
2011/05/13 21:15:26
maybe we can create a typedef RedirectChain = st
kewang
2011/05/16 07:11:51
Done.
| |
57 | |
58 void StartGetRedirects(const std::vector<GURL>& urls); | |
59 void GetRedirects(const GURL& url); | |
60 void OnGotQueryRedirectsTo(HistoryService::Handle handle, | |
61 GURL url, | |
62 bool success, | |
63 history::RedirectList* redirect_list); | |
64 | |
65 void AllDone(); | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsRedirectsCollector); | |
68 }; | |
69 | |
70 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ | |
OLD | NEW |