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

Side by Side Diff: chrome/browser/download/download_safe_browsing_client.h

Issue 7134017: Make safe browsing work in a multi-profile environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: addressed sky's nit Created 9 years, 5 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_DOWNLOAD_DOWNLOAD_SAFE_BROWSING_CLIENT_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SAFE_BROWSING_CLIENT_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SAFE_BROWSING_CLIENT_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SAFE_BROWSING_CLIENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/callback_old.h" 9 #include "base/callback_old.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 17 matching lines...) Expand all
28 // } 28 // }
29 class DownloadSBClient 29 class DownloadSBClient
30 : public SafeBrowsingService::Client, 30 : public SafeBrowsingService::Client,
31 public base::RefCountedThreadSafe<DownloadSBClient> { 31 public base::RefCountedThreadSafe<DownloadSBClient> {
32 public: 32 public:
33 typedef Callback2<int32, bool>::Type UrlDoneCallback; 33 typedef Callback2<int32, bool>::Type UrlDoneCallback;
34 typedef Callback2<int32, bool>::Type HashDoneCallback; 34 typedef Callback2<int32, bool>::Type HashDoneCallback;
35 35
36 DownloadSBClient(int32 download_id, 36 DownloadSBClient(int32 download_id,
37 const std::vector<GURL>& url_chain, 37 const std::vector<GURL>& url_chain,
38 const GURL& referrer_url); 38 const GURL& referrer_url,
39 bool safe_browsing_enabled);
39 40
40 // Call safebrowsing service to verifiy the download. 41 // Call safebrowsing service to verify the download.
41 // For each DownloadSBClient instance, either CheckDownloadUrl or 42 // For each DownloadSBClient instance, either CheckDownloadUrl or
42 // CheckDownloadHash can be called, and be called only once. 43 // CheckDownloadHash can be called, and be called only once.
43 // DownloadSBClient instance. 44 // DownloadSBClient instance.
44 void CheckDownloadUrl(UrlDoneCallback* callback); 45 void CheckDownloadUrl(UrlDoneCallback* callback);
45 void CheckDownloadHash(const std::string& hash, HashDoneCallback* callback); 46 void CheckDownloadHash(const std::string& hash, HashDoneCallback* callback);
46 47
47 private: 48 private:
48 // Call SafeBrowsingService on IO thread to verify the download URL or 49 // Call SafeBrowsingService on IO thread to verify the download URL or
49 // hash of downloaded file. 50 // hash of downloaded file.
50 void CheckDownloadUrlOnIOThread(const std::vector<GURL>& url_chain); 51 void CheckDownloadUrlOnIOThread(const std::vector<GURL>& url_chain);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 int32 download_id_; 104 int32 download_id_;
104 scoped_refptr<SafeBrowsingService> sb_service_; 105 scoped_refptr<SafeBrowsingService> sb_service_;
105 106
106 // These URLs are used to report malware to safe browsing service. 107 // These URLs are used to report malware to safe browsing service.
107 std::vector<GURL> url_chain_; 108 std::vector<GURL> url_chain_;
108 GURL referrer_url_; 109 GURL referrer_url_;
109 110
110 // When a safebrowsing check starts, for stats purpose. 111 // When a safebrowsing check starts, for stats purpose.
111 base::TimeTicks start_time_; 112 base::TimeTicks start_time_;
112 113
114 // Whether the profile from which this client was created has enabled the
115 // safe browsing service.
116 bool safe_browsing_enabled_;
117
113 DISALLOW_COPY_AND_ASSIGN(DownloadSBClient); 118 DISALLOW_COPY_AND_ASSIGN(DownloadSBClient);
114 }; 119 };
115 120
116 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SAFE_BROWSING_CLIENT_H_ 121 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SAFE_BROWSING_CLIENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_safe_browsing_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698