1 // Copyright (c) 2012 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 "content/shell/browser/shell_access_token_store.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/browser_thread.h"
11 #include "content/shell/browser/shell_browser_context.h"
15 ShellAccessTokenStore::ShellAccessTokenStore(
16 content::ShellBrowserContext
* shell_browser_context
)
17 : shell_browser_context_(shell_browser_context
),
18 system_request_context_(NULL
) {
21 ShellAccessTokenStore::~ShellAccessTokenStore() {
24 void ShellAccessTokenStore::LoadAccessTokens(
25 const LoadAccessTokensCallbackType
& callback
) {
26 BrowserThread::PostTaskAndReply(
29 base::Bind(&ShellAccessTokenStore::GetRequestContextOnUIThread
,
31 shell_browser_context_
),
32 base::Bind(&ShellAccessTokenStore::RespondOnOriginatingThread
,
37 void ShellAccessTokenStore::GetRequestContextOnUIThread(
38 content::ShellBrowserContext
* shell_browser_context
) {
39 system_request_context_
= shell_browser_context
->GetRequestContext();
42 void ShellAccessTokenStore::RespondOnOriginatingThread(
43 const LoadAccessTokensCallbackType
& callback
) {
44 // Since content_shell is a test executable, rather than an end user program,
45 // we provide a dummy access_token set to avoid hitting the server.
46 AccessTokenSet access_token_set
;
47 access_token_set
[GURL()] = base::ASCIIToUTF16("chromium_content_shell");
48 callback
.Run(access_token_set
, system_request_context_
.get());
49 system_request_context_
= NULL
;
52 void ShellAccessTokenStore::SaveAccessToken(
53 const GURL
& server_url
, const base::string16
& access_token
) {
56 } // namespace content