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

Side by Side 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: Remove ScreenCast code and stale comments. 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "chromecast/shell/browser/geolocation/cast_access_token_store.h"
6
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"
12
13 namespace chromecast {
14 namespace shell {
15
16 CastAccessTokenStore::CastAccessTokenStore(
17 content::BrowserContext* browser_context)
18 : browser_context_(browser_context) {
19 }
20
21 CastAccessTokenStore::~CastAccessTokenStore() {
22 }
23
24 void CastAccessTokenStore::GetRequestContextGetterOnUIThread() {
25 request_context_ = browser_context_->GetRequestContext();
26 }
27
28 void CastAccessTokenStore::RespondOnOriginatingThread() {
29 // TODO(byungchul): Get access tokens from pref service once it is available.
30 base::ResetAndReturn(&callback_).Run(access_token_set_, request_context_);
31 }
32
33 void CastAccessTokenStore::LoadAccessTokens(
34 const LoadAccessTokensCallbackType& callback) {
35 callback_ = callback;
36 content::BrowserThread::PostTaskAndReply(
37 content::BrowserThread::UI,
38 FROM_HERE,
39 base::Bind(&CastAccessTokenStore::GetRequestContextGetterOnUIThread,
40 this),
41 base::Bind(&CastAccessTokenStore::RespondOnOriginatingThread, this));
42 }
43
44 void CastAccessTokenStore::SaveAccessToken(
45 const GURL& server_url, const base::string16& access_token) {
46 if (access_token_set_[server_url] != access_token) {
47 access_token_set_[server_url] = access_token;
48 // TODO(byungchul): Save access token to pref service once it is available
49 // for chromecast.
50 }
51 }
52
53 } // namespace shell
54 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698