| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/scoped_observer.h" | 20 #include "base/scoped_observer.h" |
| 21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "chrome/browser/supervised_user/experimental/safe_search_url_reporter.h
" |
| 23 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.
h" | 24 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.
h" |
| 24 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 25 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 25 #include "chrome/browser/supervised_user/supervised_users.h" | 26 #include "chrome/browser/supervised_user/supervised_users.h" |
| 26 #include "chrome/browser/ui/browser_list_observer.h" | 27 #include "chrome/browser/ui/browser_list_observer.h" |
| 27 #include "components/keyed_service/core/keyed_service.h" | 28 #include "components/keyed_service/core/keyed_service.h" |
| 28 #include "components/prefs/pref_change_registrar.h" | 29 #include "components/prefs/pref_change_registrar.h" |
| 29 #include "components/sync_driver/sync_service_observer.h" | 30 #include "components/sync_driver/sync_service_observer.h" |
| 30 #include "components/sync_driver/sync_type_preference_provider.h" | 31 #include "components/sync_driver/sync_type_preference_provider.h" |
| 31 #include "net/url_request/url_request_context_getter.h" | 32 #include "net/url_request/url_request_context_getter.h" |
| 32 | 33 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 return whitelists_; | 114 return whitelists_; |
| 114 } | 115 } |
| 115 | 116 |
| 116 // Whether the user can request to get access to blocked URLs or to new | 117 // Whether the user can request to get access to blocked URLs or to new |
| 117 // extensions. | 118 // extensions. |
| 118 bool AccessRequestsEnabled(); | 119 bool AccessRequestsEnabled(); |
| 119 | 120 |
| 120 // Adds an access request for the given URL. | 121 // Adds an access request for the given URL. |
| 121 void AddURLAccessRequest(const GURL& url, const SuccessCallback& callback); | 122 void AddURLAccessRequest(const GURL& url, const SuccessCallback& callback); |
| 122 | 123 |
| 124 // Reports |url| to the SafeSearch API, because the user thinks this is an |
| 125 // inappropriate URL. |
| 126 void ReportURL(const GURL& url, const SuccessCallback& callback); |
| 127 |
| 123 // Adds an update request for the given WebStore item (App/Extension). | 128 // Adds an update request for the given WebStore item (App/Extension). |
| 124 void AddExtensionUpdateRequest(const std::string& extension_id, | 129 void AddExtensionUpdateRequest(const std::string& extension_id, |
| 125 const base::Version& version, | 130 const base::Version& version, |
| 126 const SuccessCallback& callback); | 131 const SuccessCallback& callback); |
| 127 | 132 |
| 128 // Same as above, but without a callback, just logging errors on failure. | 133 // Same as above, but without a callback, just logging errors on failure. |
| 129 void AddExtensionUpdateRequest(const std::string& extension_id, | 134 void AddExtensionUpdateRequest(const std::string& extension_id, |
| 130 const base::Version& version); | 135 const base::Version& version); |
| 131 | 136 |
| 132 // Get the string used to identify an extension update request. Public for | 137 // Get the string used to identify an extension update request. Public for |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 178 |
| 174 void AddNavigationBlockedCallback(const NavigationBlockedCallback& callback); | 179 void AddNavigationBlockedCallback(const NavigationBlockedCallback& callback); |
| 175 void DidBlockNavigation(content::WebContents* web_contents); | 180 void DidBlockNavigation(content::WebContents* web_contents); |
| 176 | 181 |
| 177 void AddObserver(SupervisedUserServiceObserver* observer); | 182 void AddObserver(SupervisedUserServiceObserver* observer); |
| 178 void RemoveObserver(SupervisedUserServiceObserver* observer); | 183 void RemoveObserver(SupervisedUserServiceObserver* observer); |
| 179 | 184 |
| 180 void AddPermissionRequestCreator( | 185 void AddPermissionRequestCreator( |
| 181 scoped_ptr<PermissionRequestCreator> creator); | 186 scoped_ptr<PermissionRequestCreator> creator); |
| 182 | 187 |
| 188 void SetSafeSearchUrlReporter(scoped_ptr<SafeSearchUrlReporter> reporter); |
| 189 |
| 183 // ProfileKeyedService override: | 190 // ProfileKeyedService override: |
| 184 void Shutdown() override; | 191 void Shutdown() override; |
| 185 | 192 |
| 186 // SyncTypePreferenceProvider implementation: | 193 // SyncTypePreferenceProvider implementation: |
| 187 syncer::ModelTypeSet GetPreferredDataTypes() const override; | 194 syncer::ModelTypeSet GetPreferredDataTypes() const override; |
| 188 | 195 |
| 189 #if !defined(OS_ANDROID) | 196 #if !defined(OS_ANDROID) |
| 190 // sync_driver::SyncServiceObserver implementation: | 197 // sync_driver::SyncServiceObserver implementation: |
| 191 void OnStateChanged() override; | 198 void OnStateChanged() override; |
| 192 | 199 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 SupervisedUserBlacklist blacklist_; | 398 SupervisedUserBlacklist blacklist_; |
| 392 scoped_ptr<FileDownloader> blacklist_downloader_; | 399 scoped_ptr<FileDownloader> blacklist_downloader_; |
| 393 | 400 |
| 394 scoped_ptr<SupervisedUserWhitelistService> whitelist_service_; | 401 scoped_ptr<SupervisedUserWhitelistService> whitelist_service_; |
| 395 | 402 |
| 396 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_; | 403 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_; |
| 397 | 404 |
| 398 // Used to create permission requests. | 405 // Used to create permission requests. |
| 399 ScopedVector<PermissionRequestCreator> permissions_creators_; | 406 ScopedVector<PermissionRequestCreator> permissions_creators_; |
| 400 | 407 |
| 408 // Used to report inappropriate URLs to SafeSarch API. |
| 409 scoped_ptr<SafeSearchUrlReporter> url_reporter_; |
| 410 |
| 401 base::ObserverList<SupervisedUserServiceObserver> observer_list_; | 411 base::ObserverList<SupervisedUserServiceObserver> observer_list_; |
| 402 | 412 |
| 403 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; | 413 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; |
| 404 }; | 414 }; |
| 405 | 415 |
| 406 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 416 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
| OLD | NEW |