OLD | NEW |
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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 // This class gets redirect chain for urls from the history service. | 9 // This class gets redirect chain for urls from the history service. |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 #include "net/base/completion_callback.h" | 22 #include "net/base/completion_callback.h" |
23 | 23 |
24 class TabContents; | 24 class TabContents; |
25 | 25 |
26 namespace safe_browsing { | 26 namespace safe_browsing { |
27 typedef std::vector<GURL> RedirectChain; | 27 typedef std::vector<GURL> RedirectChain; |
28 } | 28 } |
29 | 29 |
30 class MalwareDetailsRedirectsCollector | 30 class MalwareDetailsRedirectsCollector |
31 : public base::RefCountedThreadSafe<MalwareDetailsRedirectsCollector, | 31 : public base::RefCountedThreadSafe< |
32 BrowserThread::DeleteOnUIThread>, | 32 MalwareDetailsRedirectsCollector, |
| 33 content::BrowserThread::DeleteOnUIThread>, |
33 public content::NotificationObserver { | 34 public content::NotificationObserver { |
34 | 35 |
35 public: | 36 public: |
36 explicit MalwareDetailsRedirectsCollector(Profile* profile); | 37 explicit MalwareDetailsRedirectsCollector(Profile* profile); |
37 virtual ~MalwareDetailsRedirectsCollector(); | 38 virtual ~MalwareDetailsRedirectsCollector(); |
38 | 39 |
39 // Collects urls' redirects chain information from the history service. | 40 // Collects urls' redirects chain information from the history service. |
40 // We get access to history service via tab_contents in UI thread. | 41 // We get access to history service via tab_contents in UI thread. |
41 // Notice the callback will be posted to the IO thread. | 42 // Notice the callback will be posted to the IO thread. |
42 void StartHistoryCollection(const std::vector<GURL>& urls, | 43 void StartHistoryCollection(const std::vector<GURL>& urls, |
43 const base::Closure& callback); | 44 const base::Closure& callback); |
44 | 45 |
45 // Returns whether or not StartCacheCollection has been called. | 46 // Returns whether or not StartCacheCollection has been called. |
46 bool HasStarted() const; | 47 bool HasStarted() const; |
47 | 48 |
48 // Returns the redirect urls we get from history service | 49 // Returns the redirect urls we get from history service |
49 const std::vector<safe_browsing::RedirectChain>& GetCollectedUrls() const; | 50 const std::vector<safe_browsing::RedirectChain>& GetCollectedUrls() const; |
50 | 51 |
51 private: | 52 private: |
52 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 53 friend struct content::BrowserThread::DeleteOnThread< |
| 54 content::BrowserThread::UI>; |
53 friend class DeleteTask<MalwareDetailsRedirectsCollector>; | 55 friend class DeleteTask<MalwareDetailsRedirectsCollector>; |
54 | 56 |
55 Profile* profile_; | 57 Profile* profile_; |
56 CancelableRequestConsumer request_consumer_; | 58 CancelableRequestConsumer request_consumer_; |
57 | 59 |
58 // Method we call when we are done. The caller must be alive for the | 60 // Method we call when we are done. The caller must be alive for the |
59 // whole time, we are modifying its state (see above). | 61 // whole time, we are modifying its state (see above). |
60 base::Closure callback_; | 62 base::Closure callback_; |
61 | 63 |
62 // Sets to true once StartHistoryCollection is called | 64 // Sets to true once StartHistoryCollection is called |
(...skipping 20 matching lines...) Expand all Loading... |
83 void AllDone(); | 85 void AllDone(); |
84 | 86 |
85 virtual void Observe(int type, | 87 virtual void Observe(int type, |
86 const content::NotificationSource& source, | 88 const content::NotificationSource& source, |
87 const content::NotificationDetails& details) OVERRIDE; | 89 const content::NotificationDetails& details) OVERRIDE; |
88 | 90 |
89 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsRedirectsCollector); | 91 DISALLOW_COPY_AND_ASSIGN(MalwareDetailsRedirectsCollector); |
90 }; | 92 }; |
91 | 93 |
92 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ | 94 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ |
OLD | NEW |