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

Unified Diff: chrome/browser/chromeos/drive/drive_readonly_token_fetcher.h

Issue 371883003: Files.app: Add an private API to get a download URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/drive/drive_readonly_token_fetcher.h
diff --git a/chrome/browser/chromeos/drive/drive_readonly_token_fetcher.h b/chrome/browser/chromeos/drive/drive_readonly_token_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..f58905792b2ba1bb9d35b1135a95b42ea3f88b6f
--- /dev/null
+++ b/chrome/browser/chromeos/drive/drive_readonly_token_fetcher.h
@@ -0,0 +1,45 @@
+// Copyright 2014 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_DRIVE_DRIVE_READONLY_TOKEN_FETCHER_H_
+#define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_READONLY_TOKEN_FETCHER_H_
+
+#include <queue>
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/threading/thread_checker.h"
+#include "base/time/time.h"
+#include "google_apis/drive/auth_service_interface.h"
+#include "google_apis/gaia/oauth2_token_service.h"
+
+namespace drive {
+
+// OAuthTokenFetcher caches OAuth access tokens and refreshes them as needed.
+class DriveReadonlyTokenFetcher : public OAuth2TokenService::Consumer {
kinaba 2014/07/09 06:02:47 This class looks almost functionally identical to
+ public:
+ DriveReadonlyTokenFetcher(
+ const std::string& account_id,
+ OAuth2TokenService* oauth2_token_service,
+ const google_apis::AuthStatusCallback& callback);
+ virtual ~DriveReadonlyTokenFetcher();
+
+ private:
+ // Overridden from OAuth2TokenService::Consumer:
+ virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
+ const std::string& access_token,
+ const base::Time& expiration_time) OVERRIDE;
+ virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
+ const GoogleServiceAuthError& error) OVERRIDE;
+
+ google_apis::AuthStatusCallback callback_;
+ scoped_ptr<OAuth2TokenService::Request> request_;
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(DriveReadonlyTokenFetcher);
+};
+
+} // namespace drive
+
+#endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_READONLY_TOKEN_FETCHER_H_

Powered by Google App Engine
This is Rietveld 408576698