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

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: Refactored. Added LSO UI 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 "base/memory/scoped_ptr.h"
12 #include "net/url_request/url_fetcher_delegate.h"
13
14 class GURL;
15 class Profile;
16
17 namespace net {
18 class URLFetcher;
19 } // namespace net
20
21 namespace arc {
22
23 // Fetches ARC auth code. Fetching process starts automatically on creation.
24 class ArcAuthFetcher : public net::URLFetcherDelegate {
xiyuan 2016/01/26 23:37:05 Is it possible to extend GaiaAuthFetcher to suppor
khmel 2016/01/27 22:36:21 Honestly speaking I was thinking about this possib
25 public:
26 // Returns a result of ARC auth code fetching.
27 class Delegate {
28 public:
29 // Called when code was fetched.
30 virtual void OnAuthCodeFetched(const std::string& code) = 0;
31 // Called when additional UI authorization is required.
32 virtual void OnAuthCodeNeedUI() = 0;
33 // Called when auth code cannot be received.
34 virtual void OnAuthCodeFailed() = 0;
35 };
36
37 ArcAuthFetcher(Profile* profile, Delegate* delegate);
38 ~ArcAuthFetcher() override;
39
40 // net::URLFetcherDelegate overrides.
41 void OnURLFetchComplete(const net::URLFetcher* source) override;
42
43 // Helper function to compose target URL, also is used in test.
44 static GURL CreateURL(Profile* profile);
45
46 private:
47 void FetchAuthCode();
48 // Finds auth code in cookies.
49 static bool ParseAuthCode(const net::URLFetcher* source, std::string* code);
50
51 // Unowned pointers.
52 Profile* profile_;
53 Delegate* delegate_;
54
55 scoped_ptr<net::URLFetcher> auth_fetcher_;
56
57 DISALLOW_COPY_AND_ASSIGN(ArcAuthFetcher);
58 };
59
60 } // namespace arc
61
62 #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