| OLD | NEW |
| 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 |
| 9 namespace extensions { | 11 namespace extensions { |
| 10 | 12 |
| 11 ShellOAuth2TokenServiceDelegate::ShellOAuth2TokenServiceDelegate( | 13 ShellOAuth2TokenServiceDelegate::ShellOAuth2TokenServiceDelegate( |
| 12 content::BrowserContext* browser_context, | 14 content::BrowserContext* browser_context, |
| 13 std::string account_id, | 15 std::string account_id, |
| 14 std::string refresh_token) | 16 std::string refresh_token) |
| 15 : browser_context_(browser_context), | 17 : browser_context_(browser_context), |
| 16 account_id_(account_id), | 18 account_id_(account_id), |
| 17 refresh_token_(refresh_token) { | 19 refresh_token_(refresh_token) { |
| 18 } | 20 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 33 const std::string& account_id, | 35 const std::string& account_id, |
| 34 net::URLRequestContextGetter* getter, | 36 net::URLRequestContextGetter* getter, |
| 35 OAuth2AccessTokenConsumer* consumer) { | 37 OAuth2AccessTokenConsumer* consumer) { |
| 36 DCHECK_EQ(account_id, account_id_); | 38 DCHECK_EQ(account_id, account_id_); |
| 37 DCHECK(!refresh_token_.empty()); | 39 DCHECK(!refresh_token_.empty()); |
| 38 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_); | 40 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_); |
| 39 } | 41 } |
| 40 | 42 |
| 41 net::URLRequestContextGetter* | 43 net::URLRequestContextGetter* |
| 42 ShellOAuth2TokenServiceDelegate::GetRequestContext() const { | 44 ShellOAuth2TokenServiceDelegate::GetRequestContext() const { |
| 43 return browser_context_->GetRequestContext(); | 45 return content::BrowserContext::GetDefaultStoragePartition(browser_context_)-> |
| 46 GetURLRequestContext(); |
| 44 } | 47 } |
| 45 | 48 |
| 46 std::vector<std::string> ShellOAuth2TokenServiceDelegate::GetAccounts() { | 49 std::vector<std::string> ShellOAuth2TokenServiceDelegate::GetAccounts() { |
| 47 std::vector<std::string> accounts; | 50 std::vector<std::string> accounts; |
| 48 accounts.push_back(account_id_); | 51 accounts.push_back(account_id_); |
| 49 return accounts; | 52 return accounts; |
| 50 } | 53 } |
| 51 | 54 |
| 52 void ShellOAuth2TokenServiceDelegate::UpdateCredentials( | 55 void ShellOAuth2TokenServiceDelegate::UpdateCredentials( |
| 53 const std::string& account_id, | 56 const std::string& account_id, |
| 54 const std::string& refresh_token) { | 57 const std::string& refresh_token) { |
| 55 account_id_ = account_id; | 58 account_id_ = account_id; |
| 56 refresh_token_ = refresh_token; | 59 refresh_token_ = refresh_token; |
| 57 } | 60 } |
| 58 | 61 |
| 59 } // namespace extensions | 62 } // namespace extensions |
| OLD | NEW |