android: Enable media autoplay for webview test shell
[chromium-blink-merge.git] / chromecast / shell / browser / geolocation / cast_access_token_store.cc
blobcae51df64177d48f7a6986ce48e028e092bc48c8
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromecast/shell/browser/geolocation/cast_access_token_store.h"
7 #include "base/callback_helpers.h"
8 #include "chromecast/shell/browser/cast_browser_context.h"
9 #include "chromecast/shell/browser/cast_content_browser_client.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/common/content_client.h"
13 namespace chromecast {
14 namespace shell {
16 CastAccessTokenStore::CastAccessTokenStore(
17 content::BrowserContext* browser_context)
18 : browser_context_(browser_context) {
21 CastAccessTokenStore::~CastAccessTokenStore() {
24 void CastAccessTokenStore::GetRequestContextGetterOnUIThread() {
25 request_context_ = browser_context_->GetRequestContext();
28 void CastAccessTokenStore::RespondOnOriginatingThread() {
29 base::ResetAndReturn(&callback_).Run(access_token_set_, request_context_);
32 void CastAccessTokenStore::LoadAccessTokens(
33 const LoadAccessTokensCallbackType& callback) {
34 callback_ = callback;
35 content::BrowserThread::PostTaskAndReply(
36 content::BrowserThread::UI,
37 FROM_HERE,
38 base::Bind(&CastAccessTokenStore::GetRequestContextGetterOnUIThread,
39 this),
40 base::Bind(&CastAccessTokenStore::RespondOnOriginatingThread, this));
43 void CastAccessTokenStore::SaveAccessToken(
44 const GURL& server_url, const base::string16& access_token) {
45 if (access_token_set_[server_url] != access_token) {
46 access_token_set_[server_url] = access_token;
50 } // namespace shell
51 } // namespace chromecast