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

Side by Side Diff: chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h

Issue 2655873002: Get enrollment token from DMServer when an Active Directory user uses ARC (Closed)
Patch Set: Fix Luis's comments Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/chromeos/arc/arc_auth_context.h" 14 #include "chrome/browser/chromeos/arc/arc_auth_context.h"
15 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" 15 #include "chrome/browser/chromeos/arc/arc_optin_uma.h"
16 #include "chrome/browser/chromeos/arc/auth/arc_auth_code_fetcher.h" 16 #include "chrome/browser/chromeos/arc/auth/arc_auth_info_fetcher.h"
17 #include "google_apis/gaia/oauth2_token_service.h" 17 #include "google_apis/gaia/oauth2_token_service.h"
18 #include "net/url_request/url_fetcher_delegate.h" 18 #include "net/url_request/url_fetcher_delegate.h"
19 19
20 class Profile; 20 class Profile;
21 21
22 namespace net { 22 namespace net {
23 class URLFetcher; 23 class URLFetcher;
24 class URLRequestContextGetter; 24 class URLRequestContextGetter;
25 } 25 }
26 26
27 namespace arc { 27 namespace arc {
28 28
29 // The instance is not reusable, so for each Fetch(), the instance must be 29 // The instance is not reusable, so for each Fetch(), the instance must be
30 // re-created. Deleting the instance cancels inflight operation. 30 // re-created. Deleting the instance cancels inflight operation.
31 class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher, 31 class ArcBackgroundAuthCodeFetcher : public ArcAuthInfoFetcher,
32 public OAuth2TokenService::Consumer, 32 public OAuth2TokenService::Consumer,
33 public net::URLFetcherDelegate { 33 public net::URLFetcherDelegate {
34 public: 34 public:
35 ArcBackgroundAuthCodeFetcher(Profile* profile, ArcAuthContext* context); 35 ArcBackgroundAuthCodeFetcher(Profile* profile, ArcAuthContext* context);
36 ~ArcBackgroundAuthCodeFetcher() override; 36 ~ArcBackgroundAuthCodeFetcher() override;
37 37
38 // ArcAuthCodeFetcher: 38 // ArcAuthInfoFetcher:
39 void Fetch(const FetchCallback& callback) override; 39 void Fetch(const FetchCallback& callback) override;
40 40
41 private: 41 private:
42 void ResetFetchers(); 42 void ResetFetchers();
43 void OnPrepared(net::URLRequestContextGetter* request_context_getter); 43 void OnPrepared(net::URLRequestContextGetter* request_context_getter);
44 44
45 // OAuth2TokenService::Consumer: 45 // OAuth2TokenService::Consumer:
46 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 46 void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
47 const std::string& access_token, 47 const std::string& access_token,
48 const base::Time& expiration_time) override; 48 const base::Time& expiration_time) override;
(...skipping 17 matching lines...) Expand all
66 std::unique_ptr<net::URLFetcher> auth_code_fetcher_; 66 std::unique_ptr<net::URLFetcher> auth_code_fetcher_;
67 67
68 base::WeakPtrFactory<ArcBackgroundAuthCodeFetcher> weak_ptr_factory_; 68 base::WeakPtrFactory<ArcBackgroundAuthCodeFetcher> weak_ptr_factory_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(ArcBackgroundAuthCodeFetcher); 70 DISALLOW_COPY_AND_ASSIGN(ArcBackgroundAuthCodeFetcher);
71 }; 71 };
72 72
73 } // namespace arc 73 } // namespace arc
74 74
75 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_ 75 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_BACKGROUND_AUTH_CODE_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698