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

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_context.h

Issue 2320813002: arc: Enable silent PlayStore Sign-In. (Closed)
Patch Set: nits Created 4 years, 3 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_ARC_AUTH_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "google_apis/gaia/ubertoken_fetcher.h" 13 #include "google_apis/gaia/ubertoken_fetcher.h"
14 14
15 class Profile; 15 class Profile;
16 class ProfileOAuth2TokenService; 16 class ProfileOAuth2TokenService;
17 17
18 namespace content { 18 namespace content {
19 class StoragePartition; 19 class StoragePartition;
20 } 20 }
21 21
22 namespace net {
23 class URLRequestContextGetter;
24 }
25
22 namespace arc { 26 namespace arc {
23 27
24 class ArcAuthContextDelegate; 28 class ArcAuthContextDelegate;
25 29
26 class ArcAuthContext : public UbertokenConsumer, 30 class ArcAuthContext : public UbertokenConsumer,
27 public GaiaAuthConsumer, 31 public GaiaAuthConsumer,
28 public OAuth2TokenService::Observer { 32 public OAuth2TokenService::Observer {
29 public: 33 public:
30 ArcAuthContext(ArcAuthContextDelegate* delegate, Profile* profile); 34 ArcAuthContext(ArcAuthContextDelegate* delegate, Profile* profile);
31 ~ArcAuthContext() override; 35 ~ArcAuthContext() override;
32 36
33 void PrepareContext(); 37 void PrepareContext();
34 38
39 // Returns the URL request context information associated with this context.
40 net::URLRequestContextGetter* GetURLRequestContext();
41
35 // OAuth2TokenService::Observer: 42 // OAuth2TokenService::Observer:
36 void OnRefreshTokenAvailable(const std::string& account_id) override; 43 void OnRefreshTokenAvailable(const std::string& account_id) override;
37 void OnRefreshTokensLoaded() override; 44 void OnRefreshTokensLoaded() override;
38 45
39 // UbertokenConsumer: 46 // UbertokenConsumer:
40 void OnUbertokenSuccess(const std::string& token) override; 47 void OnUbertokenSuccess(const std::string& token) override;
41 void OnUbertokenFailure(const GoogleServiceAuthError& error) override; 48 void OnUbertokenFailure(const GoogleServiceAuthError& error) override;
42 49
43 // GaiaAuthConsumer: 50 // GaiaAuthConsumer:
44 void OnMergeSessionSuccess(const std::string& data) override; 51 void OnMergeSessionSuccess(const std::string& data) override;
45 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; 52 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override;
46 53
47 const std::string& account_id() const { return account_id_; } 54 const std::string& account_id() const { return account_id_; }
48 55
49 ProfileOAuth2TokenService* token_service() { return token_service_; } 56 ProfileOAuth2TokenService* token_service() { return token_service_; }
50 57
51 private: 58 private:
52 void StartFetchers(); 59 void StartFetchers();
60 void ResetFetchers();
53 void OnRefreshTokenTimeout(); 61 void OnRefreshTokenTimeout();
54 62
55 // Unowned pointers. 63 // Unowned pointers.
56 ArcAuthContextDelegate* const delegate_; 64 ArcAuthContextDelegate* const delegate_;
57 ProfileOAuth2TokenService* token_service_; 65 ProfileOAuth2TokenService* token_service_;
58 66
59 bool context_prepared_ = false; 67 bool context_prepared_ = false;
60 68
61 // Owned by content::BrowserContent. Used to isolate cookies for auth server 69 // Owned by content::BrowserContent. Used to isolate cookies for auth server
62 // communication and shared with Arc OptIn UI platform app. 70 // communication and shared with Arc OptIn UI platform app.
63 content::StoragePartition* storage_partition_ = nullptr; 71 content::StoragePartition* storage_partition_ = nullptr;
64 72
65 std::string account_id_; 73 std::string account_id_;
66 std::unique_ptr<GaiaAuthFetcher> merger_fetcher_; 74 std::unique_ptr<GaiaAuthFetcher> merger_fetcher_;
67 std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_; 75 std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_;
68 base::OneShotTimer refresh_token_timeout_; 76 base::OneShotTimer refresh_token_timeout_;
69 77
70 DISALLOW_COPY_AND_ASSIGN(ArcAuthContext); 78 DISALLOW_COPY_AND_ASSIGN(ArcAuthContext);
71 }; 79 };
72 80
73 } // namespace arc 81 } // namespace arc
74 82
75 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_ 83 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_code_fetcher_delegate.h ('k') | chrome/browser/chromeos/arc/arc_auth_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698