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

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

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 6 years, 6 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
OLDNEW
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/database_manager.h" 5 #include "chrome/browser/safe_browsing/database_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 23 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
24 #include "chrome/browser/safe_browsing/download_protection_service.h" 24 #include "chrome/browser/safe_browsing/download_protection_service.h"
25 #include "chrome/browser/safe_browsing/malware_details.h" 25 #include "chrome/browser/safe_browsing/malware_details.h"
26 #include "chrome/browser/safe_browsing/protocol_manager.h" 26 #include "chrome/browser/safe_browsing/protocol_manager.h"
27 #include "chrome/browser/safe_browsing/safe_browsing_database.h" 27 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
28 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 28 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
29 #include "chrome/browser/safe_browsing/ui_manager.h" 29 #include "chrome/browser/safe_browsing/ui_manager.h"
30 #include "chrome/common/chrome_constants.h" 30 #include "chrome/common/chrome_constants.h"
31 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/url_constants.h"
34 #include "components/startup_metric_utils/startup_metric_utils.h" 33 #include "components/startup_metric_utils/startup_metric_utils.h"
35 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
36 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
36 #include "url/url_constants.h"
37 37
38 using content::BrowserThread; 38 using content::BrowserThread;
39 39
40 namespace { 40 namespace {
41 41
42 // Timeout for match checks, e.g. download URLs, hashes. 42 // Timeout for match checks, e.g. download URLs, hashes.
43 const int kCheckTimeoutMs = 10000; 43 const int kCheckTimeoutMs = 10000;
44 44
45 // Records disposition information about the check. |hit| should be 45 // Records disposition information about the check. |hit| should be
46 // |true| if there were any prefix hits in |full_hashes|. 46 // |true| if there were any prefix hits in |full_hashes|.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 SIDE_EFFECT_FREE_WHITELIST_STATUS_MAX); 214 SIDE_EFFECT_FREE_WHITELIST_STATUS_MAX);
215 } 215 }
216 216
217 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { 217 SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() {
218 // We should have already been shut down. If we're still enabled, then the 218 // We should have already been shut down. If we're still enabled, then the
219 // database isn't going to be closed properly, which could lead to corruption. 219 // database isn't going to be closed properly, which could lead to corruption.
220 DCHECK(!enabled_); 220 DCHECK(!enabled_);
221 } 221 }
222 222
223 bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { 223 bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const {
224 return url.SchemeIs(content::kFtpScheme) || 224 return url.SchemeIs(url::kFtpScheme) ||
225 url.SchemeIs(url::kHttpScheme) || 225 url.SchemeIs(url::kHttpScheme) ||
226 url.SchemeIs(url::kHttpsScheme); 226 url.SchemeIs(url::kHttpsScheme);
227 } 227 }
228 228
229 bool SafeBrowsingDatabaseManager::CheckDownloadUrl( 229 bool SafeBrowsingDatabaseManager::CheckDownloadUrl(
230 const std::vector<GURL>& url_chain, 230 const std::vector<GURL>& url_chain,
231 Client* client) { 231 Client* client) {
232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
233 if (!enabled_ || !enable_download_protection_) 233 if (!enabled_ || !enable_download_protection_)
234 return true; 234 return true;
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); 1012 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this));
1013 checks_.insert(check); 1013 checks_.insert(check);
1014 1014
1015 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1015 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1016 1016
1017 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, 1017 base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
1018 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, 1018 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback,
1019 check->timeout_factory_->GetWeakPtr(), check), 1019 check->timeout_factory_->GetWeakPtr(), check),
1020 check_timeout_); 1020 check_timeout_);
1021 } 1021 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/offline_resource_throttle.cc ('k') | chrome/browser/search_engines/template_url_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698