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

Unified Diff: chrome/browser/browser_process_impl.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: Moved DeviceOAuth2TokenService factory method to g_browser_process 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
Index: chrome/browser/browser_process_impl.cc
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 574a2f891ffafdf69984db1caac429d6bb9a236a..5ed7265a114d6e4f0fc4cff4fa2505e96a99549c 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -114,6 +114,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/memory/oom_priority_manager.h"
+#include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
#endif // defined(OS_CHROMEOS)
#if defined(ENABLE_PLUGIN_INSTALLATION)
@@ -274,6 +275,11 @@ void BrowserProcessImpl::StartTearDown() {
#if defined(OS_MACOSX)
app_shim_host_manager_.reset();
#endif
+
+#if defined(OS_CHROMEOS)
+ // Terminate any in-flight token requests before the IO thread shuts down.
+ device_oauth2_token_service_.reset();
+#endif
}
void BrowserProcessImpl::PostDestroyThreads() {
@@ -437,6 +443,8 @@ PrefService* BrowserProcessImpl::local_state() {
net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() {
DCHECK(CalledOnValidThread());
+ if (!io_thread())
+ return NULL;
Mattias Nissler (ping if slow) 2013/03/26 12:04:32 Are you sure about this change? Previously, we cra
David Roche 2013/03/27 05:09:51 Okay, I'll revert this. I made the change based o
return io_thread()->system_url_request_context_getter();
}
@@ -456,6 +464,17 @@ chromeos::OomPriorityManager* BrowserProcessImpl::oom_priority_manager() {
oom_priority_manager_.reset(new chromeos::OomPriorityManager());
return oom_priority_manager_.get();
}
+
+chromeos::DeviceOAuth2TokenService*
+ BrowserProcessImpl::device_oauth2_token_service() {
+ DCHECK(CalledOnValidThread());
+ if (!system_request_context())
+ return NULL;
Mattias Nissler (ping if slow) 2013/03/26 12:04:32 I think we should just CHECK() here so this code c
David Roche 2013/03/27 05:09:51 Okay, in that case I can just leave this check out
+ if (!device_oauth2_token_service_.get())
Mattias Nissler (ping if slow) 2013/03/26 12:04:32 Style guide requires curlies around multi-line con
David Roche 2013/03/27 05:09:51 Done.
+ device_oauth2_token_service_.reset(new chromeos::DeviceOAuth2TokenService(
+ g_browser_process->system_request_context()));
+ return device_oauth2_token_service_.get();
+}
#endif // defined(OS_CHROMEOS)
extensions::EventRouterForwarder*

Powered by Google App Engine
This is Rietveld 408576698