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

Side by Side Diff: chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.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: test 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_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREATOR _APIARY_H_ 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREATOR _APIARY_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREATOR _APIARY_H_ 6 #define CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREATOR _APIARY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 22 matching lines...) Expand all
33 OAuth2TokenService* oauth2_token_service, 33 OAuth2TokenService* oauth2_token_service,
34 const std::string& account_id, 34 const std::string& account_id,
35 net::URLRequestContextGetter* context); 35 net::URLRequestContextGetter* context);
36 ~PermissionRequestCreatorApiary() override; 36 ~PermissionRequestCreatorApiary() override;
37 37
38 static scoped_ptr<PermissionRequestCreator> CreateWithProfile( 38 static scoped_ptr<PermissionRequestCreator> CreateWithProfile(
39 Profile* profile); 39 Profile* profile);
40 40
41 // PermissionRequestCreator implementation: 41 // PermissionRequestCreator implementation:
42 bool IsEnabled() const override; 42 bool IsEnabled() const override;
43 void CreatePermissionRequest(const GURL& url_requested, 43 void CreateURLAccessRequest(const GURL& url_requested,
44 const SuccessCallback& callback) override; 44 const SuccessCallback& callback) override;
45 void CreateExtensionUpdateRequest(const std::string& extension_id,
46 const SuccessCallback& callback) override;
45 47
46 void set_url_fetcher_id_for_testing(int id) { url_fetcher_id_ = id; } 48 void set_url_fetcher_id_for_testing(int id) { url_fetcher_id_ = id; }
47 49
48 private: 50 private:
49 struct Request; 51 struct Request;
50 typedef ScopedVector<Request>::iterator RequestIterator; 52 typedef ScopedVector<Request>::iterator RequestIterator;
51 53
52 // OAuth2TokenService::Consumer implementation: 54 // OAuth2TokenService::Consumer implementation:
53 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 55 void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
54 const std::string& access_token, 56 const std::string& access_token,
55 const base::Time& expiration_time) override; 57 const base::Time& expiration_time) override;
56 void OnGetTokenFailure(const OAuth2TokenService::Request* request, 58 void OnGetTokenFailure(const OAuth2TokenService::Request* request,
57 const GoogleServiceAuthError& error) override; 59 const GoogleServiceAuthError& error) override;
58 60
59 // net::URLFetcherDelegate implementation. 61 // net::URLFetcherDelegate implementation.
60 void OnURLFetchComplete(const net::URLFetcher* source) override; 62 void OnURLFetchComplete(const net::URLFetcher* source) override;
61 63
62 GURL GetApiUrl() const; 64 GURL GetApiUrl() const;
63 std::string GetApiScope() const; 65 std::string GetApiScope() const;
64 66
67 void CreateRequest(const std::string& request_namespace,
68 const std::string& object_ref,
69 const SuccessCallback& callback);
70
65 // Requests an access token, which is the first thing we need. This is where 71 // Requests an access token, which is the first thing we need. This is where
66 // we restart when the returned access token has expired. 72 // we restart when the returned access token has expired.
67 void StartFetching(Request* request); 73 void StartFetching(Request* request);
68 74
69 void DispatchNetworkError(RequestIterator it, int error_code); 75 void DispatchNetworkError(RequestIterator it, int error_code);
70 void DispatchGoogleServiceAuthError(RequestIterator it, 76 void DispatchGoogleServiceAuthError(RequestIterator it,
71 const GoogleServiceAuthError& error); 77 const GoogleServiceAuthError& error);
72 78
73 OAuth2TokenService* oauth2_token_service_; 79 OAuth2TokenService* oauth2_token_service_;
74 std::string account_id_; 80 std::string account_id_;
75 net::URLRequestContextGetter* context_; 81 net::URLRequestContextGetter* context_;
76 int url_fetcher_id_; 82 int url_fetcher_id_;
77 83
78 ScopedVector<Request> requests_; 84 ScopedVector<Request> requests_;
79 85
80 DISALLOW_COPY_AND_ASSIGN(PermissionRequestCreatorApiary); 86 DISALLOW_COPY_AND_ASSIGN(PermissionRequestCreatorApiary);
81 }; 87 };
82 88
83 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREA TOR_APIARY_H_ 89 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREA TOR_APIARY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698