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

Side by Side Diff: components/arc/auth/arc_auth_fetcher.h

Issue 1618193003: arc: Pass auth token from Chrome to ARC instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update BUILD.gn Created 4 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
« no previous file with comments | « components/arc/auth/DEPS ('k') | components/arc/auth/arc_auth_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_ARC_AUTH_ARC_AUTH_FETCHER_H_
6 #define COMPONENTS_ARC_AUTH_ARC_AUTH_FETCHER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "google_apis/gaia/gaia_auth_consumer.h"
12 #include "google_apis/gaia/gaia_auth_fetcher.h"
13
14 class GURL;
15
16 namespace net {
17 class URLRequestContextGetter;
18 }
19
20 namespace arc {
21
22 // Fetches ARC auth code. Fetching process starts automatically on creation.
23 class ArcAuthFetcher : public GaiaAuthConsumer {
24 public:
25 // Returns a result of ARC auth code fetching.
26 class Delegate {
27 public:
28 // Called when code was fetched.
29 virtual void OnAuthCodeFetched(const std::string& code) = 0;
30 // Called when additional UI authorization is required.
31 virtual void OnAuthCodeNeedUI() = 0;
32 // Called when auth code cannot be received.
33 virtual void OnAuthCodeFailed() = 0;
34
35 protected:
36 virtual ~Delegate() = default;
37 };
38
39 ArcAuthFetcher(net::URLRequestContextGetter* getter, Delegate* delegate);
40 ~ArcAuthFetcher() override = default;
41
42 // GaiaAuthConsumer:
43 void OnClientOAuthCode(const std::string& auth_code) override;
44 void OnClientOAuthFailure(const GoogleServiceAuthError& error) override;
45
46 // Helper function to compose target URL for current user, also is used in
47 // test.
48 static GURL CreateURL();
49
50 private:
51 void FetchAuthCode();
52
53 // Unowned pointer.
54 Delegate* const delegate_;
55
56 GaiaAuthFetcher auth_fetcher_;
57
58 DISALLOW_COPY_AND_ASSIGN(ArcAuthFetcher);
59 };
60
61 } // namespace arc
62
63 #endif // COMPONENTS_ARC_AUTH_ARC_AUTH_FETCHER_H_
OLDNEW
« no previous file with comments | « components/arc/auth/DEPS ('k') | components/arc/auth/arc_auth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698