Index: chrome/browser/managed_mode/managed_mode_url_filter.h |
diff --git a/chrome/browser/managed_mode/managed_mode_url_filter.h b/chrome/browser/managed_mode/managed_mode_url_filter.h |
index 6537af93de86fb763b3591994c614ac380632487..71333e9af9d8475d5a1d5f5b3634b5543cf4bf96 100644 |
--- a/chrome/browser/managed_mode/managed_mode_url_filter.h |
+++ b/chrome/browser/managed_mode/managed_mode_url_filter.h |
@@ -6,12 +6,13 @@ |
#define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_URL_FILTER_H_ |
#include "base/callback_forward.h" |
+#include "base/memory/ref_counted.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" |
#include "chrome/browser/managed_mode/managed_mode_site_list.h" |
+#include "chrome/browser/policy/url_blacklist_manager.h" |
namespace policy { |
class URLBlacklist; |
@@ -22,9 +23,11 @@ class GURL; |
// This class manages the filtering behavior for a given URL, i.e. it tells |
// callers if a given URL should be allowed, blocked or warned about. |
-// It is not thread-safe, so it can only be used on one thread, but that can be |
-// any thread. |
-class ManagedModeURLFilter : public base::NonThreadSafe { |
+// It can be passed around on different threads, but should always be accessed |
+// on the same thread. |
Pam (message me for reviews)
2013/01/14 14:12:42
Sorry, this comment isn't clear to me.
Bernhard Bauer
2013/01/15 14:24:44
I tried to clear it up a bit. What I wanted to con
Pam (message me for reviews)
2013/01/15 14:47:53
That right there is clear!
// References to it ca
Bernhard Bauer
2013/01/15 14:59:55
Done!
|
+class ManagedModeURLFilter |
+ : public base::RefCountedThreadSafe<ManagedModeURLFilter>, |
+ public base::NonThreadSafe { |
public: |
enum FilteringBehavior { |
ALLOW, |
@@ -35,7 +38,6 @@ class ManagedModeURLFilter : public base::NonThreadSafe { |
struct Contents; |
ManagedModeURLFilter(); |
- ~ManagedModeURLFilter(); |
static FilteringBehavior BehaviorFromInt(int behavior_value); |
@@ -61,8 +63,8 @@ class ManagedModeURLFilter : public base::NonThreadSafe { |
const base::Closure& continuation); |
// Sets the manual lists. |
- void SetManualLists(scoped_ptr<ListValue> whitelist, |
- scoped_ptr<ListValue> blacklist); |
+ void SetManualLists(const ListValue* whitelist, |
+ const ListValue* blacklist); |
// Adds a pattern to a manual list. If |is_whitelist| is true it gets added |
// to the whitelist, else to the blacklist. |
@@ -70,10 +72,12 @@ class ManagedModeURLFilter : public base::NonThreadSafe { |
const std::string& url_pattern); |
private: |
+ friend class base::RefCountedThreadSafe<ManagedModeURLFilter>; |
+ ~ManagedModeURLFilter(); |
+ |
void SetContents(const base::Closure& callback, |
scoped_ptr<Contents> url_matcher); |
- base::WeakPtrFactory<ManagedModeURLFilter> weak_ptr_factory_; |
FilteringBehavior default_behavior_; |
scoped_ptr<Contents> contents_; |