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

Side by Side Diff: components/safe_browsing/base_safe_browsing_service.cc

Issue 2605213002: componentize SafeBrowsingService (Closed)
Patch Set: Remove explicit return statements Created 3 years, 11 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
« no previous file with comments | « components/safe_browsing/base_safe_browsing_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/safe_browsing/base_safe_browsing_service.h"
6
7 #include <stddef.h>
8
9 #include "base/bind.h"
10 #include "base/macros.h"
11 #include "base/path_service.h"
12 #include "components/safe_browsing/common/safebrowsing_constants.h"
13 #include "components/safe_browsing_db/database_manager.h"
14 #include "components/safe_browsing_db/safe_browsing_prefs.h"
15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/resource_request_info.h"
17 #include "net/url_request/url_request_context.h"
18 #include "net/url_request/url_request_context_getter.h"
19
20 #if defined(SAFE_BROWSING_DB_REMOTE)
21 #include "components/safe_browsing_db/remote_database_manager.h"
22 #endif
23
24 using content::BrowserThread;
25
26 namespace safe_browsing {
27
28 BaseSafeBrowsingService::BaseSafeBrowsingService() : enabled_(false) {}
29
30 BaseSafeBrowsingService::~BaseSafeBrowsingService() {
31 // We should have already been shut down. If we're still enabled, then the
32 // database isn't going to be closed properly, which could lead to corruption.
33 DCHECK(!enabled_);
34 }
35
36 void BaseSafeBrowsingService::Initialize() {
37 // TODO(ntfschr): initialize ui_manager_ once CreateUIManager is componentized
38 }
39
40 void BaseSafeBrowsingService::ShutDown() {}
41
42 scoped_refptr<net::URLRequestContextGetter>
43 BaseSafeBrowsingService::url_request_context() {
44 DCHECK_CURRENTLY_ON(BrowserThread::UI);
45 return nullptr;
46 }
47
48 const scoped_refptr<SafeBrowsingDatabaseManager>&
49 BaseSafeBrowsingService::database_manager() const {
50 return database_manager_;
51 }
52
53 void BaseSafeBrowsingService::OnResourceRequest(
54 const net::URLRequest* request) {
55 DCHECK_CURRENTLY_ON(BrowserThread::IO);
56 }
57
58 SafeBrowsingDatabaseManager* BaseSafeBrowsingService::CreateDatabaseManager() {
59 // For the LocalSafeBrowsingDatabaseManager, use
60 // chrome/browser/safe_browsing_service
61 #if defined(SAFE_BROWSING_DB_REMOTE)
62 return new RemoteSafeBrowsingDatabaseManager();
63 #else
64 return NULL;
65 #endif
66 }
67
68 std::unique_ptr<BaseSafeBrowsingService::StateSubscription>
69 BaseSafeBrowsingService::RegisterStateCallback(
70 const base::Callback<void(void)>& callback) {
71 DCHECK_CURRENTLY_ON(BrowserThread::UI);
72 return state_callback_list_.Add(callback);
73 }
74
75 void BaseSafeBrowsingService::ProcessResourceRequest(
76 const ResourceRequestInfo& request) {
77 DCHECK_CURRENTLY_ON(BrowserThread::UI);
78 }
79
80 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing/base_safe_browsing_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698