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

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

Issue 8345033: Collect some histograms about signed binary downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 #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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 closing_database_(false), 168 closing_database_(false),
169 download_urlcheck_timeout_ms_(kDownloadUrlCheckTimeoutMs), 169 download_urlcheck_timeout_ms_(kDownloadUrlCheckTimeoutMs),
170 download_hashcheck_timeout_ms_(kDownloadHashCheckTimeoutMs) { 170 download_hashcheck_timeout_ms_(kDownloadHashCheckTimeoutMs) {
171 #if !defined(OS_CHROMEOS) 171 #if !defined(OS_CHROMEOS)
172 if (!CommandLine::ForCurrentProcess()->HasSwitch( 172 if (!CommandLine::ForCurrentProcess()->HasSwitch(
173 switches::kDisableClientSidePhishingDetection)) { 173 switches::kDisableClientSidePhishingDetection)) {
174 csd_service_.reset( 174 csd_service_.reset(
175 safe_browsing::ClientSideDetectionService::Create( 175 safe_browsing::ClientSideDetectionService::Create(
176 g_browser_process->system_request_context())); 176 g_browser_process->system_request_context()));
177 } 177 }
178 if (CommandLine::ForCurrentProcess()->HasSwitch( 178 download_service_ = new safe_browsing::DownloadProtectionService(
179 switches::kEnableImprovedDownloadProtection)) { 179 AsWeakPtr(),
180 download_service_ = new safe_browsing::DownloadProtectionService( 180 g_browser_process->system_request_context());
181 this,
182 g_browser_process->system_request_context());
183 }
184 #endif 181 #endif
185 } 182 }
186 183
187 SafeBrowsingService::~SafeBrowsingService() { 184 SafeBrowsingService::~SafeBrowsingService() {
188 // Deletes the PrefChangeRegistrars, whose dtors also unregister |this| as an 185 // Deletes the PrefChangeRegistrars, whose dtors also unregister |this| as an
189 // observer of the preferences. 186 // observer of the preferences.
190 STLDeleteValues(&prefs_map_); 187 STLDeleteValues(&prefs_map_);
191 188
192 // We should have already been shut down. If we're still enabled, then the 189 // We should have already been shut down. If we're still enabled, then the
193 // database isn't going to be closed properly, which could lead to corruption. 190 // database isn't going to be closed properly, which could lead to corruption.
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 } 1358 }
1362 } 1359 }
1363 1360
1364 if (enable) 1361 if (enable)
1365 Start(); 1362 Start();
1366 else 1363 else
1367 Stop(); 1364 Stop();
1368 1365
1369 if (csd_service_.get()) 1366 if (csd_service_.get())
1370 csd_service_->SetEnabled(enable); 1367 csd_service_->SetEnabled(enable);
1371 if (download_service_.get()) 1368 if (download_service_.get()) {
1372 download_service_->SetEnabled(enable); 1369 download_service_->SetEnabled(
1370 enable && CommandLine::ForCurrentProcess()->HasSwitch(
1371 switches::kEnableImprovedDownloadProtection));
mattm 2011/10/19 18:54:12 So this isn't aiming to get histograms from users
Brian Ryner 2011/10/19 19:20:11 It will, because we only check the "enabled" state
1372 }
1373 } 1373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698