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

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

Issue 6713084: Move the rest of the renderer->browser messages that belong in content. Also do a bunch of cleanup: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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) 2010 The Chromium Authors. All rights reserved. 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 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_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_
7 #pragma once 7 #pragma once
8 8
9 // A class that encapsulates the detailed malware reports sent when 9 // A class that encapsulates the detailed malware reports sent when
10 // users opt-in to do so from the malware warning page. 10 // users opt-in to do so from the malware warning page.
11 11
12 // An instance of this class is generated when a malware warning page 12 // An instance of this class is generated when a malware warning page
13 // is shown (SafeBrowsingBlockingPage). It is passed on to the 13 // is shown (SafeBrowsingBlockingPage). It is passed on to the
14 // SafeBrowsing service when the warning goes away. 14 // SafeBrowsing service when the warning goes away.
15 15
16 #include <string> 16 #include <string>
17 #include <vector> 17 #include <vector>
18 18
19 #include "base/hash_tables.h" 19 #include "base/hash_tables.h"
20 #include "base/linked_ptr.h" 20 #include "base/linked_ptr.h"
21 #include "base/scoped_ptr.h" 21 #include "base/scoped_ptr.h"
22 #include "chrome/browser/safe_browsing/report.pb.h" 22 #include "chrome/browser/safe_browsing/report.pb.h"
23 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 23 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
24 #include "content/browser/tab_contents/tab_contents_observer.h" 24 #include "content/browser/tab_contents/tab_contents_observer.h"
25 25
26 class TabContents; 26 class TabContents;
27 struct ViewHostMsg_MalwareDOMDetails_Params; 27 struct SafeBrowsingHostMsg_MalwareDOMDetails_Node;
28 28
29 class MalwareDetailsFactory; 29 class MalwareDetailsFactory;
30 30
31 class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, 31 class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>,
32 public TabContentsObserver { 32 public TabContentsObserver {
33 public: 33 public:
34 // Constructs a new MalwareDetails instance, using the factory. 34 // Constructs a new MalwareDetails instance, using the factory.
35 static MalwareDetails* NewMalwareDetails( 35 static MalwareDetails* NewMalwareDetails(
36 TabContents* tab_contents, 36 TabContents* tab_contents,
37 const SafeBrowsingService::UnsafeResource& resource); 37 const SafeBrowsingService::UnsafeResource& resource);
(...skipping 12 matching lines...) Expand all
50 virtual bool OnMessageReceived(const IPC::Message& message); 50 virtual bool OnMessageReceived(const IPC::Message& message);
51 51
52 protected: 52 protected:
53 friend class MalwareDetailsFactoryImpl; 53 friend class MalwareDetailsFactoryImpl;
54 54
55 MalwareDetails(TabContents* tab_contents, 55 MalwareDetails(TabContents* tab_contents,
56 const SafeBrowsingService::UnsafeResource& resource); 56 const SafeBrowsingService::UnsafeResource& resource);
57 57
58 // Called on the IO thread with the DOM details. 58 // Called on the IO thread with the DOM details.
59 virtual void AddDOMDetails( 59 virtual void AddDOMDetails(
60 const ViewHostMsg_MalwareDOMDetails_Params& params); 60 const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params);
61 61
62 virtual ~MalwareDetails(); 62 virtual ~MalwareDetails();
63 63
64 private: 64 private:
65 friend class base::RefCountedThreadSafe<MalwareDetails>; 65 friend class base::RefCountedThreadSafe<MalwareDetails>;
66 66
67 // Maps a URL to its Resource. 67 // Maps a URL to its Resource.
68 typedef base::hash_map< 68 typedef base::hash_map<
69 std::string, 69 std::string,
70 linked_ptr<safe_browsing::ClientMalwareReportRequest::Resource> > 70 linked_ptr<safe_browsing::ClientMalwareReportRequest::Resource> >
(...skipping 13 matching lines...) Expand all
84 84
85 // Adds a Resource to resources_ with the given parent-child 85 // Adds a Resource to resources_ with the given parent-child
86 // relationship. |parent| and |tagname| can be empty, |children| can be NULL. 86 // relationship. |parent| and |tagname| can be empty, |children| can be NULL.
87 void AddUrl(const GURL& url, 87 void AddUrl(const GURL& url,
88 const GURL& parent, 88 const GURL& parent,
89 const std::string& tagname, 89 const std::string& tagname,
90 const std::vector<GURL>* children); 90 const std::vector<GURL>* children);
91 91
92 // Message handler. 92 // Message handler.
93 void OnReceivedMalwareDOMDetails( 93 void OnReceivedMalwareDOMDetails(
94 const ViewHostMsg_MalwareDOMDetails_Params& params); 94 const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params);
95 95
96 const SafeBrowsingService::UnsafeResource resource_; 96 const SafeBrowsingService::UnsafeResource resource_;
97 97
98 // For every Url we collect we create a Resource message. We keep 98 // For every Url we collect we create a Resource message. We keep
99 // them in a map so we can avoid duplicates. 99 // them in a map so we can avoid duplicates.
100 ResourceMap resources_; 100 ResourceMap resources_;
101 101
102 // The report protocol buffer. 102 // The report protocol buffer.
103 scoped_ptr<safe_browsing::ClientMalwareReportRequest> report_; 103 scoped_ptr<safe_browsing::ClientMalwareReportRequest> report_;
104 104
(...skipping 11 matching lines...) Expand all
116 class MalwareDetailsFactory { 116 class MalwareDetailsFactory {
117 public: 117 public:
118 virtual ~MalwareDetailsFactory() { } 118 virtual ~MalwareDetailsFactory() { }
119 119
120 virtual MalwareDetails* CreateMalwareDetails( 120 virtual MalwareDetails* CreateMalwareDetails(
121 TabContents* tab_contents, 121 TabContents* tab_contents,
122 const SafeBrowsingService::UnsafeResource& unsafe_resource) = 0; 122 const SafeBrowsingService::UnsafeResource& unsafe_resource) = 0;
123 }; 123 };
124 124
125 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_ 125 #endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/client_side_detection_service.h ('k') | chrome/browser/safe_browsing/malware_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698