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

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

Issue 6710004: Querying the history service to get the redirect information for urls.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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
mattm 2011/05/17 03:17:01 typo (redirets) Comments should be complete sente
kewang 2011/05/18 05:47:40 Done.
10
11 #include <string>
12 #include <vector>
mattm 2011/05/17 03:17:01 blank line between include blocks
kewang 2011/05/18 05:47:40 Done.
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 namespace safe_browsing {
22 typedef std::vector<GURL> RedirectChain;
23 }
24
25 class MalwareDetailsRedirectsCollector
26 : public base::RefCountedThreadSafe<MalwareDetailsRedirectsCollector> {
27
28 public:
29 MalwareDetailsRedirectsCollector();
30 virtual ~MalwareDetailsRedirectsCollector();
31
32 // Collect urls' redirects chain information from the history service.
33 // We get access to history service via tab_contents in UI thread.
34 // Notice the callback will be posted to the IO thread.
35 void StartHistoryCollection(const std::vector<GURL>& urls,
36 TabContents* tab_contents,
37 Task* callback);
38
39 // Returns whether or not StartCacheCollection has been called.
40 bool HasStarted();
mattm 2011/05/17 03:17:01 Should be const method.
kewang 2011/05/18 05:47:40 Done.
41
42 // Returns the redirect urls we get from history service
43 std::vector<safe_browsing::RedirectChain>* GetCollectedUrls();
mattm 2011/05/17 03:17:01 Should return a const reference. Should be const m
kewang 2011/05/18 05:47:40 Done.
44
45 // Set the pointer to the history service. Use it in unittest.
mattm 2011/05/17 03:17:01 s/Set/Sets/ (Function comments should be descrip
kewang 2011/05/18 05:47:40 Done.
46 void SetHistory(HistoryService* history);
47
48 private:
49 TabContents* tab_contents_;
50 HistoryService* history_;
51
52 // Method we call when we are done. The caller must be alive for the
53 // whole time, we are modifying its state (see above).
54 Task* callback_;
55
56 // Set to true once StartHistoryCollection is called
57 bool has_started_;
58
59 // The urls we need to get redirects for
60 std::vector<GURL> urls_;
61 // The iterator goes over urls_
62 std::vector<GURL>::iterator urls_it_;
63 // The collected directs from history service
64 std::vector<safe_browsing::RedirectChain> redirects_urls_;
65
66 void StartGetRedirects(const std::vector<GURL>& urls);
67 void GetRedirects(const GURL& url);
68 void OnGotQueryRedirectsTo(HistoryService::Handle handle,
69 GURL url,
70 bool success,
71 history::RedirectList* redirect_list);
72
73 void AllDone();
74
75 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsRedirectsCollector);
76 };
77
78 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698