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

Unified Diff: chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h

Issue 2399823002: Extract the SafeSearch client to a separate directory (Closed)
Patch Set: Renamed to safe_search_api Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h
diff --git a/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h b/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h
deleted file mode 100644
index 259ed959289705c28cd4ccd4ffcb781437e31e0d..0000000000000000000000000000000000000000
--- a/chrome/browser/supervised_user/experimental/supervised_user_async_url_checker.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 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.
-
-#ifndef CHROME_BROWSER_SUPERVISED_USER_EXPERIMENTAL_SUPERVISED_USER_ASYNC_URL_CHECKER_H_
-#define CHROME_BROWSER_SUPERVISED_USER_EXPERIMENTAL_SUPERVISED_USER_ASYNC_URL_CHECKER_H_
-
-#include <stddef.h>
-
-#include "base/callback_forward.h"
-#include "base/containers/mru_cache.h"
-#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"
-
-namespace net {
-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 {
- public:
- // Returns whether |url| should be blocked. Called from CheckURL.
- using CheckCallback =
- base::Callback<void(const GURL&,
- SupervisedUserURLFilter::FilteringBehavior,
- bool /* uncertain */)>;
-
- SupervisedUserAsyncURLChecker(net::URLRequestContextGetter* context);
- SupervisedUserAsyncURLChecker(net::URLRequestContextGetter* context,
- size_t cache_size);
- ~SupervisedUserAsyncURLChecker() override;
-
- // Returns whether |callback| was run synchronously.
- bool CheckURL(const GURL& url, const CheckCallback& callback);
-
- void SetCacheTimeoutForTesting(const base::TimeDelta& timeout) {
- cache_timeout_ = timeout;
- }
-
- private:
- struct Check;
- struct CheckResult {
- CheckResult(SupervisedUserURLFilter::FilteringBehavior behavior,
- bool uncertain);
- SupervisedUserURLFilter::FilteringBehavior behavior;
- bool uncertain;
- base::TimeTicks timestamp;
- };
-
- // net::URLFetcherDelegate implementation.
- void OnURLFetchComplete(const net::URLFetcher* source) override;
-
- net::URLRequestContextGetter* context_;
-
- ScopedVector<Check> checks_in_progress_;
-
- base::MRUCache<GURL, CheckResult> cache_;
- base::TimeDelta cache_timeout_;
-
- DISALLOW_COPY_AND_ASSIGN(SupervisedUserAsyncURLChecker);
-};
-
-#endif // CHROME_BROWSER_SUPERVISED_USER_EXPERIMENTAL_SUPERVISED_USER_ASYNC_URL_CHECKER_H_

Powered by Google App Engine
This is Rietveld 408576698