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

Side by Side Diff: chrome/browser/sync/fake_oauth2_token_service.cc

Issue 136723009: Move UbertokenFetcher from //chrome to //google_apis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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 "chrome/browser/sync/fake_oauth2_token_service.h"
6
7 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "content/public/browser/browser_context.h"
10
11 void FakeOAuth2TokenService::FetchOAuth2Token(
12 OAuth2TokenService::RequestImpl* request,
13 const std::string& account_id,
14 net::URLRequestContextGetter* getter,
15 const std::string& client_id,
16 const std::string& client_secret,
17 const OAuth2TokenService::ScopeSet& scopes) {
18 // Request will succeed without network IO.
19 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
20 &RequestImpl::InformConsumer,
21 request->AsWeakPtr(),
22 GoogleServiceAuthError(GoogleServiceAuthError::NONE),
23 "access_token",
24 base::Time::Max()));
25 }
26
27 void FakeOAuth2TokenService::UpdateCredentials(
28 const std::string& account_id,
29 const std::string& refresh_token) {
30 account_id_ = account_id;
31 refresh_token_ = refresh_token;
32 FireRefreshTokenAvailable(account_id);
33 }
34
35 bool FakeOAuth2TokenService::RefreshTokenIsAvailable(
36 const std::string& account_id) {
37 return account_id_ == account_id && !refresh_token_.empty();
38 }
39
40 BrowserContextKeyedService* FakeOAuth2TokenService::BuildTokenService(
41 content::BrowserContext* context) {
42 Profile* profile = static_cast<Profile*>(context);
43
44 FakeOAuth2TokenService* service = new FakeOAuth2TokenService();
45 service->Initialize(profile);
46 return service;
47 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/fake_oauth2_token_service.h ('k') | chrome/browser/sync/fake_oauth2_token_service_for_sync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698