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

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

Issue 335833003: Rename "managed (mode|user)" to "supervised user" (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments (+ a few other cleanups) Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_MANAGED_MODE_PERMISSION_REQUEST_CREATOR_APIARY_H_
6 #define CHROME_BROWSER_MANAGED_MODE_PERMISSION_REQUEST_CREATOR_APIARY_H_
7
8 #include "chrome/browser/managed_mode/permission_request_creator.h"
9
10 #include "base/memory/scoped_ptr.h"
11 #include "google_apis/gaia/oauth2_token_service.h"
12 #include "net/url_request/url_fetcher_delegate.h"
13
14 class ManagedUserSigninManagerWrapper;
15 class Profile;
16
17 namespace base {
18 class Time;
19 }
20
21 namespace net {
22 class URLFetcher;
23 class URLRequestContextGetter;
24 }
25
26 class PermissionRequestCreatorApiary : public PermissionRequestCreator,
27 public OAuth2TokenService::Consumer,
28 public net::URLFetcherDelegate {
29 public:
30 PermissionRequestCreatorApiary(
31 OAuth2TokenService* oauth2_token_service,
32 scoped_ptr<ManagedUserSigninManagerWrapper> signin_wrapper,
33 net::URLRequestContextGetter* context);
34 virtual ~PermissionRequestCreatorApiary();
35
36 static scoped_ptr<PermissionRequestCreator> CreateWithProfile(
37 Profile* profile);
38
39 // PermissionRequestCreator implementation:
40 virtual void CreatePermissionRequest(const std::string& url_requested,
41 const base::Closure& callback) OVERRIDE;
42
43 private:
44 // OAuth2TokenService::Consumer implementation:
45 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
46 const std::string& access_token,
47 const base::Time& expiration_time) OVERRIDE;
48 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
49 const GoogleServiceAuthError& error) OVERRIDE;
50
51 // net::URLFetcherDelegate implementation.
52 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
53
54 // Requests an access token, which is the first thing we need. This is where
55 // we restart when the returned access token has expired.
56 void StartFetching();
57
58 void DispatchNetworkError(int error_code);
59 void DispatchGoogleServiceAuthError(const GoogleServiceAuthError& error);
60
61 OAuth2TokenService* oauth2_token_service_;
62 scoped_ptr<ManagedUserSigninManagerWrapper> signin_wrapper_;
63 base::Closure callback_;
64 net::URLRequestContextGetter* context_;
65 std::string url_requested_;
66 scoped_ptr<OAuth2TokenService::Request> access_token_request_;
67 std::string access_token_;
68 bool access_token_expired_;
69 scoped_ptr<net::URLFetcher> url_fetcher_;
70 };
71
72 #endif // CHROME_BROWSER_MANAGED_MODE_PERMISSION_REQUEST_CREATOR_APIARY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698