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

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service.h

Issue 1681813003: arc: Use incognito profile for OptIn and cookie fetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
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 f5668d4437d936820e227868e3f317cece02a42d..329b8e980d1f2502b88bc32db9f53bf9947f7e0a 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.h
+++ b/chrome/browser/chromeos/arc/arc_auth_service.h
@@ -10,17 +10,27 @@
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
-#include "chrome/browser/chromeos/arc/arc_auth_ui.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_service.h"
#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"
+class GaiaAuthFetcher;
class PrefService;
xiyuan 2016/02/11 17:57:20 nit: not used?
khmel 2016/02/12 02:45:23 Done.
class Profile;
+namespace content {
+class StoragePartition;
+}
+
+namespace net {
+class URLRequestContextGetter;
+}
+
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -33,7 +43,8 @@ class ArcAuthService : public ArcService,
public AuthHost,
public ArcBridgeService::Observer,
public ArcAuthFetcher::Delegate,
- public ArcAuthUI::Delegate {
+ public UbertokenConsumer,
+ public GaiaAuthConsumer {
public:
enum class State {
DISABLE, // ARC is not allowed to run (default).
@@ -47,7 +58,10 @@ class ArcAuthService : public ArcService,
virtual ~Observer() = default;
// Called whenever Opt-In state of the ARC has been changed.
- virtual void OnOptInChanged(State state) = 0;
+ virtual void OnOptInChanged(State state) {}
+
+ // Called to notify that OptIn UI needs to be closed.
+ virtual void OnOptInUINeedToClose() {}
};
explicit ArcAuthService(ArcBridgeService* bridge_service);
@@ -68,10 +82,6 @@ class ArcAuthService : public ArcService,
State state() const { return state_; }
- // Sets the auth code. Can be set from internally or from external component
- // that accepts user's credentials. This actually starts ARC bridge service.
- void SetAuthCodeAndStartArc(const std::string& auth_code);
-
std::string GetAndResetAuthCode();
// Adds or removes observers.
@@ -87,16 +97,26 @@ class ArcAuthService : public ArcService,
const GetAuthCodeDeprecatedCallback& callback) override;
void GetAuthCode(const GetAuthCodeCallback& callback) override;
+ // Called from Arc OptIn UI to check an auth code.
+ void CheckAuthCode();
+
// ArcAuthFetcher::Delegate:
void OnAuthCodeFetched(const std::string& auth_code) override;
void OnAuthCodeNeedUI() override;
void OnAuthCodeFailed() override;
- // ArcAuthUI::Delegate:
- 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 SetAuthCodeAndStartArc(const std::string& auth_code);
void FetchAuthCode();
+ void ShowUI();
void CloseUI();
void SetState(State state);
void ShutdownBridgeAndCloseUI();
@@ -104,9 +124,9 @@ class ArcAuthService : public ArcService,
// Unowned pointer. Keeps current profile.
Profile* profile_ = nullptr;
-
- // Owned by view hierarchy.
- ArcAuthUI* auth_ui_ = nullptr;
+ // Owned by content::BrowserContent. Used to isolate cookies for auth server
+ // communication and shared with Arc OptIn UI platform app.
+ content::StoragePartition* storage_partition_ = nullptr;
// Registrar used to monitor ARC opt-in state.
PrefChangeRegistrar pref_change_registrar_;
@@ -116,6 +136,8 @@ 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_;
DISALLOW_COPY_AND_ASSIGN(ArcAuthService);

Powered by Google App Engine
This is Rietveld 408576698