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

Unified Diff: chrome/browser/services/gcm/gcm_desktop_utils.cc

Issue 301973009: Add browser-global GCMDriver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build on Android. Created 6 years, 6 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/services/gcm/gcm_desktop_utils.h ('k') | chrome/browser/services/gcm/gcm_profile_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/services/gcm/gcm_desktop_utils.cc
diff --git a/chrome/browser/services/gcm/gcm_utils.cc b/chrome/browser/services/gcm/gcm_desktop_utils.cc
similarity index 56%
rename from chrome/browser/services/gcm/gcm_utils.cc
rename to chrome/browser/services/gcm/gcm_desktop_utils.cc
index 803e210e277f2c4517445ec05ee0d90bf0b89e89..98c66cf845f2636c64342f7aedde5eea4daef647 100644
--- a/chrome/browser/services/gcm/gcm_utils.cc
+++ b/chrome/browser/services/gcm/gcm_desktop_utils.cc
@@ -2,10 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/services/gcm/gcm_utils.h"
+#include "chrome/browser/services/gcm/gcm_desktop_utils.h"
#include "base/logging.h"
+#include "base/sequenced_task_runner.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "chrome/common/chrome_version_info.h"
+#include "components/gcm_driver/gcm_client_factory.h"
+#include "components/gcm_driver/gcm_driver.h"
+#include "components/gcm_driver/gcm_driver_desktop.h"
+#include "content/public/browser/browser_thread.h"
+#include "google_apis/gcm/gcm_client.h"
namespace gcm {
@@ -54,8 +61,6 @@ std::string GetVersion() {
return version_info.Version();
}
-} // namespace
-
GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
GCMClient::ChromeBuildInfo chrome_build_info;
chrome_build_info.platform = GetPlatform();
@@ -64,4 +69,30 @@ GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
return chrome_build_info;
}
+} // namespace
+
+scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
+ scoped_ptr<GCMClientFactory> gcm_client_factory,
+ scoped_ptr<IdentityProvider> identity_provider,
+ const base::FilePath& store_path,
+ const scoped_refptr<net::URLRequestContextGetter>& request_context) {
+ scoped_refptr<base::SequencedWorkerPool> worker_pool(
+ content::BrowserThread::GetBlockingPool());
+ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
+ worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
+ worker_pool->GetSequenceToken(),
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
+ return scoped_ptr<GCMDriver>(new GCMDriverDesktop(
+ gcm_client_factory.Pass(),
+ identity_provider.Pass(),
+ GetChromeBuildInfo(),
+ store_path,
+ request_context,
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::UI),
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::IO),
+ blocking_task_runner));
+}
+
} // namespace gcm
« no previous file with comments | « chrome/browser/services/gcm/gcm_desktop_utils.h ('k') | chrome/browser/services/gcm/gcm_profile_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698