summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpneubeck <pneubeck@chromium.org>2015-09-03 03:10:06 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-03 10:10:50 +0000
commitceab06ffd994490f396c9684ca24b8edf05af679 (patch)
tree5f679e589c18cf2094ed2d8bc9a5b5564c03f61a
parentfff57332e2ab4316ce65757b603d170c7f5145ec (diff)
downloadchromium_src-ceab06ffd994490f396c9684ca24b8edf05af679.zip
chromium_src-ceab06ffd994490f396c9684ca24b8edf05af679.tar.gz
chromium_src-ceab06ffd994490f396c9684ca24b8edf05af679.tar.bz2
Revert of Componentizing chrome/browser/services/gcm/gcm_desktop_utils.cc. (patchset #4 id:60001 of https://codereview.chromium.org/1325063002/ )
Reason for revert: Broke https://build.chromium.org/p/chromium.linux/builders/Linux%20GN%20Clobber/builds/5215 Original issue's description: > Componentizing chrome/browser/services/gcm/gcm_desktop_utils.cc. > > Moved chrome/browser/services/gcm/gcm_desktop_utils.* to > components/gcm_driver/. > Added a extra param version_info to CreateGCMDriverDesktop() > for resolving the bad dependancy from chrome. > > BUG=519579 > > Committed: https://crrev.com/ae5abc9a10333564b9e30c5fc1013f97e19ff4e0 > Cr-Commit-Position: refs/heads/master@{#347128} TBR=droger@chromium.org,zea@chromium.org,thestig@chromium.org,jitendra.ks@samsung.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=519579 Review URL: https://codereview.chromium.org/1328573003 Cr-Commit-Position: refs/heads/master@{#347130}
-rw-r--r--chrome/browser/browser_process_impl.cc17
-rw-r--r--chrome/browser/services/gcm/gcm_desktop_utils.cc (renamed from components/gcm_driver/gcm_desktop_utils.cc)45
-rw-r--r--chrome/browser/services/gcm/gcm_desktop_utils.h (renamed from components/gcm_driver/gcm_desktop_utils.h)14
-rw-r--r--chrome/browser/services/gcm/gcm_profile_service.cc19
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--components/gcm_driver.gypi6
-rw-r--r--components/gcm_driver/BUILD.gn6
-rw-r--r--components/gcm_driver/DEPS2
8 files changed, 37 insertions, 74 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 140efd8..93fda30 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -109,8 +109,8 @@
#if !defined(OS_ANDROID)
#include "chrome/browser/chrome_device_client.h"
+#include "chrome/browser/services/gcm/gcm_desktop_utils.h"
#include "components/gcm_driver/gcm_client_factory.h"
-#include "components/gcm_driver/gcm_desktop_utils.h"
#endif
#if defined(ENABLE_BACKGROUND)
@@ -1165,24 +1165,11 @@ void BrowserProcessImpl::CreateGCMDriver() {
#else
base::FilePath store_path;
CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path));
- 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));
-
gcm_driver_ = gcm::CreateGCMDriverDesktop(
make_scoped_ptr(new gcm::GCMClientFactory),
local_state(),
store_path,
- system_request_context(),
- chrome::GetChannel(),
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::UI),
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::IO),
- blocking_task_runner);
+ system_request_context());
#endif // defined(OS_ANDROID)
}
diff --git a/components/gcm_driver/gcm_desktop_utils.cc b/chrome/browser/services/gcm/gcm_desktop_utils.cc
index f5049f5..206d875 100644
--- a/components/gcm_driver/gcm_desktop_utils.cc
+++ b/chrome/browser/services/gcm/gcm_desktop_utils.cc
@@ -2,15 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/gcm_driver/gcm_desktop_utils.h"
+#include "chrome/browser/services/gcm/gcm_desktop_utils.h"
#include "base/command_line.h"
#include "base/sequenced_task_runner.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "chrome/common/channel_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 "components/sync_driver/sync_util.h"
+#include "components/version_info/version_info.h"
+#include "content/public/browser/browser_thread.h"
#include "url/gurl.h"
namespace gcm {
@@ -38,7 +41,8 @@ GCMClient::ChromePlatform GetPlatform() {
#endif
}
-GCMClient::ChromeChannel GetChannel(version_info::Channel channel) {
+GCMClient::ChromeChannel GetChannel() {
+ version_info::Channel channel = chrome::GetChannel();
switch (channel) {
case version_info::Channel::UNKNOWN:
return GCMClient::CHANNEL_UNKNOWN;
@@ -60,22 +64,22 @@ std::string GetVersion() {
return version_info::GetVersionNumber();
}
-GCMClient::ChromeBuildInfo GetChromeBuildInfo(version_info::Channel channel) {
+GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
GCMClient::ChromeBuildInfo chrome_build_info;
chrome_build_info.platform = GetPlatform();
- chrome_build_info.channel = GetChannel(channel);
+ chrome_build_info.channel = GetChannel();
chrome_build_info.version = GetVersion();
return chrome_build_info;
}
-std::string GetChannelStatusRequestUrl(version_info::Channel channel) {
+std::string GetChannelStatusRequestUrl() {
GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(),
- channel));
+ chrome::GetChannel()));
return sync_url.spec() + kChannelStatusRelativePath;
}
-std::string GetUserAgent(version_info::Channel channel) {
- return MakeDesktopUserAgentForSync(channel);
+std::string GetUserAgent() {
+ return MakeDesktopUserAgentForSync(chrome::GetChannel());
}
} // namespace
@@ -84,22 +88,27 @@ scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
scoped_ptr<GCMClientFactory> gcm_client_factory,
PrefService* prefs,
const base::FilePath& store_path,
- const scoped_refptr<net::URLRequestContextGetter>& request_context,
- version_info::Channel channel,
- const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
- const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
- const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) {
+ 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(),
- GetChromeBuildInfo(channel),
- GetChannelStatusRequestUrl(channel),
- GetUserAgent(channel),
+ GetChromeBuildInfo(),
+ GetChannelStatusRequestUrl(),
+ GetUserAgent(),
prefs,
store_path,
request_context,
- ui_task_runner,
- io_task_runner,
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::UI),
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::IO),
blocking_task_runner));
}
diff --git a/components/gcm_driver/gcm_desktop_utils.h b/chrome/browser/services/gcm/gcm_desktop_utils.h
index b7e62e4..8105829 100644
--- a/components/gcm_driver/gcm_desktop_utils.h
+++ b/chrome/browser/services/gcm/gcm_desktop_utils.h
@@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_GCM_DRIVER_GCM_GCM_DESKTOP_UTILS_H_
-#define COMPONENTS_GCM_DRIVER_GCM_GCM_DESKTOP_UTILS_H_
+#ifndef CHROME_BROWSER_SERVICES_GCM_GCM_DESKTOP_UTILS_H_
+#define CHROME_BROWSER_SERVICES_GCM_GCM_DESKTOP_UTILS_H_
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/sequenced_task_runner.h"
-#include "components/version_info/version_info.h"
class PrefService;
namespace base {
@@ -28,12 +26,8 @@ scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
scoped_ptr<GCMClientFactory> gcm_client_factory,
PrefService* prefs,
const base::FilePath& store_path,
- const scoped_refptr<net::URLRequestContextGetter>& request_context,
- version_info::Channel channel,
- const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
- const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
- const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner);
+ const scoped_refptr<net::URLRequestContextGetter>& request_context);
} // namespace gcm
-#endif // COMPONENTS_GCM_DRIVER_GCM_GCM_DESKTOP_UTILS_H_
+#endif // CHROME_BROWSER_SERVICES_GCM_GCM_DESKTOP_UTILS_H_
diff --git a/chrome/browser/services/gcm/gcm_profile_service.cc b/chrome/browser/services/gcm/gcm_profile_service.cc
index 50d2de2..69399d9 100644
--- a/chrome/browser/services/gcm/gcm_profile_service.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service.cc
@@ -22,18 +22,16 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
+#include "chrome/browser/services/gcm/gcm_desktop_utils.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
-#include "chrome/common/channel_info.h"
#include "components/gcm_driver/gcm_account_tracker.h"
#include "components/gcm_driver/gcm_channel_status_syncer.h"
#include "components/gcm_driver/gcm_client_factory.h"
-#include "components/gcm_driver/gcm_desktop_utils.h"
#include "components/gcm_driver/gcm_driver_desktop.h"
#include "components/signin/core/browser/profile_identity_provider.h"
#include "components/signin/core/browser/signin_manager.h"
-#include "content/public/browser/browser_thread.h"
#include "google_apis/gaia/account_tracker.h"
#include "google_apis/gaia/identity_provider.h"
#include "net/url_request/url_request_context_getter.h"
@@ -176,24 +174,11 @@ GCMProfileService::GCMProfileService(
: profile_(profile) {
DCHECK(!profile->IsOffTheRecord());
- 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));
-
driver_ = CreateGCMDriverDesktop(
gcm_client_factory.Pass(),
profile_->GetPrefs(),
profile_->GetPath().Append(chrome::kGCMStoreDirname),
- profile_->GetRequestContext(),
- chrome::GetChannel(),
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::UI),
- content::BrowserThread::GetMessageLoopProxyForThread(
- content::BrowserThread::IO),
- blocking_task_runner);
+ profile_->GetRequestContext());
identity_observer_.reset(new IdentityObserver(profile, driver_.get()));
}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index da75014..6294d15 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1251,6 +1251,8 @@
'browser/search/local_ntp_source.h',
'browser/search/search_terms_tracker.cc',
'browser/search/search_terms_tracker.h',
+ 'browser/services/gcm/gcm_desktop_utils.cc',
+ 'browser/services/gcm/gcm_desktop_utils.h',
'browser/signin/signin_promo.cc',
'browser/signin/signin_promo.h',
'browser/signin/signin_ui_util.cc',
diff --git a/components/gcm_driver.gypi b/components/gcm_driver.gypi
index 7958c28..5bd7aeb 100644
--- a/components/gcm_driver.gypi
+++ b/components/gcm_driver.gypi
@@ -29,12 +29,10 @@
'gcm_driver_common',
'gcm_driver_crypto',
'os_crypt',
- 'sync_driver',
'../base/base.gyp:base',
'../google_apis/gcm/gcm.gyp:gcm',
'../net/net.gyp:net',
'../sync/sync.gyp:sync_proto',
- '../url/url.gyp:url_lib',
],
'include_dirs': [
'..',
@@ -69,8 +67,6 @@
'gcm_driver/gcm_connection_observer.h',
'gcm_driver/gcm_delayed_task_controller.cc',
'gcm_driver/gcm_delayed_task_controller.h',
- 'gcm_driver/gcm_desktop_utils.cc',
- 'gcm_driver/gcm_desktop_utils.h',
'gcm_driver/gcm_driver.cc',
'gcm_driver/gcm_driver.h',
'gcm_driver/gcm_driver_android.cc',
@@ -103,8 +99,6 @@
'gcm_driver/gcm_client_factory.h',
'gcm_driver/gcm_client_impl.cc',
'gcm_driver/gcm_client_impl.h',
- 'gcm_driver/gcm_desktop_utils.cc',
- 'gcm_driver/gcm_desktop_utils.h',
'gcm_driver/gcm_driver_desktop.cc',
'gcm_driver/gcm_driver_desktop.h',
'gcm_driver/gcm_stats_recorder_impl.cc',
diff --git a/components/gcm_driver/BUILD.gn b/components/gcm_driver/BUILD.gn
index e1d288f..301ced53 100644
--- a/components/gcm_driver/BUILD.gn
+++ b/components/gcm_driver/BUILD.gn
@@ -33,8 +33,6 @@ static_library("gcm_driver") {
"gcm_connection_observer.h",
"gcm_delayed_task_controller.cc",
"gcm_delayed_task_controller.h",
- "gcm_desktop_utils.cc",
- "gcm_desktop_utils.h",
"gcm_driver.cc",
"gcm_driver.h",
"gcm_driver_android.cc",
@@ -54,11 +52,9 @@ static_library("gcm_driver") {
"//base",
"//components/gcm_driver/common",
"//components/os_crypt",
- "//components/sync_driver",
"//google_apis/gcm",
"//net",
"//sync/protocol",
- "//url:url",
]
if (is_chromeos) {
@@ -77,8 +73,6 @@ static_library("gcm_driver") {
"gcm_client_factory.h",
"gcm_client_impl.cc",
"gcm_client_impl.h",
- "gcm_desktop_utils.cc",
- "gcm_desktop_utils.h",
"gcm_driver_desktop.cc",
"gcm_driver_desktop.h",
"gcm_stats_recorder_impl.cc",
diff --git a/components/gcm_driver/DEPS b/components/gcm_driver/DEPS
index de2e4cc..cad5edd 100644
--- a/components/gcm_driver/DEPS
+++ b/components/gcm_driver/DEPS
@@ -1,9 +1,7 @@
include_rules = [
"+components/os_crypt",
"+components/pref_registry",
- "+components/sync_driver",
"+components/timers", # Only used for Chrome OS builds.
- "+components/version_info",
# TODO(johnme): Fix this layering violation.
"!content/public/android/java",
"+google_apis/gaia",