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> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 public: | 43 public: |
44 typedef base::Callback<void(bool)> EnterCallback; | 44 typedef base::Callback<void(bool)> EnterCallback; |
45 | 45 |
46 static void RegisterPrefs(PrefServiceSimple* prefs); | 46 static void RegisterPrefs(PrefServiceSimple* prefs); |
47 static void RegisterUserPrefs(PrefServiceSyncable* prefs); | 47 static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
48 | 48 |
49 // Initializes the singleton, setting the managed_profile_. Must be called | 49 // Initializes the singleton, setting the managed_profile_. Must be called |
50 // after g_browser_process and the LocalState have been created. | 50 // after g_browser_process and the LocalState have been created. |
51 static void Init(Profile* profile); | 51 static void Init(Profile* profile); |
52 static bool IsInManagedMode(); | 52 static bool IsInManagedMode(); |
53 static bool IsCustodianAuthenticated(); | |
54 | |
55 // Sets the boolean value if a custodian is currently authenticated or not | |
Pam (message me for reviews)
2013/01/14 15:37:50
nit: Period at the end of the comment please.
Adrian Kuegel
2013/01/19 01:21:32
Done.
| |
56 static void SetCustodianAuthenticated(bool isAuthenticated); | |
53 | 57 |
54 // Calls |callback| with the argument true iff managed mode was entered | 58 // Calls |callback| with the argument true iff managed mode was entered |
55 // sucessfully. | 59 // sucessfully. |
56 static void EnterManagedMode(Profile* profile, const EnterCallback& callback); | 60 static void EnterManagedMode(Profile* profile, const EnterCallback& callback); |
57 static void LeaveManagedMode(); | 61 static void LeaveManagedMode(); |
58 | 62 |
59 // Returns the URL filter for the IO thread, for filtering network requests | 63 // Returns the URL filter for the IO thread, for filtering network requests |
60 // (in ChromeNetworkDelegate). | 64 // (in ChromeNetworkDelegate). |
61 // This method should only be called on the IO thread. | 65 // This method should only be called on the IO thread. |
62 static const ManagedModeURLFilter* GetURLFilterForIOThread(); | 66 static const ManagedModeURLFilter* GetURLFilterForIOThread(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 const content::NotificationSource& source, | 114 const content::NotificationSource& source, |
111 const content::NotificationDetails& details) OVERRIDE; | 115 const content::NotificationDetails& details) OVERRIDE; |
112 | 116 |
113 protected: | 117 protected: |
114 ManagedMode(); | 118 ManagedMode(); |
115 virtual ~ManagedMode(); | 119 virtual ~ManagedMode(); |
116 void EnterManagedModeImpl(Profile* profile, const EnterCallback& callback); | 120 void EnterManagedModeImpl(Profile* profile, const EnterCallback& callback); |
117 | 121 |
118 // The managed profile. This is NULL iff we are not in managed mode. | 122 // The managed profile. This is NULL iff we are not in managed mode. |
119 Profile* managed_profile_; | 123 Profile* managed_profile_; |
124 bool is_custodian_authenticated_; | |
120 | 125 |
121 private: | 126 private: |
122 class URLFilterContext; | 127 class URLFilterContext; |
123 | 128 |
124 friend class Singleton<ManagedMode, LeakySingletonTraits<ManagedMode> >; | 129 friend class Singleton<ManagedMode, LeakySingletonTraits<ManagedMode> >; |
125 friend struct DefaultSingletonTraits<ManagedMode>; | 130 friend struct DefaultSingletonTraits<ManagedMode>; |
126 FRIEND_TEST_ALL_PREFIXES(ExtensionApiTest, ManagedModeOnChange); | 131 FRIEND_TEST_ALL_PREFIXES(ExtensionApiTest, ManagedModeOnChange); |
127 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 132 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
128 ManagedModeProhibitsModification); | 133 ManagedModeProhibitsModification); |
129 | 134 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 scoped_ptr<URLFilterContext> io_url_filter_context_; | 199 scoped_ptr<URLFilterContext> io_url_filter_context_; |
195 scoped_ptr<URLFilterContext> ui_url_filter_context_; | 200 scoped_ptr<URLFilterContext> ui_url_filter_context_; |
196 | 201 |
197 std::set<Browser*> browsers_to_close_; | 202 std::set<Browser*> browsers_to_close_; |
198 std::vector<EnterCallback> callbacks_; | 203 std::vector<EnterCallback> callbacks_; |
199 | 204 |
200 DISALLOW_COPY_AND_ASSIGN(ManagedMode); | 205 DISALLOW_COPY_AND_ASSIGN(ManagedMode); |
201 }; | 206 }; |
202 | 207 |
203 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ | 208 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_MODE_H_ |
OLD | NEW |