| 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 <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.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/net/file_downloader.h" | 23 #include "chrome/browser/net/file_downloader.h" |
| 24 #include "chrome/browser/supervised_user/experimental/safe_search_url_reporter.h
" | 24 #include "chrome/browser/supervised_user/experimental/safe_search_url_reporter.h
" |
| 25 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.
h" | 25 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.
h" |
| 26 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 26 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
| 27 #include "chrome/browser/supervised_user/supervised_users.h" | 27 #include "chrome/browser/supervised_user/supervised_users.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 const AuthErrorCallback& callback); | 176 const AuthErrorCallback& callback); |
| 177 #endif | 177 #endif |
| 178 | 178 |
| 179 void AddNavigationBlockedCallback(const NavigationBlockedCallback& callback); | 179 void AddNavigationBlockedCallback(const NavigationBlockedCallback& callback); |
| 180 void DidBlockNavigation(content::WebContents* web_contents); | 180 void DidBlockNavigation(content::WebContents* web_contents); |
| 181 | 181 |
| 182 void AddObserver(SupervisedUserServiceObserver* observer); | 182 void AddObserver(SupervisedUserServiceObserver* observer); |
| 183 void RemoveObserver(SupervisedUserServiceObserver* observer); | 183 void RemoveObserver(SupervisedUserServiceObserver* observer); |
| 184 | 184 |
| 185 void AddPermissionRequestCreator( | 185 void AddPermissionRequestCreator( |
| 186 scoped_ptr<PermissionRequestCreator> creator); | 186 std::unique_ptr<PermissionRequestCreator> creator); |
| 187 | 187 |
| 188 void SetSafeSearchURLReporter(scoped_ptr<SafeSearchURLReporter> reporter); | 188 void SetSafeSearchURLReporter( |
| 189 std::unique_ptr<SafeSearchURLReporter> reporter); |
| 189 | 190 |
| 190 // ProfileKeyedService override: | 191 // ProfileKeyedService override: |
| 191 void Shutdown() override; | 192 void Shutdown() override; |
| 192 | 193 |
| 193 // SyncTypePreferenceProvider implementation: | 194 // SyncTypePreferenceProvider implementation: |
| 194 syncer::ModelTypeSet GetPreferredDataTypes() const override; | 195 syncer::ModelTypeSet GetPreferredDataTypes() const override; |
| 195 | 196 |
| 196 #if !defined(OS_ANDROID) | 197 #if !defined(OS_ANDROID) |
| 197 // sync_driver::SyncServiceObserver implementation: | 198 // sync_driver::SyncServiceObserver implementation: |
| 198 void OnStateChanged() override; | 199 void OnStateChanged() override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 SupervisedUserURLFilter* io_url_filter() const; | 232 SupervisedUserURLFilter* io_url_filter() const; |
| 232 | 233 |
| 233 void SetDefaultFilteringBehavior( | 234 void SetDefaultFilteringBehavior( |
| 234 SupervisedUserURLFilter::FilteringBehavior behavior); | 235 SupervisedUserURLFilter::FilteringBehavior behavior); |
| 235 void LoadWhitelists( | 236 void LoadWhitelists( |
| 236 const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists); | 237 const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists); |
| 237 // TODO(treib): Make SupervisedUserBlacklist refcounted, so the IO thread | 238 // TODO(treib): Make SupervisedUserBlacklist refcounted, so the IO thread |
| 238 // will retain a reference to the blacklist. | 239 // will retain a reference to the blacklist. |
| 239 void SetBlacklist(const SupervisedUserBlacklist* blacklist); | 240 void SetBlacklist(const SupervisedUserBlacklist* blacklist); |
| 240 bool HasBlacklist() const; | 241 bool HasBlacklist() const; |
| 241 void SetManualHosts(scoped_ptr<std::map<std::string, bool>> host_map); | 242 void SetManualHosts(std::unique_ptr<std::map<std::string, bool>> host_map); |
| 242 void SetManualURLs(scoped_ptr<std::map<GURL, bool>> url_map); | 243 void SetManualURLs(std::unique_ptr<std::map<GURL, bool>> url_map); |
| 243 | 244 |
| 244 void InitAsyncURLChecker( | 245 void InitAsyncURLChecker( |
| 245 const scoped_refptr<net::URLRequestContextGetter>& context); | 246 const scoped_refptr<net::URLRequestContextGetter>& context); |
| 246 bool HasAsyncURLChecker() const; | 247 bool HasAsyncURLChecker() const; |
| 247 void ClearAsyncURLChecker(); | 248 void ClearAsyncURLChecker(); |
| 248 | 249 |
| 249 void Clear(); | 250 void Clear(); |
| 250 | 251 |
| 251 private: | 252 private: |
| 252 void OnBlacklistLoaded(const base::Closure& callback); | 253 void OnBlacklistLoaded(const base::Closure& callback); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 391 |
| 391 URLFilterContext url_filter_context_; | 392 URLFilterContext url_filter_context_; |
| 392 | 393 |
| 393 enum class BlacklistLoadState { | 394 enum class BlacklistLoadState { |
| 394 NOT_LOADED, | 395 NOT_LOADED, |
| 395 LOAD_STARTED, | 396 LOAD_STARTED, |
| 396 LOADED | 397 LOADED |
| 397 } blacklist_state_; | 398 } blacklist_state_; |
| 398 | 399 |
| 399 SupervisedUserBlacklist blacklist_; | 400 SupervisedUserBlacklist blacklist_; |
| 400 scoped_ptr<FileDownloader> blacklist_downloader_; | 401 std::unique_ptr<FileDownloader> blacklist_downloader_; |
| 401 | 402 |
| 402 scoped_ptr<SupervisedUserWhitelistService> whitelist_service_; | 403 std::unique_ptr<SupervisedUserWhitelistService> whitelist_service_; |
| 403 | 404 |
| 404 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_; | 405 std::vector<scoped_refptr<SupervisedUserSiteList>> whitelists_; |
| 405 | 406 |
| 406 // Used to create permission requests. | 407 // Used to create permission requests. |
| 407 ScopedVector<PermissionRequestCreator> permissions_creators_; | 408 ScopedVector<PermissionRequestCreator> permissions_creators_; |
| 408 | 409 |
| 409 // Used to report inappropriate URLs to SafeSarch API. | 410 // Used to report inappropriate URLs to SafeSarch API. |
| 410 scoped_ptr<SafeSearchURLReporter> url_reporter_; | 411 std::unique_ptr<SafeSearchURLReporter> url_reporter_; |
| 411 | 412 |
| 412 base::ObserverList<SupervisedUserServiceObserver> observer_list_; | 413 base::ObserverList<SupervisedUserServiceObserver> observer_list_; |
| 413 | 414 |
| 414 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; | 415 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; |
| 415 }; | 416 }; |
| 416 | 417 |
| 417 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 418 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
| OLD | NEW |