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

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

Issue 522633002: Supervised users: Escape the URL only in permission requests sent through Sync (not Apiary). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years, 3 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_PERMISSION_REQUEST_CREATOR_APIARY_H_ 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ 6 #define CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_
7 7
8 #include "chrome/browser/supervised_user/permission_request_creator.h" 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/supervised_user/permission_request_creator.h"
11 #include "google_apis/gaia/oauth2_token_service.h" 12 #include "google_apis/gaia/oauth2_token_service.h"
12 #include "net/url_request/url_fetcher_delegate.h" 13 #include "net/url_request/url_fetcher_delegate.h"
14 #include "url/gurl.h"
13 15
14 class Profile; 16 class Profile;
15 class SupervisedUserSigninManagerWrapper; 17 class SupervisedUserSigninManagerWrapper;
16 18
17 namespace base { 19 namespace base {
18 class Time; 20 class Time;
19 } 21 }
20 22
21 namespace net { 23 namespace net {
22 class URLFetcher; 24 class URLFetcher;
23 class URLRequestContextGetter; 25 class URLRequestContextGetter;
24 } 26 }
25 27
26 class PermissionRequestCreatorApiary : public PermissionRequestCreator, 28 class PermissionRequestCreatorApiary : public PermissionRequestCreator,
27 public OAuth2TokenService::Consumer, 29 public OAuth2TokenService::Consumer,
28 public net::URLFetcherDelegate { 30 public net::URLFetcherDelegate {
29 public: 31 public:
30 PermissionRequestCreatorApiary( 32 PermissionRequestCreatorApiary(
31 OAuth2TokenService* oauth2_token_service, 33 OAuth2TokenService* oauth2_token_service,
32 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper, 34 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper,
33 net::URLRequestContextGetter* context); 35 net::URLRequestContextGetter* context);
34 virtual ~PermissionRequestCreatorApiary(); 36 virtual ~PermissionRequestCreatorApiary();
35 37
36 static scoped_ptr<PermissionRequestCreator> CreateWithProfile( 38 static scoped_ptr<PermissionRequestCreator> CreateWithProfile(
37 Profile* profile); 39 Profile* profile);
38 40
39 // PermissionRequestCreator implementation: 41 // PermissionRequestCreator implementation:
40 virtual void CreatePermissionRequest(const std::string& url_requested, 42 virtual void CreatePermissionRequest(const GURL& url_requested,
41 const base::Closure& callback) OVERRIDE; 43 const base::Closure& callback) OVERRIDE;
42 44
43 private: 45 private:
44 // OAuth2TokenService::Consumer implementation: 46 // OAuth2TokenService::Consumer implementation:
45 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 47 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
46 const std::string& access_token, 48 const std::string& access_token,
47 const base::Time& expiration_time) OVERRIDE; 49 const base::Time& expiration_time) OVERRIDE;
48 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, 50 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
49 const GoogleServiceAuthError& error) OVERRIDE; 51 const GoogleServiceAuthError& error) OVERRIDE;
50 52
51 // net::URLFetcherDelegate implementation. 53 // net::URLFetcherDelegate implementation.
52 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 54 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
53 55
54 // Requests an access token, which is the first thing we need. This is where 56 // Requests an access token, which is the first thing we need. This is where
55 // we restart when the returned access token has expired. 57 // we restart when the returned access token has expired.
56 void StartFetching(); 58 void StartFetching();
57 59
58 void DispatchNetworkError(int error_code); 60 void DispatchNetworkError(int error_code);
59 void DispatchGoogleServiceAuthError(const GoogleServiceAuthError& error); 61 void DispatchGoogleServiceAuthError(const GoogleServiceAuthError& error);
60 62
61 OAuth2TokenService* oauth2_token_service_; 63 OAuth2TokenService* oauth2_token_service_;
62 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper_; 64 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper_;
63 base::Closure callback_; 65 base::Closure callback_;
64 net::URLRequestContextGetter* context_; 66 net::URLRequestContextGetter* context_;
65 std::string url_requested_; 67 GURL url_requested_;
66 scoped_ptr<OAuth2TokenService::Request> access_token_request_; 68 scoped_ptr<OAuth2TokenService::Request> access_token_request_;
67 std::string access_token_; 69 std::string access_token_;
68 bool access_token_expired_; 70 bool access_token_expired_;
69 scoped_ptr<net::URLFetcher> url_fetcher_; 71 scoped_ptr<net::URLFetcher> url_fetcher_;
70 }; 72 };
71 73
72 #endif // CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ 74 #endif // CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698