Chromium Code Reviews| Index: chrome/browser/managed_mode_url_filter.h |
| diff --git a/chrome/browser/managed_mode_url_filter.h b/chrome/browser/managed_mode_url_filter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..64a766a724d4d01535966235f4ee4badd591fab3 |
| --- /dev/null |
| +++ b/chrome/browser/managed_mode_url_filter.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2012 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_MANAGED_MODE_URL_FILTER_H_ |
| +#define CHROME_BROWSER_MANAGED_MODE_URL_FILTER_H_ |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_vector.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/threading/non_thread_safe.h" |
| +#include "base/values.h" |
| + |
| +class FilePath; |
| +class GURL; |
| + |
| +namespace extensions { |
| +class URLMatcher; |
| +} |
| + |
| +class ManagedModeURLFilter : public base::NonThreadSafe { |
| + public: |
| + ManagedModeURLFilter(); |
| + ~ManagedModeURLFilter(); |
|
battre
2012/08/14 11:58:33
virtual?
Bernhard Bauer
2012/08/14 15:36:57
This class is never destructed via a superclass, s
|
| + |
| + // Returns true if the URL is matched by the filter. |
| + bool IsURLWhitelisted(const GURL& url) const; |
| + |
| + // Sets whether the filter is active or not. If the filter is inactive, it |
| + // won't match any URL. |
|
battre
2012/08/14 11:58:33
nit: add comment that this is inactive by default?
battre
2012/08/14 11:58:33
What does it mean "it won't match any URLs"? -> ma
Bernhard Bauer
2012/08/14 15:36:57
Done.
Bernhard Bauer
2012/08/14 15:36:57
Done.
|
| + void SetActive(bool in_managed_mode); |
| + |
| + // Sets the whitelist from the passed in list of |patterns|. |
| + void SetWhitelist(const std::vector<std::string>& patterns, |
| + const base::Closure& continuation); |
| + |
| + private: |
| + void SetURLMatcher(const base::Closure& callback, |
| + scoped_ptr<extensions::URLMatcher> url_matcher); |
| + |
| + base::WeakPtrFactory<ManagedModeURLFilter> weak_ptr_factory_; |
| + bool active_; |
| + scoped_ptr<extensions::URLMatcher> url_matcher_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ManagedModeURLFilter); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_MANAGED_MODE_URL_FILTER_H_ |