blob: e00c04d33e708b680749fdfe3de338c6da9c7253 [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2019 The Chromium Authors
Caio Limaccae1072019-03-07 13:46:542// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_SAFE_SEARCH_API_URL_CHECKER_CLIENT_H_
6#define COMPONENTS_SAFE_SEARCH_API_URL_CHECKER_CLIENT_H_
7
Avi Drissman12be0312023-01-11 09:16:098#include "base/functional/callback_forward.h"
Caio Limaccae1072019-03-07 13:46:549#include "url/gurl.h"
10
11namespace safe_search_api {
12
13// The client representation of a URL classification by the service for the user
14// in the request context.
15enum class ClientClassification { kAllowed, kRestricted, kUnknown };
16
17// Interface to make the server request and check an URL.
18class URLCheckerClient {
19 public:
20 // Used to report whether |url| should be blocked. Called from CheckURL.
21 using ClientCheckCallback =
22 base::OnceCallback<void(const GURL&,
23 ClientClassification classification)>;
24
25 virtual ~URLCheckerClient() = default;
26
27 // Checks whether an |url| is restricted for the user in the request context.
28 //
29 // On success, the |callback| function is called with |url| as the first
30 // parameter, the result as second.
31 //
32 // Refer to the implementation class for documentation about error handling.
33 virtual void CheckURL(const GURL& url, ClientCheckCallback callback) = 0;
34};
35
36} // namespace safe_search_api
37
38#endif // COMPONENTS_SAFE_SEARCH_API_URL_CHECKER_CLIENT_H_