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

Unified Diff: chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc

Issue 12647008: Refactor OAuth2TokenService to have profile- and device-based implementations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Wired in new device-level encryption calls. Created 7 years, 9 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
« no previous file with comments | « chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h ('k') | chrome/browser/history/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f0b80d84187641bc5b17887da28b628326f854ea
--- /dev/null
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 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/chromeos/settings/device_oauth2_token_service_factory.h"
+
+#include "base/lazy_instance.h"
+#include "chrome/browser/browser_process.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace chromeos {
+
+static base::LazyInstance<DeviceOAuth2TokenServiceFactory>
+ g_device_oauth2_token_service_factory_ = LAZY_INSTANCE_INITIALIZER;
+
+DeviceOAuth2TokenServiceFactory::DeviceOAuth2TokenServiceFactory() {
+}
+
+DeviceOAuth2TokenServiceFactory::~DeviceOAuth2TokenServiceFactory() {
+ // The OAuth2TokenService destructor will cancel all pending fetchers.
+}
+
+// static
+DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ DeviceOAuth2TokenServiceFactory factory =
+ g_device_oauth2_token_service_factory_.Get();
+
+ return factory.GetImpl();
+}
+
+DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::GetImpl() {
+ if (!device_oauth2_token_service_) {
+ device_oauth2_token_service_.reset(
+ new DeviceOAuth2TokenService(
+ g_browser_process->system_request_context()));
Mattias Nissler (ping if slow) 2013/03/21 06:59:15 Ha, so the factory design is broken here after all
David Roche 2013/03/21 20:36:31 The factory singleton doesn't have an external dep
+ }
+ return device_oauth2_token_service_.get();
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h ('k') | chrome/browser/history/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698