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

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

Issue 4822002: Send malware reports when a user opts-in from the safe browsing interstitial ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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) 2010 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_REPORT_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_MALWARE_REPORT_H_
7 #pragma once
8
9 // A class that encapsulates the detailed malware reports sent when
10 // users opt-in to do so from the malware warning page.
11
12 // An instance of this class is generated when a malware warning page
13 // is shown (SafeBrowsingBlockingPage). It is passed on to the
14 // SafeBrowsing service when the warning goes away.
15
16 #include <string>
17 #include <vector>
18
19 #include "base/hash_tables.h"
20 #include "base/scoped_ptr.h"
21 #include "base/linked_ptr.h"
lzheng 2010/11/16 00:18:12 header orders: linked_ptr.h should be moved before
panayiotis 2010/11/18 22:04:37 Done.
22 #include "chrome/browser/safe_browsing/csd.pb.h"
23 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
24
25 class TabContents;
26
27 class SafeBrowsingMalwareReport: public base::RefCountedThreadSafe<
lzheng 2010/11/16 00:18:12 there should be a space before ':'. And I would su
panayiotis 2010/11/18 22:04:37 Done.
28 SafeBrowsingMalwareReport> {
29 public:
30 SafeBrowsingMalwareReport(
31 TabContents* tab_contents,
32 const SafeBrowsingService::UnsafeResource resource);
33
34 // The SafeBrowsingService calls this from the IO thread, to get the
35 // serialized report as a string and send it over.
36 const std::string* GetSerializedReport();
37
38 private:
39 friend class base::RefCountedThreadSafe<SafeBrowsingMalwareReport>;
40
41 typedef base::hash_map<
42 std::string,
43 linked_ptr<safe_browsing::ClientMalwareReportRequest::Resource> >
44 ResourceMap;
45
46 // Starts the collection of the report.
47 void StartCollection();
48
49 // Whether the url is "public" so we can add it to the report.
50 bool IsPublicUrl(const GURL& url) const;
51
52 // Adds a node to |urls_|. |parent| can be empty.
53 void AddNode(const std::string& url, const std::string& parent);
54
55 ~SafeBrowsingMalwareReport();
56
57 TabContents* tab_contents_;
58 const SafeBrowsingService::UnsafeResource resource_;
59
60 // The urls that we collect. We first add them into this map and then
61 // generate a protocol buffer from it.
62 ResourceMap urls_;
63
64 // The report protocol buffer.
65 scoped_ptr<safe_browsing::ClientMalwareReportRequest> report_;
66
67 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingMalwareReport);
68 };
69
70 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_REPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698