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

Side by Side Diff: chrome/browser/chromeos/arc/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: fix accidental change Created 4 years, 11 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
(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 CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_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 } // namespace net
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 };
xiyuan 2016/01/27 23:56:05 nit: add protected: virtual ~Delegate() {} jus
khmel 2016/01/28 05:22:08 Done.
35
36 ArcAuthFetcher(net::URLRequestContextGetter* getter, Delegate* delegate);
37 ~ArcAuthFetcher() override;
38
39 // GaiaAuthConsumer overrides.
40 void OnClientOAuthCode(const std::string& auth_code) override;
41 void OnClientOAuthSuccess(const ClientOAuthResult& result) override;
42 void OnClientOAuthFailure(const GoogleServiceAuthError& error) override;
43
44 // Helper function to compose target URL for current user, also is used in
45 // test.
46 static GURL CreateURL();
47
48 private:
49 void FetchAuthCode();
50
51 // Unowned pointer.
52 Delegate* delegate_;
xiyuan 2016/01/27 23:56:05 nit: Delegate* const since it should never change.
khmel 2016/01/28 05:22:08 Done.
53
54 GaiaAuthFetcher auth_fetcher_;
55
56 DISALLOW_COPY_AND_ASSIGN(ArcAuthFetcher);
57 };
58
59 } // namespace arc
60
61 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_FETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_auth_fetcher.cc » ('j') | chrome/browser/chromeos/arc/arc_auth_fetcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698