Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(962)

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service.h

Issue 971733003: Supervised users: When an extension requires new permissions, send request to custodian (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_ext_install_disable
Patch Set: review Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // (in SupervisedUserResourceThrottle). 104 // (in SupervisedUserResourceThrottle).
105 scoped_refptr<const SupervisedUserURLFilter> GetURLFilterForIOThread(); 105 scoped_refptr<const SupervisedUserURLFilter> GetURLFilterForIOThread();
106 106
107 // Returns the URL filter for the UI thread, for filtering navigations and 107 // Returns the URL filter for the UI thread, for filtering navigations and
108 // classifying sites in the history view. 108 // classifying sites in the history view.
109 SupervisedUserURLFilter* GetURLFilterForUIThread(); 109 SupervisedUserURLFilter* GetURLFilterForUIThread();
110 110
111 // Returns the whitelist service. 111 // Returns the whitelist service.
112 SupervisedUserWhitelistService* GetWhitelistService(); 112 SupervisedUserWhitelistService* GetWhitelistService();
113 113
114 // Whether the user can request access to blocked URLs. 114 // Whether the user can request to get access to blocked URLs or to new
115 // extensions.
115 bool AccessRequestsEnabled(); 116 bool AccessRequestsEnabled();
116 117
117 // Adds an access request for the given URL. The requests are stored using 118 // Adds an access request for the given URL.
118 // a prefix followed by a URIEncoded version of the URL. Each entry contains 119 void AddURLAccessRequest(const GURL& url, const SuccessCallback& callback);
119 // a dictionary which currently has the timestamp of the request in it. 120
120 void AddAccessRequest(const GURL& url, const SuccessCallback& callback); 121 // Adds an update request for the given WebStore item (App/Extension).
122 void AddExtensionUpdateRequest(const std::string& extension_id,
123 const SuccessCallback& callback);
121 124
122 // Returns the email address of the custodian. 125 // Returns the email address of the custodian.
123 std::string GetCustodianEmailAddress() const; 126 std::string GetCustodianEmailAddress() const;
124 127
125 // Returns the name of the custodian, or the email address if the name is 128 // Returns the name of the custodian, or the email address if the name is
126 // empty. 129 // empty.
127 std::string GetCustodianName() const; 130 std::string GetCustodianName() const;
128 131
129 // Returns the email address of the second custodian, or the empty string 132 // Returns the email address of the second custodian, or the empty string
130 // if there is no second custodian. 133 // if there is no second custodian.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // (the filter will live as long as the profile lives, and afterwards it 225 // (the filter will live as long as the profile lives, and afterwards it
223 // should not be used anymore either). 226 // should not be used anymore either).
224 scoped_refptr<SupervisedUserURLFilter> ui_url_filter_; 227 scoped_refptr<SupervisedUserURLFilter> ui_url_filter_;
225 scoped_refptr<SupervisedUserURLFilter> io_url_filter_; 228 scoped_refptr<SupervisedUserURLFilter> io_url_filter_;
226 229
227 SupervisedUserBlacklist blacklist_; 230 SupervisedUserBlacklist blacklist_;
228 231
229 DISALLOW_COPY_AND_ASSIGN(URLFilterContext); 232 DISALLOW_COPY_AND_ASSIGN(URLFilterContext);
230 }; 233 };
231 234
235 // Helper classes to send different kinds of permission requests.
236 class SendPermissionRequestHelper;
237 class SendURLAccessRequestHelper;
238 class SendExtensionUpdateRequestHelper;
239
232 // Use |SupervisedUserServiceFactory::GetForProfile(..)| to get 240 // Use |SupervisedUserServiceFactory::GetForProfile(..)| to get
233 // an instance of this service. 241 // an instance of this service.
234 explicit SupervisedUserService(Profile* profile); 242 explicit SupervisedUserService(Profile* profile);
235 243
236 void SetActive(bool active); 244 void SetActive(bool active);
237 245
238 void OnCustodianProfileDownloaded(const base::string16& full_name); 246 void OnCustodianProfileDownloaded(const base::string16& full_name);
239 247
240 void OnSupervisedUserRegistered(const AuthErrorCallback& callback, 248 void OnSupervisedUserRegistered(const AuthErrorCallback& callback,
241 Profile* custodian_profile, 249 Profile* custodian_profile,
(...skipping 17 matching lines...) Expand all
259 bool MustRemainInstalled(const extensions::Extension* extension, 267 bool MustRemainInstalled(const extensions::Extension* extension,
260 base::string16* error) const override; 268 base::string16* error) const override;
261 269
262 // Extensions helper to SetActive(). 270 // Extensions helper to SetActive().
263 void SetExtensionsActive(); 271 void SetExtensionsActive();
264 #endif 272 #endif
265 273
266 SupervisedUserSettingsService* GetSettingsService(); 274 SupervisedUserSettingsService* GetSettingsService();
267 275
268 size_t FindEnabledPermissionRequestCreator(size_t start); 276 size_t FindEnabledPermissionRequestCreator(size_t start);
269 void AddAccessRequestInternal(const GURL& url, 277 void AddPermissionRequestInternal(
270 const SuccessCallback& callback, 278 scoped_ptr<SendPermissionRequestHelper> helper,
271 size_t index); 279 const SuccessCallback& callback,
272 void OnPermissionRequestIssued(const GURL& url, 280 size_t index);
273 const SuccessCallback& callback, 281 void OnPermissionRequestIssued(
274 size_t index, 282 scoped_ptr<SendPermissionRequestHelper> helper,
275 bool success); 283 const SuccessCallback& callback,
284 size_t index,
285 bool success);
276 286
277 void OnSupervisedUserIdChanged(); 287 void OnSupervisedUserIdChanged();
278 288
279 void OnDefaultFilteringBehaviorChanged(); 289 void OnDefaultFilteringBehaviorChanged();
280 290
281 void OnSiteListsChanged( 291 void OnSiteListsChanged(
282 const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists); 292 const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists);
283 293
284 // Asynchronously downloads a static blacklist file from |url|, stores it at 294 // Asynchronously downloads a static blacklist file from |url|, stores it at
285 // |path|, loads it, and applies it to the URL filters. If |url| is not valid 295 // |path|, loads it, and applies it to the URL filters. If |url| is not valid
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 356
347 // Used to create permission requests. 357 // Used to create permission requests.
348 ScopedVector<PermissionRequestCreator> permissions_creators_; 358 ScopedVector<PermissionRequestCreator> permissions_creators_;
349 359
350 ObserverList<SupervisedUserServiceObserver> observer_list_; 360 ObserverList<SupervisedUserServiceObserver> observer_list_;
351 361
352 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_; 362 base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_;
353 }; 363 };
354 364
355 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_ 365 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698