Index: chrome/browser/chromeos/arc/arc_auth_service.h |
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.h b/chrome/browser/chromeos/arc/arc_auth_service.h |
index 1e3eea4b649ee1c6aa77fa3a40d901b9721ffc6b..a5ee3623583c47bb8663a99607a7f5445c8e58d3 100644 |
--- a/chrome/browser/chromeos/arc/arc_auth_service.h |
+++ b/chrome/browser/chromeos/arc/arc_auth_service.h |
@@ -16,11 +16,19 @@ |
#include "components/arc/auth/arc_auth_fetcher.h" |
#include "components/arc/common/auth.mojom.h" |
#include "components/prefs/pref_change_registrar.h" |
+#include "google_apis/gaia/gaia_auth_consumer.h" |
+#include "google_apis/gaia/ubertoken_fetcher.h" |
#include "mojo/public/cpp/bindings/binding.h" |
+#include "net/cookies/canonical_cookie.h" |
+class GaiaAuthFetcher; |
class PrefService; |
class Profile; |
+namespace net { |
+class URLRequestContextGetter; |
+} |
+ |
namespace user_prefs { |
class PrefRegistrySyncable; |
} |
@@ -33,7 +41,9 @@ class ArcAuthService : public ArcService, |
public AuthHost, |
public ArcBridgeService::Observer, |
public ArcAuthFetcher::Delegate, |
- public ArcAuthUI::Delegate { |
+ public ArcAuthUI::Delegate, |
+ public UbertokenConsumer, |
+ public GaiaAuthConsumer { |
public: |
enum class State { |
DISABLE, // ARC is not allowed to run (default). |
@@ -88,17 +98,46 @@ class ArcAuthService : public ArcService, |
void OnAuthCodeFailed() override; |
// ArcAuthUI::Delegate: |
+ void OnAuthCodeFetchedFromUI(const std::string& auth_code) override; |
void OnAuthUIClosed() override; |
+ // UbertokenConsumer: |
+ void OnUbertokenSuccess(const std::string& token) override; |
+ void OnUbertokenFailure(const GoogleServiceAuthError& error) override; |
+ |
+ // GaiaAuthConsumer: |
+ void OnMergeSessionSuccess(const std::string& data) override; |
+ void OnMergeSessionFailure(const GoogleServiceAuthError& error) override; |
+ |
private: |
void FetchAuthCode(); |
+ void ShowUI(); |
void CloseUI(); |
void SetState(State state); |
void ShutdownBridgeAndCloseUI(); |
void OnOptInPreferenceChanged(); |
+ void CopyCookiesAndStartFetching(); |
+ void StartFetcherOnUIThread(); |
+ void CleanupSigninProfile(); |
+ |
+ void StartCopyFromArcCookiesOnIOThread( |
+ net::URLRequestContextGetter* context_getter_from, |
+ net::URLRequestContextGetter* context_getter_to); |
+ void CopyFromArcCookiesOnIOThread( |
+ net::URLRequestContextGetter* context_getter, |
+ const net::CookieList& cookie_list); |
+ void StartCopyToArcCookiesOnIOThread( |
+ const std::string& auth_code, |
+ net::URLRequestContextGetter* context_getter_from, |
+ net::URLRequestContextGetter* context_getter_to); |
+ void CopyToArcCookiesOnIOThread(const std::string& auth_code, |
+ net::URLRequestContextGetter* context_getter, |
+ const net::CookieList& cookie_list); |
// Unowned pointer. Keeps current profile. |
Profile* profile_ = nullptr; |
+ // Unowned pointer. Keeps sign-in profile. |
+ Profile* signin_profile_ = nullptr; |
// Owned by view hierarchy. |
ArcAuthUI* auth_ui_ = nullptr; |
@@ -111,7 +150,11 @@ class ArcAuthService : public ArcService, |
State state_ = State::DISABLE; |
base::ObserverList<Observer> observer_list_; |
scoped_ptr<ArcAuthFetcher> auth_fetcher_; |
+ scoped_ptr<GaiaAuthFetcher> merger_fetcher_; |
+ scoped_ptr<UbertokenFetcher> ubertoken_fethcher_; |
std::string auth_code_; |
+ bool signin_profile_dirty_ = false; |
+ int retry_cnt_ = 0; |
DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
}; |