blob: 178a35dacd098a5978e19a953b66bdeb3782f6b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/bind.h"
#include "components/safe_browsing_db/safe_browsing_api_handler.h"
namespace safe_browsing {
namespace {
// TODO(nparker): Remove this as part of crbug/589610.
void OnRequestDoneShim(
const SafeBrowsingApiHandler::URLCheckCallbackMeta& callback,
SBThreatType sb_threat_type,
const std::string& raw_metadata) {
ThreatMetadata metadata_struct;
metadata_struct.raw_metadata = raw_metadata;
callback.Run(sb_threat_type, metadata_struct);
}
} // namespace
SafeBrowsingApiHandler* SafeBrowsingApiHandler::instance_ = NULL;
// static
void SafeBrowsingApiHandler::SetInstance(SafeBrowsingApiHandler* instance) {
instance_ = instance;
}
// static
SafeBrowsingApiHandler* SafeBrowsingApiHandler::GetInstance() {
return instance_;
}
// TODO(nparker): Remove this as part of crbug/589610.
// Default impl since clank/ code doesn't yet support this.
void SafeBrowsingApiHandler::StartURLCheck(
const URLCheckCallbackMeta& callback,
const GURL& url,
const std::vector<SBThreatType>& threat_types) {
URLCheckCallback impl_callback = base::Bind(OnRequestDoneShim, callback);
StartURLCheck(impl_callback, url, threat_types);
}
} // namespace safe_browsing
|