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

Unified Diff: chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h

Issue 2547073002: Fix race issue in ArcAuthService. (Closed)
Patch Set: Address comments Created 4 years 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/auth/arc_manual_auth_code_fetcher.h
diff --git a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..471d3656a00c28dc830916e5095fc482bdc48fdd
--- /dev/null
+++ b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h
@@ -0,0 +1,57 @@
+// 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_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
+#define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/arc/arc_support_host.h"
+#include "chrome/browser/chromeos/arc/auth/arc_auth_code_fetcher.h"
+
+namespace net {
+class URLRequestContextGetter;
+}
+
+namespace arc {
+
+class ArcAuthContext;
+
+// Implements the auth token fetching procedure with user's "SIGN IN" button
+// click.
+class ArcManualAuthCodeFetcher : public ArcAuthCodeFetcher,
+ public ArcSupportHost::Observer {
+ public:
+ ArcManualAuthCodeFetcher(ArcAuthContext* context,
+ ArcSupportHost* support_host);
+ ~ArcManualAuthCodeFetcher() override;
+
+ // ArcAuthCodeFetcher:
+ void Fetch(const FetchCallback& callback) override;
+
+ private:
+ void FetchInternal();
+
+ // Called when HTTP request gets ready.
+ void OnContextPrepared(net::URLRequestContextGetter* request_context_getter);
+
+ // ArcSupportHost::Observer:
+ void OnAuthSucceeded(const std::string& auth_code) override;
+ void OnRetryClicked() override;
+
+ ArcAuthContext* const context_;
+ ArcSupportHost* const support_host_;
+
+ FetchCallback pending_callback_;
+
+ base::WeakPtrFactory<ArcManualAuthCodeFetcher> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcManualAuthCodeFetcher);
+};
+
+} // namespace arc
+
+#endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_

Powered by Google App Engine
This is Rietveld 408576698