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

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

Issue 2771943003: arc: Skip GMS Sign-In in case Android is already signed-in. (Closed)
Patch Set: use sparse UMA Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_auth_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 18 matching lines...) Expand all
29 class ArcAuthContext : public UbertokenConsumer, 29 class ArcAuthContext : public UbertokenConsumer,
30 public GaiaAuthConsumer, 30 public GaiaAuthConsumer,
31 public OAuth2TokenService::Observer { 31 public OAuth2TokenService::Observer {
32 public: 32 public:
33 explicit ArcAuthContext(Profile* profile); 33 explicit ArcAuthContext(Profile* profile);
34 ~ArcAuthContext() override; 34 ~ArcAuthContext() override;
35 35
36 ProfileOAuth2TokenService* token_service() { return token_service_; } 36 ProfileOAuth2TokenService* token_service() { return token_service_; }
37 const std::string& account_id() const { return account_id_; } 37 const std::string& account_id() const { return account_id_; }
38 38
39 // Returns full account id, including dots that are removed in CrOS for
40 // the default account id.
41 const std::string& full_account_id() const { return full_account_id_; }
42
39 // Prepares the context. Calling while an inflight operation exists will 43 // Prepares the context. Calling while an inflight operation exists will
40 // cancel the inflight operation. 44 // cancel the inflight operation.
41 // On completion, |context| is passed to the callback. On error, |context| 45 // On completion, |context| is passed to the callback. On error, |context|
42 // is nullptr. 46 // is nullptr.
43 using PrepareCallback = 47 using PrepareCallback =
44 base::Callback<void(net::URLRequestContextGetter* context)>; 48 base::Callback<void(net::URLRequestContextGetter* context)>;
45 void Prepare(const PrepareCallback& callback); 49 void Prepare(const PrepareCallback& callback);
46 50
47 // OAuth2TokenService::Observer: 51 // OAuth2TokenService::Observer:
48 void OnRefreshTokenAvailable(const std::string& account_id) override; 52 void OnRefreshTokenAvailable(const std::string& account_id) override;
49 void OnRefreshTokensLoaded() override; 53 void OnRefreshTokensLoaded() override;
50 54
51 // UbertokenConsumer: 55 // UbertokenConsumer:
52 void OnUbertokenSuccess(const std::string& token) override; 56 void OnUbertokenSuccess(const std::string& token) override;
53 void OnUbertokenFailure(const GoogleServiceAuthError& error) override; 57 void OnUbertokenFailure(const GoogleServiceAuthError& error) override;
54 58
55 // GaiaAuthConsumer: 59 // GaiaAuthConsumer:
56 void OnMergeSessionSuccess(const std::string& data) override; 60 void OnMergeSessionSuccess(const std::string& data) override;
57 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; 61 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override;
58 62
59 private: 63 private:
60 void OnRefreshTokenTimeout(); 64 void OnRefreshTokenTimeout();
61 65
62 void StartFetchers(); 66 void StartFetchers();
63 void ResetFetchers(); 67 void ResetFetchers();
64 68
65 // Unowned pointer. 69 // Unowned pointer.
66 ProfileOAuth2TokenService* token_service_; 70 ProfileOAuth2TokenService* token_service_;
67 std::string account_id_; 71 std::string account_id_;
72 std::string full_account_id_;
68 73
69 // Owned by content::BrowserContent. Used to isolate cookies for auth server 74 // Owned by content::BrowserContent. Used to isolate cookies for auth server
70 // communication and shared with ARC OptIn UI platform app. 75 // communication and shared with ARC OptIn UI platform app.
71 content::StoragePartition* storage_partition_ = nullptr; 76 content::StoragePartition* storage_partition_ = nullptr;
72 77
73 PrepareCallback callback_; 78 PrepareCallback callback_;
74 bool context_prepared_ = false; 79 bool context_prepared_ = false;
75 80
76 base::OneShotTimer refresh_token_timeout_; 81 base::OneShotTimer refresh_token_timeout_;
77 std::unique_ptr<GaiaAuthFetcher> merger_fetcher_; 82 std::unique_ptr<GaiaAuthFetcher> merger_fetcher_;
78 std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_; 83 std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_;
79 84
80 DISALLOW_COPY_AND_ASSIGN(ArcAuthContext); 85 DISALLOW_COPY_AND_ASSIGN(ArcAuthContext);
81 }; 86 };
82 87
83 } // namespace arc 88 } // namespace arc
84 89
85 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_ 90 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_auth_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698