Chromium Code Reviews| 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. | |
|
Marc Treib
2016/03/21 12:32:21
|url| (pipes around the variable name)
I'd also a
atanasova
2016/03/22 15:45:41
Done.
| |
| 125 void ReportUrl(const GURL& url, const SuccessCallback& callback); | |
|
Marc Treib
2016/03/21 12:32:21
nit: ReportURL (capitalized), to be consistent wit
atanasova
2016/03/22 15:45:41
Done.
| |
| 126 | |
| 123 // Adds an update request for the given WebStore item (App/Extension). | 127 // Adds an update request for the given WebStore item (App/Extension). |
| 124 void AddExtensionUpdateRequest(const std::string& extension_id, | 128 void AddExtensionUpdateRequest(const std::string& extension_id, |
| 125 const base::Version& version, | 129 const base::Version& version, |
| 126 const SuccessCallback& callback); | 130 const SuccessCallback& callback); |
| 127 | 131 |
| 128 // Same as above, but without a callback, just logging errors on failure. | 132 // Same as above, but without a callback, just logging errors on failure. |
| 129 void AddExtensionUpdateRequest(const std::string& extension_id, | 133 void AddExtensionUpdateRequest(const std::string& extension_id, |
| 130 const base::Version& version); | 134 const base::Version& version); |
| 131 | 135 |
| 132 // Get the string used to identify an extension update request. Public for | 136 // 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 | 177 |
| 174 void AddNavigationBlockedCallback(const NavigationBlockedCallback& callback); | 178 void AddNavigationBlockedCallback(const NavigationBlockedCallback& callback); |
| 175 void DidBlockNavigation(content::WebContents* web_contents); | 179 void DidBlockNavigation(content::WebContents* web_contents); |
| 176 | 180 |
| 177 void AddObserver(SupervisedUserServiceObserver* observer); | 181 void AddObserver(SupervisedUserServiceObserver* observer); |
| 178 void RemoveObserver(SupervisedUserServiceObserver* observer); | 182 void RemoveObserver(SupervisedUserServiceObserver* observer); |
| 179 | 183 |
| 180 void AddPermissionRequestCreator( | 184 void AddPermissionRequestCreator( |
| 181 scoped_ptr<PermissionRequestCreator> creator); | 185 scoped_ptr<PermissionRequestCreator> creator); |
| 182 | 186 |
| 187 void SetSafeSearchUrlReporter(scoped_ptr<SafeSearchUrlReporter> creator); | |
|
Marc Treib
2016/03/21 12:32:21
s/creator/reporter/
atanasova
2016/03/22 15:45:41
Done.
| |
| 188 | |
| 183 // ProfileKeyedService override: | 189 // ProfileKeyedService override: |
| 184 void Shutdown() override; | 190 void Shutdown() override; |
| 185 | 191 |
| 186 // SyncTypePreferenceProvider implementation: | 192 // SyncTypePreferenceProvider implementation: |
| 187 syncer::ModelTypeSet GetPreferredDataTypes() const override; | 193 syncer::ModelTypeSet GetPreferredDataTypes() const override; |
| 188 | 194 |
| 189 #if !defined(OS_ANDROID) | 195 #if !defined(OS_ANDROID) |
| 190 // sync_driver::SyncServiceObserver implementation: | 196 // sync_driver::SyncServiceObserver implementation: |
| 191 void OnStateChanged() override; | 197 void OnStateChanged() override; |
| 192 | 198 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 SupervisedUserBlacklist blacklist_; | 397 SupervisedUserBlacklist blacklist_; |
| 392 scoped_ptr<FileDownloader> blacklist_downloader_; | 398 scoped_ptr<FileDownloader> blacklist_downloader_; |
| 393 | 399 |
| 394 scoped_ptr<SupervisedUserWhitelistService> whitelist_service_; | 400 scoped_ptr<SupervisedUserWhitelistService> whitelist_service_; |
| 395 | 401 |
| 396 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_; | 402 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_; |
| 397 | 403 |
| 398 // Used to create permission requests. | 404 // Used to create permission requests. |
| 399 ScopedVector<PermissionRequestCreator> permissions_creators_; | 405 ScopedVector<PermissionRequestCreator> permissions_creators_; |
| 400 | 406 |
| 407 // Used to create report url requests. | |
|
Marc Treib
2016/03/21 12:32:21
"Used to report inappropriate URLs to the SafeSear
atanasova
2016/03/22 15:45:41
Done.
| |
| 408 scoped_ptr<SafeSearchUrlReporter> url_reporter_; | |
| 409 | |
| 401 base::ObserverList<SupervisedUserServiceObserver> observer_list_; | 410 base::ObserverList<SupervisedUserServiceObserver> observer_list_; |
| 402 | 411 |
| 403 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; | 412 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; |
| 404 }; | 413 }; |
| 405 | 414 |
| 406 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 415 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
| OLD | NEW |