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

Unified Diff: chrome/browser/safe_browsing/malware_details.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 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/malware_details.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/malware_details.h
===================================================================
--- chrome/browser/safe_browsing/malware_details.h (revision 0)
+++ chrome/browser/safe_browsing/malware_details.h (revision 0)
@@ -0,0 +1,68 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_
+#define CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_
+#pragma once
+
+// A class that encapsulates the detailed malware reports sent when
+// users opt-in to do so from the malware warning page.
+
+// An instance of this class is generated when a malware warning page
+// is shown (SafeBrowsingBlockingPage). It is passed on to the
+// SafeBrowsing service when the warning goes away.
+
+#include <string>
+#include <vector>
+
+#include "base/hash_tables.h"
+#include "base/linked_ptr.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/safe_browsing/report.pb.h"
+#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+
+class TabContents;
+
+class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails> {
+ public:
+ MalwareDetails(TabContents* tab_contents,
+ const SafeBrowsingService::UnsafeResource resource);
+
+ // The SafeBrowsingService calls this from the IO thread, to get the
+ // serialized report as a string and send it over.
+ const std::string* GetSerializedReport();
+
+ private:
+ friend class base::RefCountedThreadSafe<MalwareDetails>;
+
+ typedef base::hash_map<
+ std::string,
+ linked_ptr<safe_browsing::ClientMalwareReportRequest::Resource> >
+ ResourceMap;
+
+ // Starts the collection of the report.
+ void StartCollection();
+
+ // Whether the url is "public" so we can add it to the report.
+ bool IsPublicUrl(const GURL& url) const;
+
+ // Adds a node to |urls_|. |parent| can be empty.
+ void AddNode(const std::string& url, const std::string& parent);
+
+ ~MalwareDetails();
+
+ TabContents* tab_contents_;
+ const SafeBrowsingService::UnsafeResource resource_;
+
+ // The urls that we collect. We first add them into this map and then
+ // generate a protocol buffer from it.
+ ResourceMap urls_;
+
+ // The report protocol buffer.
+ scoped_ptr<safe_browsing::ClientMalwareReportRequest> report_;
+
+ DISALLOW_COPY_AND_ASSIGN(MalwareDetails);
+};
+
+#endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_H_
Property changes on: chrome/browser/safe_browsing/malware_details.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/malware_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698