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

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

Issue 2547073002: Fix race issue in ArcAuthService. (Closed)
Patch Set: Address comments Created 4 years 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_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/arc/arc_support_host.h"
13 #include "chrome/browser/chromeos/arc/auth/arc_auth_code_fetcher.h"
14
15 namespace net {
16 class URLRequestContextGetter;
17 }
18
19 namespace arc {
20
21 class ArcAuthContext;
22
23 // Implements the auth token fetching procedure with user's "SIGN IN" button
24 // click.
25 class ArcManualAuthCodeFetcher : public ArcAuthCodeFetcher,
26 public ArcSupportHost::Observer {
27 public:
28 ArcManualAuthCodeFetcher(ArcAuthContext* context,
29 ArcSupportHost* support_host);
30 ~ArcManualAuthCodeFetcher() override;
31
32 // ArcAuthCodeFetcher:
33 void Fetch(const FetchCallback& callback) override;
34
35 private:
36 void FetchInternal();
37
38 // Called when HTTP request gets ready.
39 void OnContextPrepared(net::URLRequestContextGetter* request_context_getter);
40
41 // ArcSupportHost::Observer:
42 void OnAuthSucceeded(const std::string& auth_code) override;
43 void OnRetryClicked() override;
44
45 ArcAuthContext* const context_;
46 ArcSupportHost* const support_host_;
47
48 FetchCallback pending_callback_;
49
50 base::WeakPtrFactory<ArcManualAuthCodeFetcher> weak_ptr_factory_;
51
52 DISALLOW_COPY_AND_ASSIGN(ArcManualAuthCodeFetcher);
53 };
54
55 } // namespace arc
56
57 #endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698