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

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

Issue 2102793002: arc: Implement silent OptIn mode for managed Arc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 6 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_context.h
diff --git a/chrome/browser/chromeos/arc/arc_auth_context.h b/chrome/browser/chromeos/arc/arc_auth_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..d1f111525f88a203030462f00fdfe7467c932847
--- /dev/null
+++ b/chrome/browser/chromeos/arc/arc_auth_context.h
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "base/timer/timer.h"
+#include "google_apis/gaia/ubertoken_fetcher.h"
+
+class Profile;
+class ProfileOAuth2TokenService;
+
+namespace content {
+class StoragePartition;
+}
+
+namespace arc {
+
+class ArcAuthContextDelegate;
+
+class ArcAuthContext : public UbertokenConsumer,
+ public GaiaAuthConsumer,
+ public OAuth2TokenService::Observer {
+ public:
+ ArcAuthContext(ArcAuthContextDelegate* delegate, Profile* profile);
+ ~ArcAuthContext() override;
+
+ void PrepareContext();
+
+ // OAuth2TokenService::Observer:
+ void OnRefreshTokenAvailable(const std::string& account_id) override;
+ void OnRefreshTokensLoaded() 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;
+
+ const std::string& account_id() const { return account_id_; }
+
+ ProfileOAuth2TokenService* token_service() { return token_service_; }
+
+ private:
+ void StartFetchers();
+ void OnRefreshTokenTimeout();
+
+ // Unowned pointers.
+ ArcAuthContextDelegate* const delegate_;
+ ProfileOAuth2TokenService* token_service_;
+
+ bool context_prepared_ = false;
+
+ // 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;
+
+ std::string account_id_;
+ std::unique_ptr<GaiaAuthFetcher> merger_fetcher_;
+ std::unique_ptr<UbertokenFetcher> ubertoken_fetcher_;
+ base::OneShotTimer refresh_token_timeout_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcAuthContext);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_CONTEXT_H_
« no previous file with comments | « chrome/browser/chromeos/arc/arc_android_management_checker_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