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

Side by Side Diff: content/shell/browser/shell_access_token_store.cc

Issue 1878153002: Revert of Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/browser/shell_access_token_store.h" 5 #include "content/shell/browser/shell_access_token_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/browser/storage_partition.h"
12 #include "content/shell/browser/shell_browser_context.h" 11 #include "content/shell/browser/shell_browser_context.h"
13 12
14 namespace content { 13 namespace content {
15 14
16 ShellAccessTokenStore::ShellAccessTokenStore( 15 ShellAccessTokenStore::ShellAccessTokenStore(
17 content::ShellBrowserContext* shell_browser_context) 16 content::ShellBrowserContext* shell_browser_context)
18 : shell_browser_context_(shell_browser_context), 17 : shell_browser_context_(shell_browser_context),
19 system_request_context_(NULL) { 18 system_request_context_(NULL) {
20 } 19 }
21 20
22 ShellAccessTokenStore::~ShellAccessTokenStore() { 21 ShellAccessTokenStore::~ShellAccessTokenStore() {
23 } 22 }
24 23
25 void ShellAccessTokenStore::LoadAccessTokens( 24 void ShellAccessTokenStore::LoadAccessTokens(
26 const LoadAccessTokensCallback& callback) { 25 const LoadAccessTokensCallback& callback) {
27 BrowserThread::PostTaskAndReply( 26 BrowserThread::PostTaskAndReply(
28 BrowserThread::UI, 27 BrowserThread::UI,
29 FROM_HERE, 28 FROM_HERE,
30 base::Bind(&ShellAccessTokenStore::GetRequestContextOnUIThread, 29 base::Bind(&ShellAccessTokenStore::GetRequestContextOnUIThread,
31 this, 30 this,
32 shell_browser_context_), 31 shell_browser_context_),
33 base::Bind(&ShellAccessTokenStore::RespondOnOriginatingThread, 32 base::Bind(&ShellAccessTokenStore::RespondOnOriginatingThread,
34 this, 33 this,
35 callback)); 34 callback));
36 } 35 }
37 36
38 void ShellAccessTokenStore::GetRequestContextOnUIThread( 37 void ShellAccessTokenStore::GetRequestContextOnUIThread(
39 content::ShellBrowserContext* shell_browser_context) { 38 content::ShellBrowserContext* shell_browser_context) {
40 system_request_context_ = 39 system_request_context_ = shell_browser_context->GetRequestContext();
41 BrowserContext::GetDefaultStoragePartition(shell_browser_context)->
42 GetURLRequestContext();
43 } 40 }
44 41
45 void ShellAccessTokenStore::RespondOnOriginatingThread( 42 void ShellAccessTokenStore::RespondOnOriginatingThread(
46 const LoadAccessTokensCallback& callback) { 43 const LoadAccessTokensCallback& callback) {
47 // Since content_shell is a test executable, rather than an end user program, 44 // Since content_shell is a test executable, rather than an end user program,
48 // we provide a dummy access_token set to avoid hitting the server. 45 // we provide a dummy access_token set to avoid hitting the server.
49 AccessTokenMap access_token_map; 46 AccessTokenMap access_token_map;
50 access_token_map[GURL()] = base::ASCIIToUTF16("chromium_content_shell"); 47 access_token_map[GURL()] = base::ASCIIToUTF16("chromium_content_shell");
51 callback.Run(access_token_map, system_request_context_.get()); 48 callback.Run(access_token_map, system_request_context_.get());
52 system_request_context_ = NULL; 49 system_request_context_ = NULL;
53 } 50 }
54 51
55 void ShellAccessTokenStore::SaveAccessToken( 52 void ShellAccessTokenStore::SaveAccessToken(
56 const GURL& server_url, const base::string16& access_token) { 53 const GURL& server_url, const base::string16& access_token) {
57 } 54 }
58 55
59 } // namespace content 56 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/test_browser_context.cc ('k') | content/shell/browser/shell_browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698