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

Unified Diff: chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.cc

Issue 148513010: Eliminate ProfileOAuth2TokenService being a BCKS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.cc
diff --git a/chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.cc b/chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ccf41f28768e7bf87e015772329d4e934b158996
--- /dev/null
+++ b/chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.cc
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
+
+// static
+BrowserContextKeyedService* FakeProfileOAuth2TokenServiceWrapper::Build(
+ content::BrowserContext* context) {
+ Profile* profile = static_cast<Profile*>(context);
+ return new FakeProfileOAuth2TokenServiceWrapper(profile, false);
+}
+
+// static
+BrowserContextKeyedService*
+FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService(
+ content::BrowserContext* context) {
+ Profile* profile = static_cast<Profile*>(context);
+ return new FakeProfileOAuth2TokenServiceWrapper(profile, true);
+}
+
+FakeProfileOAuth2TokenServiceWrapper::FakeProfileOAuth2TokenServiceWrapper(
+ Profile* profile,
+ bool auto_issue_tokens) {
+ if (auto_issue_tokens)
+ service_.set_auto_post_fetch_response_on_message_loop(true);
+ service_.Initialize(reinterpret_cast<Profile*>(profile));
+}
+
+FakeProfileOAuth2TokenServiceWrapper::~FakeProfileOAuth2TokenServiceWrapper() {
+ service_.Shutdown();
+}
+
+ProfileOAuth2TokenService*
+FakeProfileOAuth2TokenServiceWrapper::GetProfileOAuth2TokenService() {
+ return &service_;
+}

Powered by Google App Engine
This is Rietveld 408576698