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

Side by Side Diff: extensions/shell/browser/shell_oauth2_token_service_delegate.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/shell/browser/shell_oauth2_token_service_delegate.h" 5 #include "extensions/shell/browser/shell_oauth2_token_service_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "content/public/browser/storage_partition.h"
10
11 namespace extensions { 9 namespace extensions {
12 10
13 ShellOAuth2TokenServiceDelegate::ShellOAuth2TokenServiceDelegate( 11 ShellOAuth2TokenServiceDelegate::ShellOAuth2TokenServiceDelegate(
14 content::BrowserContext* browser_context, 12 content::BrowserContext* browser_context,
15 std::string account_id, 13 std::string account_id,
16 std::string refresh_token) 14 std::string refresh_token)
17 : browser_context_(browser_context), 15 : browser_context_(browser_context),
18 account_id_(account_id), 16 account_id_(account_id),
19 refresh_token_(refresh_token) { 17 refresh_token_(refresh_token) {
20 } 18 }
(...skipping 14 matching lines...) Expand all
35 const std::string& account_id, 33 const std::string& account_id,
36 net::URLRequestContextGetter* getter, 34 net::URLRequestContextGetter* getter,
37 OAuth2AccessTokenConsumer* consumer) { 35 OAuth2AccessTokenConsumer* consumer) {
38 DCHECK_EQ(account_id, account_id_); 36 DCHECK_EQ(account_id, account_id_);
39 DCHECK(!refresh_token_.empty()); 37 DCHECK(!refresh_token_.empty());
40 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_); 38 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_);
41 } 39 }
42 40
43 net::URLRequestContextGetter* 41 net::URLRequestContextGetter*
44 ShellOAuth2TokenServiceDelegate::GetRequestContext() const { 42 ShellOAuth2TokenServiceDelegate::GetRequestContext() const {
45 return content::BrowserContext::GetDefaultStoragePartition(browser_context_)-> 43 return browser_context_->GetRequestContext();
46 GetURLRequestContext();
47 } 44 }
48 45
49 std::vector<std::string> ShellOAuth2TokenServiceDelegate::GetAccounts() { 46 std::vector<std::string> ShellOAuth2TokenServiceDelegate::GetAccounts() {
50 std::vector<std::string> accounts; 47 std::vector<std::string> accounts;
51 accounts.push_back(account_id_); 48 accounts.push_back(account_id_);
52 return accounts; 49 return accounts;
53 } 50 }
54 51
55 void ShellOAuth2TokenServiceDelegate::UpdateCredentials( 52 void ShellOAuth2TokenServiceDelegate::UpdateCredentials(
56 const std::string& account_id, 53 const std::string& account_id,
57 const std::string& refresh_token) { 54 const std::string& refresh_token) {
58 account_id_ = account_id; 55 account_id_ = account_id;
59 refresh_token_ = refresh_token; 56 refresh_token_ = refresh_token;
60 } 57 }
61 58
62 } // namespace extensions 59 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/api/identity/identity_api.cc ('k') | headless/lib/browser/headless_browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698