OLD | NEW |
---|---|
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 ManagedModeURLFilter; | 24 class ManagedModeURLFilter; |
25 class PrefChangeRegistrar; | 25 class PrefChangeRegistrar; |
26 class PrefService; | 26 class PrefService; |
27 class Profile; | 27 class Profile; |
28 namespace policy{ | |
Bernhard Bauer
2012/11/16 15:04:46
Please add a blank line before the namespace.
Sergiu
2012/11/26 14:48:08
Done.
| |
29 class URLBlacklist; | |
30 } | |
28 | 31 |
29 // Managed mode allows one person to manage the Chrome experience for another | 32 // Managed mode allows one person to manage the Chrome experience for another |
30 // person by pre-configuring and then locking a managed User profile. | 33 // person by pre-configuring and then locking a managed User profile. |
31 // The ManagedMode class provides methods to check whether the browser is in | 34 // The ManagedMode class provides methods to check whether the browser is in |
32 // managed mode, and to attempt to enter or leave managed mode. | 35 // managed mode, and to attempt to enter or leave managed mode. |
33 // Except where otherwise noted, this class should be used on the UI thread. | 36 // Except where otherwise noted, this class should be used on the UI thread. |
34 class ManagedMode : public chrome::BrowserListObserver, | 37 class ManagedMode : public chrome::BrowserListObserver, |
35 public extensions::ManagementPolicy::Provider, | 38 public extensions::ManagementPolicy::Provider, |
36 public content::NotificationObserver { | 39 public content::NotificationObserver { |
37 public: | 40 public: |
(...skipping 19 matching lines...) Expand all Loading... | |
57 // Returns the URL filter for the UI thread. | 60 // Returns the URL filter for the UI thread. |
58 // This method should only be called on the UI thread. | 61 // This method should only be called on the UI thread. |
59 static const ManagedModeURLFilter* GetURLFilterForUIThread(); | 62 static const ManagedModeURLFilter* GetURLFilterForUIThread(); |
60 | 63 |
61 // Returns the URL's category. | 64 // Returns the URL's category. |
62 static int GetCategory(const GURL& url); | 65 static int GetCategory(const GURL& url); |
63 | 66 |
64 // Called in the critical path of drawing the history UI, so needs to be fast. | 67 // Called in the critical path of drawing the history UI, so needs to be fast. |
65 static void GetCategoryNames(CategoryList* list); | 68 static void GetCategoryNames(CategoryList* list); |
66 | 69 |
70 // Returns the profile whitelist. | |
Bernhard Bauer
2012/11/16 15:04:46
"[…] a copy of [the profile whitelist]"?
Also, it
Sergiu
2012/11/26 14:48:08
Made it private, improved the comment.
| |
71 static scoped_ptr<base::ListValue> GetWhitelist(); | |
72 | |
73 // Sets the profile whitelist to |whitelist|. | |
74 static void SetWhitelist(base::ListValue* whitelist); | |
Bernhard Bauer
2012/11/16 15:04:46
What happens to the pointer that is passed in? Whe
Sergiu
2012/11/26 14:48:08
Deleted this function all together.
| |
75 | |
76 // Adds the |url| to the manual lists. | |
Bernhard Bauer
2012/11/16 15:04:46
This is a URL *pattern*, right? So, we should call
Sergiu
2012/11/26 14:48:08
Done.
| |
77 static void AddStringToManualWhitelist(const std::string& url); | |
78 static void AddStringToManualBlacklist(const std::string& url); | |
79 | |
80 // Returns the profile blacklist. | |
81 static scoped_ptr<base::ListValue> GetBlacklist(); | |
82 | |
67 // ExtensionManagementPolicy::Provider implementation: | 83 // ExtensionManagementPolicy::Provider implementation: |
68 virtual std::string GetDebugPolicyProviderName() const OVERRIDE; | 84 virtual std::string GetDebugPolicyProviderName() const OVERRIDE; |
69 virtual bool UserMayLoad(const extensions::Extension* extension, | 85 virtual bool UserMayLoad(const extensions::Extension* extension, |
70 string16* error) const OVERRIDE; | 86 string16* error) const OVERRIDE; |
71 virtual bool UserMayModifySettings(const extensions::Extension* extension, | 87 virtual bool UserMayModifySettings(const extensions::Extension* extension, |
72 string16* error) const OVERRIDE; | 88 string16* error) const OVERRIDE; |
73 | 89 |
74 // chrome::BrowserListObserver implementation: | 90 // chrome::BrowserListObserver implementation: |
75 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; | 91 virtual void OnBrowserAdded(Browser* browser) OVERRIDE; |
76 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 92 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 scoped_ptr<URLFilterContext> io_url_filter_context_; | 153 scoped_ptr<URLFilterContext> io_url_filter_context_; |
138 scoped_ptr<URLFilterContext> ui_url_filter_context_; | 154 scoped_ptr<URLFilterContext> ui_url_filter_context_; |
139 | 155 |
140 std::set<Browser*> browsers_to_close_; | 156 std::set<Browser*> browsers_to_close_; |
141 std::vector<EnterCallback> callbacks_; | 157 std::vector<EnterCallback> callbacks_; |
142 | 158 |
143 DISALLOW_COPY_AND_ASSIGN(ManagedMode); | 159 DISALLOW_COPY_AND_ASSIGN(ManagedMode); |
144 }; | 160 }; |
145 | 161 |
146 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ | 162 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ |
OLD | NEW |