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 ManagedModeSiteList; | 24 class ManagedModeSiteList; |
25 class ManagedModeURLFilter; | 25 class ManagedModeURLFilter; |
26 class PrefChangeRegistrar; | 26 class PrefChangeRegistrar; |
27 class PrefService; | 27 class PrefServiceSimple; |
| 28 class PrefServiceSyncable; |
28 class Profile; | 29 class Profile; |
29 | 30 |
30 // Managed mode allows one person to manage the Chrome experience for another | 31 // Managed mode allows one person to manage the Chrome experience for another |
31 // person by pre-configuring and then locking a managed User profile. | 32 // person by pre-configuring and then locking a managed User profile. |
32 // The ManagedMode class provides methods to check whether the browser is in | 33 // The ManagedMode class provides methods to check whether the browser is in |
33 // managed mode, and to attempt to enter or leave managed mode. | 34 // managed mode, and to attempt to enter or leave managed mode. |
34 // Except where otherwise noted, this class should be used on the UI thread. | 35 // Except where otherwise noted, this class should be used on the UI thread. |
35 class ManagedMode : public chrome::BrowserListObserver, | 36 class ManagedMode : public chrome::BrowserListObserver, |
36 public extensions::ManagementPolicy::Provider, | 37 public extensions::ManagementPolicy::Provider, |
37 public content::NotificationObserver { | 38 public content::NotificationObserver { |
38 public: | 39 public: |
39 typedef base::Callback<void(bool)> EnterCallback; | 40 typedef base::Callback<void(bool)> EnterCallback; |
40 | 41 |
41 static void RegisterPrefs(PrefService* prefs); | 42 static void RegisterPrefs(PrefServiceSimple* prefs); |
42 static void RegisterUserPrefs(PrefService* prefs); | 43 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
43 | 44 |
44 // Initializes the singleton, setting the managed_profile_. Must be called | 45 // Initializes the singleton, setting the managed_profile_. Must be called |
45 // after g_browser_process and the LocalState have been created. | 46 // after g_browser_process and the LocalState have been created. |
46 static void Init(Profile* profile); | 47 static void Init(Profile* profile); |
47 static bool IsInManagedMode(); | 48 static bool IsInManagedMode(); |
48 | 49 |
49 // Calls |callback| with the argument true iff managed mode was entered | 50 // Calls |callback| with the argument true iff managed mode was entered |
50 // sucessfully. | 51 // sucessfully. |
51 static void EnterManagedMode(Profile* profile, const EnterCallback& callback); | 52 static void EnterManagedMode(Profile* profile, const EnterCallback& callback); |
52 static void LeaveManagedMode(); | 53 static void LeaveManagedMode(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 scoped_ptr<URLFilterContext> io_url_filter_context_; | 140 scoped_ptr<URLFilterContext> io_url_filter_context_; |
140 scoped_ptr<URLFilterContext> ui_url_filter_context_; | 141 scoped_ptr<URLFilterContext> ui_url_filter_context_; |
141 | 142 |
142 std::set<Browser*> browsers_to_close_; | 143 std::set<Browser*> browsers_to_close_; |
143 std::vector<EnterCallback> callbacks_; | 144 std::vector<EnterCallback> callbacks_; |
144 | 145 |
145 DISALLOW_COPY_AND_ASSIGN(ManagedMode); | 146 DISALLOW_COPY_AND_ASSIGN(ManagedMode); |
146 }; | 147 }; |
147 | 148 |
148 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ | 149 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ |
OLD | NEW |