Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "chrome/browser/safe_browsing/malware_details.h" | 28 #include "chrome/browser/safe_browsing/malware_details.h" |
| 29 #include "chrome/browser/safe_browsing/ping_manager.h" | 29 #include "chrome/browser/safe_browsing/ping_manager.h" |
| 30 #include "chrome/browser/safe_browsing/protocol_manager.h" | 30 #include "chrome/browser/safe_browsing/protocol_manager.h" |
| 31 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 31 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
| 32 #include "chrome/browser/safe_browsing/ui_manager.h" | 32 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 33 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
| 34 #include "chrome/common/chrome_notification_types.h" | 34 #include "chrome/common/chrome_notification_types.h" |
| 35 #include "chrome/common/chrome_paths.h" | 35 #include "chrome/common/chrome_paths.h" |
| 36 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
| 37 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/common/startup_metric_utils.h" | |
| 38 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
| 39 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
| 41 #include "net/cookies/cookie_monster.h" | 42 #include "net/cookies/cookie_monster.h" |
| 42 #include "net/url_request/url_request_context.h" | 43 #include "net/url_request/url_request_context.h" |
| 43 #include "net/url_request/url_request_context_getter.h" | 44 #include "net/url_request/url_request_context_getter.h" |
| 44 | 45 |
| 45 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 46 #include "chrome/installer/util/browser_distribution.h" | 47 #include "chrome/installer/util/browser_distribution.h" |
| 47 #endif | 48 #endif |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 enabled_(false) { | 158 enabled_(false) { |
| 158 } | 159 } |
| 159 | 160 |
| 160 SafeBrowsingService::~SafeBrowsingService() { | 161 SafeBrowsingService::~SafeBrowsingService() { |
| 161 // We should have already been shut down. If we're still enabled, then the | 162 // We should have already been shut down. If we're still enabled, then the |
| 162 // database isn't going to be closed properly, which could lead to corruption. | 163 // database isn't going to be closed properly, which could lead to corruption. |
| 163 DCHECK(!enabled_); | 164 DCHECK(!enabled_); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void SafeBrowsingService::Initialize() { | 167 void SafeBrowsingService::Initialize() { |
| 168 startup_metric_utils::ScopedSlowStartupUMA | |
| 169 scoped_timer("Startup.SlowStartupSafeBrowsingServiceInitialize"); | |
|
Scott Hess - ex-Googler
2013/01/07 21:47:25
I'm less certain about what this will measure. I
jeremy
2013/01/10 15:08:39
Neither would I, but I think if nothing else it'll
| |
| 170 | |
| 167 url_request_context_getter_ = | 171 url_request_context_getter_ = |
| 168 new SafeBrowsingURLRequestContextGetter(this); | 172 new SafeBrowsingURLRequestContextGetter(this); |
| 169 | 173 |
| 170 ui_manager_ = CreateUIManager(); | 174 ui_manager_ = CreateUIManager(); |
| 171 | 175 |
| 172 database_manager_ = CreateDatabaseManager(); | 176 database_manager_ = CreateDatabaseManager(); |
| 173 | 177 |
| 174 BrowserThread::PostTask( | 178 BrowserThread::PostTask( |
| 175 BrowserThread::IO, FROM_HERE, | 179 BrowserThread::IO, FROM_HERE, |
| 176 base::Bind( | 180 base::Bind( |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 #if defined(FULL_SAFE_BROWSING) | 464 #if defined(FULL_SAFE_BROWSING) |
| 461 if (csd_service_.get()) | 465 if (csd_service_.get()) |
| 462 csd_service_->SetEnabledAndRefreshState(enable); | 466 csd_service_->SetEnabledAndRefreshState(enable); |
| 463 if (download_service_.get()) { | 467 if (download_service_.get()) { |
| 464 download_service_->SetEnabled( | 468 download_service_->SetEnabled( |
| 465 enable && !CommandLine::ForCurrentProcess()->HasSwitch( | 469 enable && !CommandLine::ForCurrentProcess()->HasSwitch( |
| 466 switches::kDisableImprovedDownloadProtection)); | 470 switches::kDisableImprovedDownloadProtection)); |
| 467 } | 471 } |
| 468 #endif | 472 #endif |
| 469 } | 473 } |
| OLD | NEW |