summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing/safe_browsing_api_handler.h
blob: 90d43144137727b04e1231c702987249aa988570 (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
// 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.
//
// Glue to pass Safe Browsing API requests between
// RemoteSafeBrowsingDatabaseManager and Java-based API to check URLs.

#ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_H_
#define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_H_

#include <string>
#include <vector>

#include "base/callback.h"
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
#include "url/gurl.h"

class SafeBrowsingApiHandler {
 public:
  // Singleton interface.
  static void SetInstance(SafeBrowsingApiHandler* instance);
  static SafeBrowsingApiHandler* GetInstance();

  typedef base::Callback<void(SBThreatType sb_threat_type,
                              const std::string& metadata)> URLCheckCallback;

  // Makes Native->Java call and invokes callback when check is done.
  virtual void StartURLCheck(const URLCheckCallback& callback,
                             const GURL& url,
                             const std::vector<SBThreatType>& threat_types) = 0;

  virtual ~SafeBrowsingApiHandler() {}

 private:
  // Pointer not owned.
  static SafeBrowsingApiHandler* instance_;
};
#endif  // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_API_HANDLER_H_