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

Unified Diff: chromecast/shell/browser/geolocation/cast_access_token_store.cc

Issue 223143003: Initial checkin of chromecast content embedder (cast_shell) and related build scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Additional presubmit clean-up. 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: chromecast/shell/browser/geolocation/cast_access_token_store.cc
diff --git a/chromecast/shell/browser/geolocation/cast_access_token_store.cc b/chromecast/shell/browser/geolocation/cast_access_token_store.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cae51df64177d48f7a6986ce48e028e092bc48c8
--- /dev/null
+++ b/chromecast/shell/browser/geolocation/cast_access_token_store.cc
@@ -0,0 +1,51 @@
+// 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.
+
+#include "chromecast/shell/browser/geolocation/cast_access_token_store.h"
+
+#include "base/callback_helpers.h"
+#include "chromecast/shell/browser/cast_browser_context.h"
+#include "chromecast/shell/browser/cast_content_browser_client.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/common/content_client.h"
+
+namespace chromecast {
+namespace shell {
+
+CastAccessTokenStore::CastAccessTokenStore(
+ content::BrowserContext* browser_context)
+ : browser_context_(browser_context) {
+}
+
+CastAccessTokenStore::~CastAccessTokenStore() {
+}
+
+void CastAccessTokenStore::GetRequestContextGetterOnUIThread() {
+ request_context_ = browser_context_->GetRequestContext();
+}
+
+void CastAccessTokenStore::RespondOnOriginatingThread() {
+ base::ResetAndReturn(&callback_).Run(access_token_set_, request_context_);
+}
+
+void CastAccessTokenStore::LoadAccessTokens(
+ const LoadAccessTokensCallbackType& callback) {
+ callback_ = callback;
+ content::BrowserThread::PostTaskAndReply(
+ content::BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&CastAccessTokenStore::GetRequestContextGetterOnUIThread,
+ this),
+ base::Bind(&CastAccessTokenStore::RespondOnOriginatingThread, this));
+}
+
+void CastAccessTokenStore::SaveAccessToken(
+ const GURL& server_url, const base::string16& access_token) {
+ if (access_token_set_[server_url] != access_token) {
+ access_token_set_[server_url] = access_token;
+ }
+}
+
+} // namespace shell
+} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698