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

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

Issue 2605213002: componentize SafeBrowsingService (Closed)
Patch Set: Removing some methods from base class and addressing comments 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
Jialiu Lin 2017/01/04 01:36:34 2017
Nate Fischer 2017/01/04 01:45:59 done
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 return;
39 }
40
41 void BaseSafeBrowsingService::ShutDown() {
42 return;
43 }
44
45 scoped_refptr<net::URLRequestContextGetter>
46 BaseSafeBrowsingService::url_request_context() {
47 DCHECK_CURRENTLY_ON(BrowserThread::UI);
48 return nullptr;
49 }
50
51 const scoped_refptr<SafeBrowsingDatabaseManager>&
52 BaseSafeBrowsingService::database_manager() const {
53 return database_manager_;
54 }
55
56 void BaseSafeBrowsingService::OnResourceRequest(
57 const net::URLRequest* request) {
58 DCHECK_CURRENTLY_ON(BrowserThread::IO);
59 }
60
61 SafeBrowsingDatabaseManager* BaseSafeBrowsingService::CreateDatabaseManager() {
62 #if defined(SAFE_BROWSING_DB_REMOTE)
Jialiu Lin 2017/01/04 01:36:34 Maybe add a comment here to tell others if they ne
Nate Fischer 2017/01/04 01:45:59 Done
63 return new RemoteSafeBrowsingDatabaseManager();
64 #else
65 return NULL;
66 #endif
67 }
68
69 std::unique_ptr<BaseSafeBrowsingService::StateSubscription>
70 BaseSafeBrowsingService::RegisterStateCallback(
71 const base::Callback<void(void)>& callback) {
72 DCHECK_CURRENTLY_ON(BrowserThread::UI);
73 return state_callback_list_.Add(callback);
74 }
75
76 void BaseSafeBrowsingService::ProcessResourceRequest(
77 const ResourceRequestInfo& request) {
78 DCHECK_CURRENTLY_ON(BrowserThread::UI);
79 return;
Jialiu Lin 2017/01/04 01:36:34 don't need this return.
Nate Fischer 2017/01/04 01:45:59 Done. Should I also remove the explicit returns in
Jialiu Lin 2017/01/04 01:51:28 Yes, sounds good.
80 }
81
82 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698