OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/prefs/pref_change_registrar.h" | 14 #include "base/prefs/pref_change_registrar.h" |
15 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 17 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
18 #include "chrome/browser/supervised_user/supervised_users.h" | 18 #include "chrome/browser/supervised_user/supervised_users.h" |
| 19 #include "chrome/browser/sync/profile_sync_service_data_type_provider.h" |
19 #include "chrome/browser/sync/profile_sync_service_observer.h" | 20 #include "chrome/browser/sync/profile_sync_service_observer.h" |
20 #include "chrome/browser/ui/browser_list_observer.h" | 21 #include "chrome/browser/ui/browser_list_observer.h" |
21 #include "components/keyed_service/core/keyed_service.h" | 22 #include "components/keyed_service/core/keyed_service.h" |
22 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
23 | 24 |
24 #if defined(ENABLE_EXTENSIONS) | 25 #if defined(ENABLE_EXTENSIONS) |
25 #include "extensions/browser/extension_registry_observer.h" | 26 #include "extensions/browser/extension_registry_observer.h" |
26 #include "extensions/browser/management_policy.h" | 27 #include "extensions/browser/management_policy.h" |
27 #endif | 28 #endif |
28 | 29 |
(...skipping 15 matching lines...) Expand all Loading... |
44 } | 45 } |
45 | 46 |
46 // This class handles all the information related to a given supervised profile | 47 // This class handles all the information related to a given supervised profile |
47 // (e.g. the installed content packs, the default URL filtering behavior, or | 48 // (e.g. the installed content packs, the default URL filtering behavior, or |
48 // manual whitelist/blacklist overrides). | 49 // manual whitelist/blacklist overrides). |
49 class SupervisedUserService : public KeyedService, | 50 class SupervisedUserService : public KeyedService, |
50 #if defined(ENABLE_EXTENSIONS) | 51 #if defined(ENABLE_EXTENSIONS) |
51 public extensions::ManagementPolicy::Provider, | 52 public extensions::ManagementPolicy::Provider, |
52 public extensions::ExtensionRegistryObserver, | 53 public extensions::ExtensionRegistryObserver, |
53 #endif | 54 #endif |
| 55 public ProfileSyncServiceDataTypeProvider, |
54 public ProfileSyncServiceObserver, | 56 public ProfileSyncServiceObserver, |
55 public chrome::BrowserListObserver { | 57 public chrome::BrowserListObserver { |
56 public: | 58 public: |
57 typedef std::vector<base::string16> CategoryList; | 59 typedef std::vector<base::string16> CategoryList; |
58 typedef base::Callback<void(content::WebContents*)> NavigationBlockedCallback; | 60 typedef base::Callback<void(content::WebContents*)> NavigationBlockedCallback; |
59 typedef base::Callback<void(const GoogleServiceAuthError&)> AuthErrorCallback; | 61 typedef base::Callback<void(const GoogleServiceAuthError&)> AuthErrorCallback; |
60 | 62 |
61 enum ManualBehavior { | 63 enum ManualBehavior { |
62 MANUAL_NONE = 0, | 64 MANUAL_NONE = 0, |
63 MANUAL_ALLOW, | 65 MANUAL_ALLOW, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // extensions::ExtensionRegistryObserver implementation. | 167 // extensions::ExtensionRegistryObserver implementation. |
166 virtual void OnExtensionLoaded( | 168 virtual void OnExtensionLoaded( |
167 content::BrowserContext* browser_context, | 169 content::BrowserContext* browser_context, |
168 const extensions::Extension* extension) OVERRIDE; | 170 const extensions::Extension* extension) OVERRIDE; |
169 virtual void OnExtensionUnloaded( | 171 virtual void OnExtensionUnloaded( |
170 content::BrowserContext* browser_context, | 172 content::BrowserContext* browser_context, |
171 const extensions::Extension* extension, | 173 const extensions::Extension* extension, |
172 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; | 174 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; |
173 #endif | 175 #endif |
174 | 176 |
| 177 // ProfileSyncServiceDataTypeProvider implementation: |
| 178 virtual syncer::ModelTypeSet GetRequiredSyncDataTypes() OVERRIDE; |
| 179 |
175 // ProfileSyncServiceObserver implementation: | 180 // ProfileSyncServiceObserver implementation: |
176 virtual void OnStateChanged() OVERRIDE; | 181 virtual void OnStateChanged() OVERRIDE; |
177 | 182 |
178 // chrome::BrowserListObserver implementation: | 183 // chrome::BrowserListObserver implementation: |
179 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; | 184 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; |
180 | 185 |
181 private: | 186 private: |
182 friend class SupervisedUserServiceExtensionTestBase; | 187 friend class SupervisedUserServiceExtensionTestBase; |
183 friend class SupervisedUserServiceFactory; | 188 friend class SupervisedUserServiceFactory; |
184 FRIEND_TEST_ALL_PREFIXES(SupervisedUserServiceTest, ClearOmitOnRegistration); | 189 FRIEND_TEST_ALL_PREFIXES(SupervisedUserServiceTest, ClearOmitOnRegistration); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // Used to create permission requests. | 301 // Used to create permission requests. |
297 scoped_ptr<PermissionRequestCreator> permissions_creator_; | 302 scoped_ptr<PermissionRequestCreator> permissions_creator_; |
298 | 303 |
299 // True iff we are waiting for a permission request to be issued. | 304 // True iff we are waiting for a permission request to be issued. |
300 bool waiting_for_permissions_; | 305 bool waiting_for_permissions_; |
301 | 306 |
302 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; | 307 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; |
303 }; | 308 }; |
304 | 309 |
305 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 310 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
OLD | NEW |