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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 6708059: Turn on client-side phishing detection for UMA users with SafeBrowsing enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable client-side phishing detection on ChromeOS Created 9 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) 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 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 client, 236 client,
237 NewRunnableMethod(this, 237 NewRunnableMethod(this,
238 &SafeBrowsingService::CheckDownloadHashOnSBThread, 238 &SafeBrowsingService::CheckDownloadHashOnSBThread,
239 check), 239 check),
240 download_hashcheck_timeout_ms_); 240 download_hashcheck_timeout_ms_);
241 return false; 241 return false;
242 } 242 }
243 243
244 bool SafeBrowsingService::MatchCsdWhitelistUrl(const GURL& url) { 244 bool SafeBrowsingService::MatchCsdWhitelistUrl(const GURL& url) {
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
246 DCHECK(enable_csd_whitelist_);
247 if (!enabled_ || !enable_csd_whitelist_ || !MakeDatabaseAvailable()) { 246 if (!enabled_ || !enable_csd_whitelist_ || !MakeDatabaseAvailable()) {
248 // There is something funky going on here. Just to be safe we return 247 // There is something funky going on here -- for example, perhaps the user
249 // true in this case. 248 // has not restarted since enabling metrics reporting, so we haven't
249 // enabled the csd whitelist yet. Just to be safe we return true in this
250 // case.
250 return true; 251 return true;
251 } 252 }
252 return database_->ContainsCsdWhitelistedUrl(url); 253 return database_->ContainsCsdWhitelistedUrl(url);
253 } 254 }
254 255
255 bool SafeBrowsingService::CheckBrowseUrl(const GURL& url, 256 bool SafeBrowsingService::CheckBrowseUrl(const GURL& url,
256 Client* client) { 257 Client* client) {
257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
258 if (!enabled_) 259 if (!enabled_)
259 return true; 260 return true;
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 GetDefaultProfile()->GetRequestContext()); 875 GetDefaultProfile()->GetRequestContext());
875 876
876 CommandLine* cmdline = CommandLine::ForCurrentProcess(); 877 CommandLine* cmdline = CommandLine::ForCurrentProcess();
877 enable_download_protection_ = 878 enable_download_protection_ =
878 !cmdline->HasSwitch(switches::kSbDisableDownloadProtection); 879 !cmdline->HasSwitch(switches::kSbDisableDownloadProtection);
879 880
880 // We only download the csd-whitelist if client-side phishing detection is 881 // We only download the csd-whitelist if client-side phishing detection is
881 // enabled and if the user has opted in with stats collection. Note: we 882 // enabled and if the user has opted in with stats collection. Note: we
882 // cannot check whether the metrics_service() object is created because it 883 // cannot check whether the metrics_service() object is created because it
883 // may be initialized after this method is called. 884 // may be initialized after this method is called.
885 #ifdef OS_CHROMEOS
886 // Client-side detection is disabled on ChromeOS for now, so don't bother
887 // downloading the whitelist.
888 enable_csd_whitelist_ = false;
889 #else
884 enable_csd_whitelist_ = 890 enable_csd_whitelist_ =
885 (cmdline->HasSwitch(switches::kEnableClientSidePhishingDetection) && 891 (!cmdline->HasSwitch(switches::kDisableClientSidePhishingDetection) &&
886 local_state && local_state->GetBoolean(prefs::kMetricsReportingEnabled)); 892 local_state && local_state->GetBoolean(prefs::kMetricsReportingEnabled));
893 #endif
887 894
888 BrowserThread::PostTask( 895 BrowserThread::PostTask(
889 BrowserThread::IO, FROM_HERE, 896 BrowserThread::IO, FROM_HERE,
890 NewRunnableMethod( 897 NewRunnableMethod(
891 this, &SafeBrowsingService::OnIOInitialize, client_key, wrapped_key, 898 this, &SafeBrowsingService::OnIOInitialize, client_key, wrapped_key,
892 request_context_getter)); 899 request_context_getter));
893 } 900 }
894 901
895 void SafeBrowsingService::OnCloseDatabase() { 902 void SafeBrowsingService::OnCloseDatabase() {
896 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop()); 903 DCHECK_EQ(MessageLoop::current(), safe_browsing_thread_->message_loop());
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 check->is_download = true; 1178 check->is_download = true;
1172 check->timeout_task = 1179 check->timeout_task =
1173 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check); 1180 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check);
1174 checks_.insert(check); 1181 checks_.insert(check);
1175 1182
1176 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1183 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1177 1184
1178 MessageLoop::current()->PostDelayedTask( 1185 MessageLoop::current()->PostDelayedTask(
1179 FROM_HERE, check->timeout_task, timeout_ms); 1186 FROM_HERE, check->timeout_task, timeout_ms);
1180 } 1187 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/browser_render_process_host.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698