| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #endif | 64 #endif |
| 65 public SyncTypePreferenceProvider, | 65 public SyncTypePreferenceProvider, |
| 66 public ProfileSyncServiceObserver, | 66 public ProfileSyncServiceObserver, |
| 67 public chrome::BrowserListObserver { | 67 public chrome::BrowserListObserver { |
| 68 public: | 68 public: |
| 69 typedef std::vector<base::string16> CategoryList; | 69 typedef std::vector<base::string16> CategoryList; |
| 70 typedef base::Callback<void(content::WebContents*)> NavigationBlockedCallback; | 70 typedef base::Callback<void(content::WebContents*)> NavigationBlockedCallback; |
| 71 typedef base::Callback<void(const GoogleServiceAuthError&)> AuthErrorCallback; | 71 typedef base::Callback<void(const GoogleServiceAuthError&)> AuthErrorCallback; |
| 72 typedef base::Callback<void(bool)> SuccessCallback; | 72 typedef base::Callback<void(bool)> SuccessCallback; |
| 73 | 73 |
| 74 enum ManualBehavior { | |
| 75 MANUAL_NONE = 0, | |
| 76 MANUAL_ALLOW, | |
| 77 MANUAL_BLOCK | |
| 78 }; | |
| 79 | |
| 80 class Delegate { | 74 class Delegate { |
| 81 public: | 75 public: |
| 82 virtual ~Delegate() {} | 76 virtual ~Delegate() {} |
| 83 // Returns true to indicate that the delegate handled the (de)activation, or | 77 // Returns true to indicate that the delegate handled the (de)activation, or |
| 84 // false to indicate that the SupervisedUserService itself should handle it. | 78 // false to indicate that the SupervisedUserService itself should handle it. |
| 85 virtual bool SetActive(bool active) = 0; | 79 virtual bool SetActive(bool active) = 0; |
| 86 // Returns the path to a blacklist file to load, or an empty path to | 80 // Returns the path to a blacklist file to load, or an empty path to |
| 87 // indicate "none". | 81 // indicate "none". |
| 88 virtual base::FilePath GetBlacklistPath() const = 0; | 82 virtual base::FilePath GetBlacklistPath() const = 0; |
| 89 // Returns the URL from which to download a blacklist if no local one exists | 83 // Returns the URL from which to download a blacklist if no local one exists |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // a dictionary which currently has the timestamp of the request in it. | 118 // a dictionary which currently has the timestamp of the request in it. |
| 125 void AddAccessRequest(const GURL& url, const SuccessCallback& callback); | 119 void AddAccessRequest(const GURL& url, const SuccessCallback& callback); |
| 126 | 120 |
| 127 // Returns the email address of the custodian. | 121 // Returns the email address of the custodian. |
| 128 std::string GetCustodianEmailAddress() const; | 122 std::string GetCustodianEmailAddress() const; |
| 129 | 123 |
| 130 // Returns the name of the custodian, or the email address if the name is | 124 // Returns the name of the custodian, or the email address if the name is |
| 131 // empty. | 125 // empty. |
| 132 std::string GetCustodianName() const; | 126 std::string GetCustodianName() const; |
| 133 | 127 |
| 134 // These methods allow querying and modifying the manual filtering behavior. | |
| 135 // The manual behavior is set by the user and overrides all other settings | |
| 136 // (whitelists or the default behavior). | |
| 137 | |
| 138 // Returns the manual behavior for the given host. | |
| 139 ManualBehavior GetManualBehaviorForHost(const std::string& hostname); | |
| 140 | |
| 141 // Returns the manual behavior for the given URL. | |
| 142 ManualBehavior GetManualBehaviorForURL(const GURL& url); | |
| 143 | |
| 144 // Returns all URLS on the given host that have exceptions. | |
| 145 void GetManualExceptionsForHost(const std::string& host, | |
| 146 std::vector<GURL>* urls); | |
| 147 | |
| 148 // Initializes this object. This method does nothing if the profile is not | 128 // Initializes this object. This method does nothing if the profile is not |
| 149 // supervised. | 129 // supervised. |
| 150 void Init(); | 130 void Init(); |
| 151 | 131 |
| 152 // Initializes this profile for syncing, using the provided |refresh_token| to | 132 // Initializes this profile for syncing, using the provided |refresh_token| to |
| 153 // mint access tokens for Sync. | 133 // mint access tokens for Sync. |
| 154 void InitSync(const std::string& refresh_token); | 134 void InitSync(const std::string& refresh_token); |
| 155 | 135 |
| 156 // Convenience method that registers this supervised user using | 136 // Convenience method that registers this supervised user using |
| 157 // |registration_utility| and initializes sync with the returned token. | 137 // |registration_utility| and initializes sync with the returned token. |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 352 |
| 373 // Used to create permission requests. | 353 // Used to create permission requests. |
| 374 ScopedVector<PermissionRequestCreator> permissions_creators_; | 354 ScopedVector<PermissionRequestCreator> permissions_creators_; |
| 375 | 355 |
| 376 ObserverList<SupervisedUserServiceObserver> observer_list_; | 356 ObserverList<SupervisedUserServiceObserver> observer_list_; |
| 377 | 357 |
| 378 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; | 358 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; |
| 379 }; | 359 }; |
| 380 | 360 |
| 381 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ | 361 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ |
| OLD | NEW |