Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_CONTEXT_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/timer/timer.h" | |
| 13 #include "google_apis/gaia/ubertoken_fetcher.h" | |
| 14 | |
| 15 class ArcAuthContextDelegate; | |
| 16 class Profile; | |
| 17 class ProfileOAuth2TokenService; | |
| 18 | |
| 19 namespace content { | |
| 20 class StoragePartition; | |
| 21 } | |
| 22 | |
|
xiyuan
2016/06/28 21:49:13
nit: namespace arc { ?
khmel
2016/06/29 00:33:40
Done.
| |
| 23 class ArcAuthContext : public UbertokenConsumer, | |
| 24 public GaiaAuthConsumer, | |
| 25 public OAuth2TokenService::Observer { | |
| 26 public: | |
| 27 ArcAuthContext(ArcAuthContextDelegate* delegate, Profile* profile); | |
| 28 ~ArcAuthContext() override; | |
| 29 | |
| 30 void PrepareContext(); | |
| 31 | |
| 32 const std::string& account_id() const { return account_id_; } | |
| 33 | |
| 34 ProfileOAuth2TokenService* token_service() { return token_service_; } | |
|
xiyuan
2016/06/28 21:49:13
nit: move the two accessor to the end of declartio
khmel
2016/06/29 00:33:40
Done.
| |
| 35 | |
| 36 // OAuth2TokenService::Observer: | |
| 37 void OnRefreshTokenAvailable(const std::string& account_id) override; | |
| 38 void OnRefreshTokensLoaded() override; | |
| 39 | |
| 40 // UbertokenConsumer: | |
| 41 void OnUbertokenSuccess(const std::string& token) override; | |
| 42 void OnUbertokenFailure(const GoogleServiceAuthError& error) override; | |
| 43 | |
| 44 // GaiaAuthConsumer: | |
| 45 void OnMergeSessionSuccess(const std::string& data) override; | |
| 46 void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; | |
| 47 | |
| 48 private: | |
| 49 void StartFetchers(); | |
| 50 void OnRefreshTokenTimeout(); | |
| 51 | |
| 52 // Unowned pointers. | |
| 53 ArcAuthContextDelegate* const delegate_; | |
| 54 ProfileOAuth2TokenService* token_service_; | |
| 55 | |
| 56 bool context_prepared_ = false; | |
| 57 | |
| 58 // Owned by content::BrowserContent. Used to isolate cookies for auth server | |
| 59 // communication and shared with Arc OptIn UI platform app. | |
| 60 content::StoragePartition* storage_partition_; | |
|
xiyuan
2016/06/28 21:49:13
nit: = nullptr ?
khmel
2016/06/29 00:33:40
Done.
| |
| 61 | |
| 62 std::string account_id_; | |
| 63 std::unique_ptr<GaiaAuthFetcher> merger_fetcher_; | |
| 64 std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_; | |
| 65 base::OneShotTimer refresh_token_timeout_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(ArcAuthContext); | |
| 68 }; | |
| 69 | |
| 70 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_ | |
| OLD | NEW |