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

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

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

Powered by Google App Engine
This is Rietveld 408576698