OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "content/shell/geolocation/shell_access_token_store.h" | |
6 | |
7 #include "base/bind.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" | |
12 | |
13 namespace content { | |
14 | |
15 ShellAccessTokenStore::ShellAccessTokenStore( | |
16 content::ShellBrowserContext* shell_browser_context) | |
17 : shell_browser_context_(shell_browser_context), | |
18 system_request_context_(NULL) { | |
19 } | |
20 | |
21 ShellAccessTokenStore::~ShellAccessTokenStore() { | |
22 } | |
23 | |
24 void ShellAccessTokenStore::LoadAccessTokens( | |
25 const LoadAccessTokensCallbackType& callback) { | |
26 BrowserThread::PostTaskAndReply( | |
27 BrowserThread::UI, | |
28 FROM_HERE, | |
29 base::Bind(&ShellAccessTokenStore::GetRequestContextOnUIThread, | |
30 this, | |
31 shell_browser_context_), | |
32 base::Bind(&ShellAccessTokenStore::RespondOnOriginatingThread, | |
33 this, | |
34 callback)); | |
35 } | |
36 | |
37 void ShellAccessTokenStore::GetRequestContextOnUIThread( | |
38 content::ShellBrowserContext* shell_browser_context) { | |
39 system_request_context_ = shell_browser_context->GetRequestContext(); | |
40 } | |
41 | |
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; | |
50 } | |
51 | |
52 void ShellAccessTokenStore::SaveAccessToken( | |
53 const GURL& server_url, const base::string16& access_token) { | |
54 } | |
55 | |
56 } // namespace content | |
OLD | NEW |