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

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: rebase again Created 7 years, 8 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/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..65ff56cdbcb4c052eb85593fcfa652feef54a965
--- /dev/null
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service_factory.cc
@@ -0,0 +1,42 @@
+// 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 "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace chromeos {
+
+static DeviceOAuth2TokenService* g_device_oauth2_token_service_ = NULL;
+
+DeviceOAuth2TokenServiceFactory::DeviceOAuth2TokenServiceFactory() {
+}
+
+// static
+DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ return g_device_oauth2_token_service_;
+}
+
+// static
+void DeviceOAuth2TokenServiceFactory::Initialize() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ DCHECK(!g_device_oauth2_token_service_);
+ g_device_oauth2_token_service_ = new DeviceOAuth2TokenService(
+ g_browser_process->system_request_context(),
+ g_browser_process->local_state());
+}
+
+// static
+void DeviceOAuth2TokenServiceFactory::Shutdown() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ if (g_device_oauth2_token_service_) {
+ delete g_device_oauth2_token_service_;
+ g_device_oauth2_token_service_ = NULL;
+ }
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698