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

Side by Side Diff: chrome/browser/managed_mode/managed_mode.h

Issue 11299035: Support manual (white|black)list, previewing and allowing after interstitial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes according to comments. Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "chrome/browser/extensions/management_policy.h" 16 #include "chrome/browser/extensions/management_policy.h"
17 #include "chrome/browser/ui/browser_list_observer.h" 17 #include "chrome/browser/ui/browser_list_observer.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 20
21 class Browser; 21 class Browser;
22 template<typename T> 22 template<typename T>
23 struct DefaultSingletonTraits; 23 struct DefaultSingletonTraits;
24 class ManagedModeSiteList; 24 class ManagedModeSiteList;
25 class ManagedModeURLFilter; 25 class ManagedModeURLFilter;
26 class PrefChangeRegistrar; 26 class PrefChangeRegistrar;
27 class PrefService; 27 class PrefService;
28 class Profile; 28 class Profile;
29
29 namespace policy{ 30 namespace policy{
30 class URLBlacklist; 31 class URLBlacklist;
31 } 32 }
32 33
33 // Managed mode allows one person to manage the Chrome experience for another 34 // Managed mode allows one person to manage the Chrome experience for another
34 // person by pre-configuring and then locking a managed User profile. 35 // person by pre-configuring and then locking a managed User profile.
35 // The ManagedMode class provides methods to check whether the browser is in 36 // The ManagedMode class provides methods to check whether the browser is in
36 // managed mode, and to attempt to enter or leave managed mode. 37 // managed mode, and to attempt to enter or leave managed mode.
37 // Except where otherwise noted, this class should be used on the UI thread. 38 // Except where otherwise noted, this class should be used on the UI thread.
38 class ManagedMode : public chrome::BrowserListObserver, 39 class ManagedMode : public chrome::BrowserListObserver,
(...skipping 24 matching lines...) Expand all
63 // classifying sites in the history view. 64 // classifying sites in the history view.
64 // This method should only be called on the UI thread. 65 // This method should only be called on the UI thread.
65 static const ManagedModeURLFilter* GetURLFilterForUIThread(); 66 static const ManagedModeURLFilter* GetURLFilterForUIThread();
66 67
67 // Returns the URL's category. 68 // Returns the URL's category.
68 static int GetCategory(const GURL& url); 69 static int GetCategory(const GURL& url);
69 70
70 // Called in the critical path of drawing the history UI, so needs to be fast. 71 // Called in the critical path of drawing the history UI, so needs to be fast.
71 static void GetCategoryNames(CategoryList* list); 72 static void GetCategoryNames(CategoryList* list);
72 73
73 // Returns the profile whitelist. 74 // Checks if the url pattern is in the manual whitelist.
74 static scoped_ptr<base::ListValue> GetWhitelist(); 75 static bool IsInManualWhitelist(const std::string& url_pattern);
76 bool IsInManualWhitelistImpl(const std::string& url_pattern);
Bernhard Bauer 2012/11/27 18:44:46 Make this private please.
Sergiu 2012/11/28 12:53:25 Done. I'm not sure about the order of the function
Bernhard Bauer 2012/11/28 14:21:05 You mean in the .cc file? In the .h file we don't
75 77
76 // Sets the profile whitelist to |whitelist|. 78 // Appends |whitelist| to the manual whitelist (both in URL filter and in
77 static void SetWhitelist(base::ListValue* whitelist); 79 // preferences). Returns whether the last element in |whitelist| was already
80 // in the manual whitelist or not.
Bernhard Bauer 2012/11/27 18:44:46 That seems… very specific. Could a client just use
Sergiu 2012/11/28 12:53:25 I'm not sure I get you here, AddToManualWhitelist
Bernhard Bauer 2012/11/28 14:21:05 Yes, it's just that an interface "add these, and t
81 static bool AddToManualWhitelist(const base::ListValue& whitelist);
82 bool AddToManualWhitelistImpl(const base::ListValue& whitelist);
Bernhard Bauer 2012/11/27 18:44:46 Make this private.
Sergiu 2012/11/28 12:53:25 Done.
78 83
79 // Adds the |url| to the manual lists. 84 // Adds the |url_pattern| to the manual lists in the URL filter.
80 static void AddStringToManualWhitelist(const std::string& url); 85 static void AddURLPatternToManualWhitelist(const std::string& url_pattern);
81 static void AddStringToManualBlacklist(const std::string& url); 86 static void AddURLPatternToManualBlacklist(const std::string& url_pattern);
82 87
83 // Returns the profile blacklist. 88 // Returns the profile blacklist.
84 static scoped_ptr<base::ListValue> GetBlacklist(); 89 static scoped_ptr<base::ListValue> GetBlacklist();
85 90
86 // ExtensionManagementPolicy::Provider implementation: 91 // ExtensionManagementPolicy::Provider implementation:
87 virtual std::string GetDebugPolicyProviderName() const OVERRIDE; 92 virtual std::string GetDebugPolicyProviderName() const OVERRIDE;
88 virtual bool UserMayLoad(const extensions::Extension* extension, 93 virtual bool UserMayLoad(const extensions::Extension* extension,
89 string16* error) const OVERRIDE; 94 string16* error) const OVERRIDE;
90 virtual bool UserMayModifySettings(const extensions::Extension* extension, 95 virtual bool UserMayModifySettings(const extensions::Extension* extension,
91 string16* error) const OVERRIDE; 96 string16* error) const OVERRIDE;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 155
151 // Returns a list of all installed and enabled site lists in the current 156 // Returns a list of all installed and enabled site lists in the current
152 // managed profile. 157 // managed profile.
153 // This method should only be called if managed mode is active. 158 // This method should only be called if managed mode is active.
154 ScopedVector<ManagedModeSiteList> GetActiveSiteLists(); 159 ScopedVector<ManagedModeSiteList> GetActiveSiteLists();
155 160
156 void OnFamilyPackOptionsChanged(); 161 void OnFamilyPackOptionsChanged();
157 162
158 void UpdateWhitelist(); 163 void UpdateWhitelist();
159 164
165 // Returns a copy of the manual whitelist which is stored in each profile.
166 scoped_ptr<base::ListValue> GetWhitelist();
167
160 content::NotificationRegistrar registrar_; 168 content::NotificationRegistrar registrar_;
161 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; 169 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
162 170
163 scoped_ptr<URLFilterContext> io_url_filter_context_; 171 scoped_ptr<URLFilterContext> io_url_filter_context_;
164 scoped_ptr<URLFilterContext> ui_url_filter_context_; 172 scoped_ptr<URLFilterContext> ui_url_filter_context_;
165 173
166 std::set<Browser*> browsers_to_close_; 174 std::set<Browser*> browsers_to_close_;
167 std::vector<EnterCallback> callbacks_; 175 std::vector<EnterCallback> callbacks_;
168 176
169 DISALLOW_COPY_AND_ASSIGN(ManagedMode); 177 DISALLOW_COPY_AND_ASSIGN(ManagedMode);
170 }; 178 };
171 179
172 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ 180 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698