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

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

Issue 10068036: RefCounted types should not have public destructors, chrome/browser/ part 5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix Created 8 years, 8 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) 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 15 matching lines...) Expand all
26 typedef std::vector<GURL> RedirectChain; 26 typedef std::vector<GURL> RedirectChain;
27 } 27 }
28 28
29 class MalwareDetailsRedirectsCollector 29 class MalwareDetailsRedirectsCollector
30 : public base::RefCountedThreadSafe< 30 : public base::RefCountedThreadSafe<
31 MalwareDetailsRedirectsCollector, 31 MalwareDetailsRedirectsCollector,
32 content::BrowserThread::DeleteOnUIThread>, 32 content::BrowserThread::DeleteOnUIThread>,
33 public content::NotificationObserver { 33 public content::NotificationObserver {
34 public: 34 public:
35 explicit MalwareDetailsRedirectsCollector(Profile* profile); 35 explicit MalwareDetailsRedirectsCollector(Profile* profile);
36 virtual ~MalwareDetailsRedirectsCollector();
37 36
38 // Collects urls' redirects chain information from the history service. 37 // Collects urls' redirects chain information from the history service.
39 // We get access to history service via tab_contents in UI thread. 38 // We get access to history service via tab_contents in UI thread.
40 // Notice the callback will be posted to the IO thread. 39 // Notice the callback will be posted to the IO thread.
41 void StartHistoryCollection(const std::vector<GURL>& urls, 40 void StartHistoryCollection(const std::vector<GURL>& urls,
42 const base::Closure& callback); 41 const base::Closure& callback);
43 42
44 // Returns whether or not StartCacheCollection has been called. 43 // Returns whether or not StartCacheCollection has been called.
45 bool HasStarted() const; 44 bool HasStarted() const;
46 45
47 // Returns the redirect urls we get from history service 46 // Returns the redirect urls we get from history service
48 const std::vector<safe_browsing::RedirectChain>& GetCollectedUrls() const; 47 const std::vector<safe_browsing::RedirectChain>& GetCollectedUrls() const;
49 48
49 // content::NotificationObserver
50 virtual void Observe(int type,
51 const content::NotificationSource& source,
52 const content::NotificationDetails& details) OVERRIDE;
53
50 private: 54 private:
51 friend struct content::BrowserThread::DeleteOnThread< 55 friend struct content::BrowserThread::DeleteOnThread<
52 content::BrowserThread::UI>; 56 content::BrowserThread::UI>;
53 friend class base::DeleteHelper<MalwareDetailsRedirectsCollector>; 57 friend class base::DeleteHelper<MalwareDetailsRedirectsCollector>;
54 58
59 virtual ~MalwareDetailsRedirectsCollector();
60
61 void StartGetRedirects(const std::vector<GURL>& urls);
62 void GetRedirects(const GURL& url);
63 void OnGotQueryRedirectsTo(HistoryService::Handle handle,
64 GURL url,
65 bool success,
66 history::RedirectList* redirect_list);
67
68 // Posts the callback method back to IO thread when redirects collecting
69 // is all done.
70 void AllDone();
71
55 Profile* profile_; 72 Profile* profile_;
56 CancelableRequestConsumer request_consumer_; 73 CancelableRequestConsumer request_consumer_;
57 74
58 // Method we call when we are done. The caller must be alive for the 75 // Method we call when we are done. The caller must be alive for the
59 // whole time, we are modifying its state (see above). 76 // whole time, we are modifying its state (see above).
60 base::Closure callback_; 77 base::Closure callback_;
61 78
62 // Sets to true once StartHistoryCollection is called 79 // Sets to true once StartHistoryCollection is called
63 bool has_started_; 80 bool has_started_;
64 81
65 // The urls we need to get redirects for 82 // The urls we need to get redirects for
66 std::vector<GURL> urls_; 83 std::vector<GURL> urls_;
67 // The iterator goes over urls_ 84 // The iterator goes over urls_
68 std::vector<GURL>::iterator urls_it_; 85 std::vector<GURL>::iterator urls_it_;
69 // The collected directs from history service 86 // The collected directs from history service
70 std::vector<safe_browsing::RedirectChain> redirects_urls_; 87 std::vector<safe_browsing::RedirectChain> redirects_urls_;
71 88
72 content::NotificationRegistrar registrar_; 89 content::NotificationRegistrar registrar_;
73 90
74 void StartGetRedirects(const std::vector<GURL>& urls);
75 void GetRedirects(const GURL& url);
76 void OnGotQueryRedirectsTo(HistoryService::Handle handle,
77 GURL url,
78 bool success,
79 history::RedirectList* redirect_list);
80
81 // Posts the callback method back to IO thread when redirects collecting
82 // is all done.
83 void AllDone();
84
85 virtual void Observe(int type,
86 const content::NotificationSource& source,
87 const content::NotificationDetails& details) OVERRIDE;
88
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_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/malware_details_cache.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