Chromium Code Reviews| Index: chrome/browser/safe_search/safe_search_url_checker.h |
| diff --git a/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h b/chrome/browser/safe_search/safe_search_url_checker.h |
| similarity index 54% |
| rename from chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h |
| rename to chrome/browser/safe_search/safe_search_url_checker.h |
| index 259ed959289705c28cd4ccd4ffcb781437e31e0d..3859361c402821af253532c200806c24697e3ff4 100644 |
| --- a/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h |
| +++ b/chrome/browser/safe_search/safe_search_url_checker.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_SUPERVISED_USER_EXPERIMENTAL_SUPERVISED_USER_ASYNC_URL_CHECKER_H_ |
| -#define CHROME_BROWSER_SUPERVISED_USER_EXPERIMENTAL_SUPERVISED_USER_ASYNC_URL_CHECKER_H_ |
| +#ifndef CHROME_BROWSER_SAFE_SEARCH_SAFE_SEARCH_URL_CHECKER_H_ |
| +#define CHROME_BROWSER_SAFE_SEARCH_SAFE_SEARCH_URL_CHECKER_H_ |
| #include <stddef.h> |
| @@ -12,7 +12,6 @@ |
| #include "base/macros.h" |
| #include "base/memory/scoped_vector.h" |
| #include "base/time/time.h" |
| -#include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| #include "net/url_request/url_fetcher_delegate.h" |
| #include "url/gurl.h" |
| @@ -21,21 +20,26 @@ class URLFetcher; |
| class URLRequestContextGetter; |
| } |
| -// This class checks against an online service (the SafeSearch API) whether a |
| -// given URL is safe to visit for a supervised user, and returns the result |
| -// asynchronously via a callback. |
| -class SupervisedUserAsyncURLChecker : net::URLFetcherDelegate { |
| +// This class uses the SafeSearch API to check the SafeSearch classification |
| +// of the content on a given URL and returns the result asynchronously |
| +// via a callback. |
| +class SafeSearchURLChecker : net::URLFetcherDelegate { |
| public: |
| + enum Classification { |
|
Marc Treib
2016/10/06 13:16:42
optional: Make this an enum class?
msramek
2016/10/06 15:08:41
Done.
|
| + SAFE, |
| + UNSAFE |
| + }; |
| + |
| // Returns whether |url| should be blocked. Called from CheckURL. |
| using CheckCallback = |
| base::Callback<void(const GURL&, |
| - SupervisedUserURLFilter::FilteringBehavior, |
| + Classification classification, |
| bool /* uncertain */)>; |
| - SupervisedUserAsyncURLChecker(net::URLRequestContextGetter* context); |
| - SupervisedUserAsyncURLChecker(net::URLRequestContextGetter* context, |
| - size_t cache_size); |
| - ~SupervisedUserAsyncURLChecker() override; |
| + explicit SafeSearchURLChecker(net::URLRequestContextGetter* context); |
| + SafeSearchURLChecker(net::URLRequestContextGetter* context, |
| + size_t cache_size); |
| + ~SafeSearchURLChecker() override; |
| // Returns whether |callback| was run synchronously. |
| bool CheckURL(const GURL& url, const CheckCallback& callback); |
| @@ -47,9 +51,8 @@ class SupervisedUserAsyncURLChecker : net::URLFetcherDelegate { |
| private: |
| struct Check; |
| struct CheckResult { |
| - CheckResult(SupervisedUserURLFilter::FilteringBehavior behavior, |
| - bool uncertain); |
| - SupervisedUserURLFilter::FilteringBehavior behavior; |
| + CheckResult(Classification classification, bool uncertain); |
| + Classification classification; |
| bool uncertain; |
| base::TimeTicks timestamp; |
| }; |
| @@ -64,7 +67,7 @@ class SupervisedUserAsyncURLChecker : net::URLFetcherDelegate { |
| base::MRUCache<GURL, CheckResult> cache_; |
| base::TimeDelta cache_timeout_; |
| - DISALLOW_COPY_AND_ASSIGN(SupervisedUserAsyncURLChecker); |
| + DISALLOW_COPY_AND_ASSIGN(SafeSearchURLChecker); |
| }; |
| -#endif // CHROME_BROWSER_SUPERVISED_USER_EXPERIMENTAL_SUPERVISED_USER_ASYNC_URL_CHECKER_H_ |
| +#endif // CHROME_BROWSER_SAFE_SEARCH_SAFE_SEARCH_URL_CHECKER_H_ |