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

Unified Diff: chrome/browser/managed_mode/managed_mode_url_filter.h

Issue 11826059: Add ManagedUserService for profile-specific managed user data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 7 years, 11 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/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 53a53ea2ea383e7e0762df598a58f9703c4f98a1..cb2020bc8117b6d6deb96ebe76bd0f4e662923e1 100644
--- a/chrome/browser/managed_mode/managed_mode_url_filter.h
+++ b/chrome/browser/managed_mode/managed_mode_url_filter.h
@@ -6,13 +6,14 @@
#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/observer_list.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;
@@ -23,9 +24,12 @@ 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 {
+// References to it can be passed around on different threads (the refcounting
+// is thread-safe), but the object itself should always be accessed on the same
+// thread (member access isn't thread-safe).
+class ManagedModeURLFilter
+ : public base::RefCountedThreadSafe<ManagedModeURLFilter>,
+ public base::NonThreadSafe {
public:
enum FilteringBehavior {
ALLOW,
@@ -41,7 +45,6 @@ class ManagedModeURLFilter : public base::NonThreadSafe {
struct Contents;
ManagedModeURLFilter();
- ~ManagedModeURLFilter();
static FilteringBehavior BehaviorFromInt(int behavior_value);
@@ -65,8 +68,8 @@ class ManagedModeURLFilter : public base::NonThreadSafe {
void SetFromPatterns(const std::vector<std::string>& patterns);
// 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.
@@ -77,11 +80,13 @@ class ManagedModeURLFilter : public base::NonThreadSafe {
void RemoveObserver(Observer* observer);
private:
+ friend class base::RefCountedThreadSafe<ManagedModeURLFilter>;
+ ~ManagedModeURLFilter();
+
void SetContents(scoped_ptr<Contents> url_matcher);
ObserverList<Observer> observers_;
- base::WeakPtrFactory<ManagedModeURLFilter> weak_ptr_factory_;
FilteringBehavior default_behavior_;
scoped_ptr<Contents> contents_;

Powered by Google App Engine
This is Rietveld 408576698