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

Side by Side Diff: extensions/shell/browser/shell_oauth2_token_service_delegate.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address roger's comments Created 5 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "extensions/shell/browser/shell_oauth2_token_service_delegate.h"
6
7 #include <vector>
8
9 namespace extensions {
10
11 ShellOAuth2TokenServiceDelegate::ShellOAuth2TokenServiceDelegate(
12 content::BrowserContext* browser_context,
13 std::string account_id,
14 std::string refresh_token)
15 : browser_context_(browser_context),
16 account_id_(account_id),
17 refresh_token_(refresh_token) {
18 }
19
20 ShellOAuth2TokenServiceDelegate::~ShellOAuth2TokenServiceDelegate() {
21 }
22
23 bool ShellOAuth2TokenServiceDelegate::RefreshTokenIsAvailable(
24 const std::string& account_id) const {
25 if (account_id != account_id_)
26 return false;
27
28 return !refresh_token_.empty();
29 }
30
31 OAuth2AccessTokenFetcher*
32 ShellOAuth2TokenServiceDelegate::CreateAccessTokenFetcher(
33 const std::string& account_id,
34 net::URLRequestContextGetter* getter,
35 OAuth2AccessTokenConsumer* consumer) {
36 DCHECK(!refresh_token_.empty());
Roger Tawa OOO till Jul 10th 2015/06/04 18:19:55 Should this DCHECK_EQ(account_id, account_id_); ?
gogerald1 2015/06/25 14:06:19 Acknowledged. We may need to do both.
Roger Tawa OOO till Jul 10th 2015/06/26 14:58:51 did you forget to add new DCHECK?
37 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_);
38 }
39
40 net::URLRequestContextGetter*
41 ShellOAuth2TokenServiceDelegate::GetRequestContext() const {
42 return browser_context_->GetRequestContext();
43 }
44
45 void ShellOAuth2TokenServiceDelegate::UpdateAuthError(
46 const std::string& account_id,
47 const GoogleServiceAuthError& error) {
48 }
49
50 std::vector<std::string> ShellOAuth2TokenServiceDelegate::GetAccounts() {
51 std::vector<std::string> accounts;
52 accounts.push_back(account_id_);
53 return accounts;
54 }
55
56 void ShellOAuth2TokenServiceDelegate::RevokeAllCredentials() {
57 }
58
59 void ShellOAuth2TokenServiceDelegate::UpdateCredentials(
60 const std::string& account_id,
61 const std::string& refresh_token) {
62 account_id_ = account_id;
63 refresh_token_ = refresh_token;
64 }
65
66 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698