summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-09 17:13:06 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-09 17:13:06 +0000
commitcd57f378f4658d100bee327fc2152815a0a0e178 (patch)
treeb3d6811257f05368c787a252dedeac6e866cab91
parent7d3c069e49e2cd35eea5cc6f94ba889ecb29d878 (diff)
downloadchromium_src-cd57f378f4658d100bee327fc2152815a0a0e178.zip
chromium_src-cd57f378f4658d100bee327fc2152815a0a0e178.tar.gz
chromium_src-cd57f378f4658d100bee327fc2152815a0a0e178.tar.bz2
Move GCMClient related files to gcm_driver component
GCMActivity, GCMClient, GCMClientImpl and GCMStatsRecorderImpl have been moved to gcm_driver component. This allows us to remove the dependency on google_apis/gcm for Android GCM support. BUG=353786,356716 TEST=existing tests due to no functionality change R=fgorski@chromium.org, zea@chromium.org TBR=arv@chromium.org, kalman@chromium.org, pavely@chromium.org Review URL: https://codereview.chromium.org/310973002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275826 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/api/gcm/gcm_api.h2
-rw-r--r--chrome/browser/extensions/extension_gcm_app_handler.h2
-rw-r--r--chrome/browser/invalidation/gcm_invalidation_bridge.h2
-rw-r--r--chrome/browser/services/gcm/gcm_desktop_utils.cc2
-rw-r--r--chrome/browser/services/gcm/gcm_profile_service.cc13
-rw-r--r--chrome/browser/services/gcm/gcm_profile_service.h4
-rw-r--r--chrome/browser/services/gcm/gcm_profile_service_factory.cc6
-rw-r--r--chrome/browser/services/gcm/gcm_profile_service_unittest.cc2
-rw-r--r--chrome/browser/ui/webui/gcm_internals_ui.cc2
-rw-r--r--components/components_tests.gyp4
-rw-r--r--components/gcm_driver.gypi31
-rw-r--r--components/gcm_driver/fake_gcm_client.h2
-rw-r--r--components/gcm_driver/fake_gcm_client_factory.cc2
-rw-r--r--components/gcm_driver/gcm_activity.cc (renamed from google_apis/gcm/gcm_activity.cc)2
-rw-r--r--components/gcm_driver/gcm_activity.h (renamed from google_apis/gcm/gcm_activity.h)21
-rw-r--r--components/gcm_driver/gcm_app_handler.h84
-rw-r--r--components/gcm_driver/gcm_client.cc (renamed from google_apis/gcm/gcm_client.cc)2
-rw-r--r--components/gcm_driver/gcm_client.h (renamed from google_apis/gcm/gcm_client.h)23
-rw-r--r--components/gcm_driver/gcm_client_factory.cc2
-rw-r--r--components/gcm_driver/gcm_client_impl.cc (renamed from google_apis/gcm/gcm_client_impl.cc)4
-rw-r--r--components/gcm_driver/gcm_client_impl.h (renamed from google_apis/gcm/gcm_client_impl.h)18
-rw-r--r--components/gcm_driver/gcm_client_impl_unittest.cc (renamed from google_apis/gcm/gcm_client_impl_unittest.cc)2
-rw-r--r--components/gcm_driver/gcm_driver.h2
-rw-r--r--components/gcm_driver/gcm_driver_desktop.h2
-rw-r--r--components/gcm_driver/gcm_stats_recorder_impl.cc (renamed from google_apis/gcm/monitoring/gcm_stats_recorder_impl.cc)2
-rw-r--r--components/gcm_driver/gcm_stats_recorder_impl.h (renamed from google_apis/gcm/monitoring/gcm_stats_recorder_impl.h)11
-rw-r--r--components/gcm_driver/gcm_stats_recorder_impl_unittest.cc (renamed from google_apis/gcm/monitoring/gcm_stats_recorder_impl_unittest.cc)2
-rw-r--r--components/invalidation/DEPS1
-rw-r--r--components/invalidation/gcm_network_channel_delegate.h2
-rw-r--r--google_apis/gcm/engine/gservices_settings_unittest.cc1
-rw-r--r--google_apis/gcm/gcm.gyp10
31 files changed, 150 insertions, 115 deletions
diff --git a/chrome/browser/extensions/api/gcm/gcm_api.h b/chrome/browser/extensions/api/gcm/gcm_api.h
index 4a13a2f..322a5d2 100644
--- a/chrome/browser/extensions/api/gcm/gcm_api.h
+++ b/chrome/browser/extensions/api/gcm/gcm_api.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_EXTENSIONS_API_GCM_GCM_API_H_
#include "chrome/common/extensions/api/gcm.h"
+#include "components/gcm_driver/gcm_client.h"
#include "extensions/browser/extension_function.h"
-#include "google_apis/gcm/gcm_client.h"
namespace gcm {
class GCMDriver;
diff --git a/chrome/browser/extensions/extension_gcm_app_handler.h b/chrome/browser/extensions/extension_gcm_app_handler.h
index 8bff0a7..8c7bc33 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler.h
+++ b/chrome/browser/extensions/extension_gcm_app_handler.h
@@ -13,9 +13,9 @@
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "components/gcm_driver/gcm_app_handler.h"
+#include "components/gcm_driver/gcm_client.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_registry_observer.h"
-#include "google_apis/gcm/gcm_client.h"
class Profile;
diff --git a/chrome/browser/invalidation/gcm_invalidation_bridge.h b/chrome/browser/invalidation/gcm_invalidation_bridge.h
index 8a92393..b6a9896 100644
--- a/chrome/browser/invalidation/gcm_invalidation_bridge.h
+++ b/chrome/browser/invalidation/gcm_invalidation_bridge.h
@@ -10,9 +10,9 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "components/gcm_driver/gcm_app_handler.h"
+#include "components/gcm_driver/gcm_client.h"
#include "components/invalidation/gcm_network_channel_delegate.h"
#include "google_apis/gaia/oauth2_token_service.h"
-#include "google_apis/gcm/gcm_client.h"
class IdentityProvider;
diff --git a/chrome/browser/services/gcm/gcm_desktop_utils.cc b/chrome/browser/services/gcm/gcm_desktop_utils.cc
index 98c66cf..05ed2f8 100644
--- a/chrome/browser/services/gcm/gcm_desktop_utils.cc
+++ b/chrome/browser/services/gcm/gcm_desktop_utils.cc
@@ -8,11 +8,11 @@
#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.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 {
diff --git a/chrome/browser/services/gcm/gcm_profile_service.cc b/chrome/browser/services/gcm/gcm_profile_service.cc
index bb2d0c8..424f5909 100644
--- a/chrome/browser/services/gcm/gcm_profile_service.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service.cc
@@ -42,15 +42,20 @@ void GCMProfileService::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
}
+#if defined(OS_ANDROID)
+GCMProfileService::GCMProfileService(Profile* profile)
+ : profile_(profile) {
+ DCHECK(!profile->IsOffTheRecord());
+
+ driver_.reset(new GCMDriverAndroid);
+}
+#else
GCMProfileService::GCMProfileService(
Profile* profile,
scoped_ptr<GCMClientFactory> gcm_client_factory)
: profile_(profile) {
DCHECK(!profile->IsOffTheRecord());
-#if defined(OS_ANDROID)
- driver_.reset(new GCMDriverAndroid);
-#else
driver_ = CreateGCMDriverDesktop(
gcm_client_factory.Pass(),
scoped_ptr<IdentityProvider>(new ProfileIdentityProvider(
@@ -59,8 +64,8 @@ GCMProfileService::GCMProfileService(
LoginUIServiceFactory::GetForProfile(profile_))),
profile_->GetPath().Append(chrome::kGCMStoreDirname),
profile_->GetRequestContext());
-#endif
}
+#endif // defined(OS_ANDROID)
GCMProfileService::GCMProfileService() : profile_(NULL) {
}
diff --git a/chrome/browser/services/gcm/gcm_profile_service.h b/chrome/browser/services/gcm/gcm_profile_service.h
index eb476be..70b6112 100644
--- a/chrome/browser/services/gcm/gcm_profile_service.h
+++ b/chrome/browser/services/gcm/gcm_profile_service.h
@@ -35,8 +35,12 @@ class GCMProfileService : public KeyedService {
// Register profile-specific prefs for GCM.
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+#if defined(OS_ANDROID)
+ explicit GCMProfileService(Profile* profile);
+#else
GCMProfileService(Profile* profile,
scoped_ptr<GCMClientFactory> gcm_client_factory);
+#endif
virtual ~GCMProfileService();
// TODO(jianli): obsolete methods that are going to be removed soon.
diff --git a/chrome/browser/services/gcm/gcm_profile_service_factory.cc b/chrome/browser/services/gcm/gcm_profile_service_factory.cc
index 2cd5bd7..92c01d3 100644
--- a/chrome/browser/services/gcm/gcm_profile_service_factory.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service_factory.cc
@@ -10,11 +10,11 @@
#include "chrome/browser/services/gcm/gcm_profile_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
-#include "components/gcm_driver/gcm_client_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
+#include "components/gcm_driver/gcm_client_factory.h"
#endif
namespace gcm {
@@ -50,9 +50,13 @@ GCMProfileServiceFactory::~GCMProfileServiceFactory() {
KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
+#if defined(OS_ANDROID)
+ return new GCMProfileService(Profile::FromBrowserContext(context));
+#else
return new GCMProfileService(
Profile::FromBrowserContext(context),
scoped_ptr<GCMClientFactory>(new GCMClientFactory));
+#endif
}
content::BrowserContext* GCMProfileServiceFactory::GetBrowserContextToUse(
diff --git a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
index cb7f1e0..c5fb250 100644
--- a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc
@@ -18,13 +18,13 @@
#include "components/gcm_driver/fake_gcm_app_handler.h"
#include "components/gcm_driver/fake_gcm_client.h"
#include "components/gcm_driver/fake_gcm_client_factory.h"
+#include "components/gcm_driver/gcm_client.h"
#include "components/gcm_driver/gcm_client_factory.h"
#include "components/gcm_driver/gcm_driver.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
-#include "google_apis/gcm/gcm_client.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gcm {
diff --git a/chrome/browser/ui/webui/gcm_internals_ui.cc b/chrome/browser/ui/webui/gcm_internals_ui.cc
index 2d8b6f2..75eacaa 100644
--- a/chrome/browser/ui/webui/gcm_internals_ui.cc
+++ b/chrome/browser/ui/webui/gcm_internals_ui.cc
@@ -17,12 +17,12 @@
#include "chrome/browser/services/gcm/gcm_profile_service.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/common/url_constants.h"
+#include "components/gcm_driver/gcm_client.h"
#include "components/gcm_driver/gcm_driver.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
-#include "google_apis/gcm/gcm_client.h"
#include "grit/browser_resources.h"
namespace {
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index b7164bc..23de5ed 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -101,7 +101,9 @@
'feedback/feedback_common_unittest.cc',
'feedback/feedback_data_unittest.cc',
'feedback/feedback_uploader_unittest.cc',
+ 'gcm_driver/gcm_client_impl_unittest.cc',
'gcm_driver/gcm_driver_desktop_unittest.cc',
+ 'gcm_driver/gcm_stats_recorder_impl_unittest.cc',
'invalidation/invalidation_logger_unittest.cc',
'json_schema/json_schema_validator_unittest.cc',
'json_schema/json_schema_validator_unittest_base.cc',
@@ -451,10 +453,12 @@
}],
['OS == "android"', {
'sources!': [
+ 'gcm_driver/gcm_client_impl_unittest.cc',
'gcm_driver/gcm_driver_desktop_unittest.cc',
'feedback/feedback_common_unittest.cc',
'feedback/feedback_data_unittest.cc',
'feedback/feedback_uploader_unittest.cc',
+ 'gcm_driver/gcm_stats_recorder_impl_unittest.cc',
'signin/core/browser/mutable_profile_oauth2_token_service_unittest.cc',
'storage_monitor/media_storage_util_unittest.cc',
'storage_monitor/storage_info_unittest.cc',
diff --git a/components/gcm_driver.gypi b/components/gcm_driver.gypi
index 7b3bb4a..f99d5d9 100644
--- a/components/gcm_driver.gypi
+++ b/components/gcm_driver.gypi
@@ -21,15 +21,23 @@
'gcm_driver/android/component_jni_registrar.h',
'gcm_driver/default_gcm_app_handler.cc',
'gcm_driver/default_gcm_app_handler.h',
+ 'gcm_driver/gcm_activity.cc',
+ 'gcm_driver/gcm_activity.h',
'gcm_driver/gcm_app_handler.h',
+ 'gcm_driver/gcm_client.cc',
+ 'gcm_driver/gcm_client.h',
'gcm_driver/gcm_client_factory.cc',
'gcm_driver/gcm_client_factory.h',
+ 'gcm_driver/gcm_client_impl.cc',
+ 'gcm_driver/gcm_client_impl.h',
'gcm_driver/gcm_driver.cc',
'gcm_driver/gcm_driver.h',
'gcm_driver/gcm_driver_android.cc',
'gcm_driver/gcm_driver_android.h',
'gcm_driver/gcm_driver_desktop.cc',
'gcm_driver/gcm_driver_desktop.h',
+ 'gcm_driver/gcm_stats_recorder_impl.cc',
+ 'gcm_driver/gcm_stats_recorder_impl.h',
'gcm_driver/system_encryptor.cc',
'gcm_driver/system_encryptor.h',
],
@@ -38,9 +46,18 @@
'dependencies': [
'gcm_driver_jni_headers',
],
+ 'dependencies!': [
+ '../google_apis/gcm/gcm.gyp:gcm',
+ ],
'sources!': [
+ 'gcm_driver/gcm_client_factory.cc',
+ 'gcm_driver/gcm_client_factory.h',
+ 'gcm_driver/gcm_client_impl.cc',
+ 'gcm_driver/gcm_client_impl.h',
'gcm_driver/gcm_driver_desktop.cc',
'gcm_driver/gcm_driver_desktop.h',
+ 'gcm_driver/gcm_stats_recorder_impl.cc',
+ 'gcm_driver/gcm_stats_recorder_impl.h',
],
}],
],
@@ -51,6 +68,7 @@
'dependencies': [
'gcm_driver',
'../base/base.gyp:base',
+ '../google_apis/gcm/gcm.gyp:gcm_test_support',
'../testing/gtest.gyp:gtest',
],
'include_dirs': [
@@ -66,6 +84,19 @@
'gcm_driver/fake_gcm_driver.cc',
'gcm_driver/fake_gcm_driver.h',
],
+ 'conditions': [
+ ['OS == "android"', {
+ 'dependencies!': [
+ '../google_apis/gcm/gcm.gyp:gcm_test_support',
+ ],
+ 'sources!': [
+ 'gcm_driver/fake_gcm_client.cc',
+ 'gcm_driver/fake_gcm_client.h',
+ 'gcm_driver/fake_gcm_client_factory.cc',
+ 'gcm_driver/fake_gcm_client_factory.h',
+ ],
+ }],
+ ],
},
],
'conditions': [
diff --git a/components/gcm_driver/fake_gcm_client.h b/components/gcm_driver/fake_gcm_client.h
index a1d4f2b..dc0a606 100644
--- a/components/gcm_driver/fake_gcm_client.h
+++ b/components/gcm_driver/fake_gcm_client.h
@@ -7,7 +7,7 @@
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
-#include "google_apis/gcm/gcm_client.h"
+#include "components/gcm_driver/gcm_client.h"
namespace base {
class SequencedTaskRunner;
diff --git a/components/gcm_driver/fake_gcm_client_factory.cc b/components/gcm_driver/fake_gcm_client_factory.cc
index e071302..e592bec 100644
--- a/components/gcm_driver/fake_gcm_client_factory.cc
+++ b/components/gcm_driver/fake_gcm_client_factory.cc
@@ -6,7 +6,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/sequenced_task_runner.h"
-#include "google_apis/gcm/gcm_client.h"
+#include "components/gcm_driver/gcm_client.h"
namespace gcm {
diff --git a/google_apis/gcm/gcm_activity.cc b/components/gcm_driver/gcm_activity.cc
index 4c04d37..7e9e162 100644
--- a/google_apis/gcm/gcm_activity.cc
+++ b/components/gcm_driver/gcm_activity.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "google_apis/gcm/gcm_activity.h"
+#include "components/gcm_driver/gcm_activity.h"
namespace gcm {
diff --git a/google_apis/gcm/gcm_activity.h b/components/gcm_driver/gcm_activity.h
index 45078c7..0d3da0c 100644
--- a/google_apis/gcm/gcm_activity.h
+++ b/components/gcm_driver/gcm_activity.h
@@ -2,19 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef GOOGLE_APIS_GCM_GCM_ACTIVITY_H_
-#define GOOGLE_APIS_GCM_GCM_ACTIVITY_H_
+#ifndef COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_
+#define COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_
#include <string>
#include <vector>
#include "base/time/time.h"
-#include "google_apis/gcm/base/gcm_export.h"
namespace gcm {
// Contains data that are common to all activity kinds below.
-struct GCM_EXPORT Activity {
+struct Activity {
Activity();
virtual ~Activity();
@@ -24,19 +23,19 @@ struct GCM_EXPORT Activity {
};
// Contains relevant data of a connection activity.
-struct GCM_EXPORT ConnectionActivity : Activity {
+struct ConnectionActivity : Activity {
ConnectionActivity();
virtual ~ConnectionActivity();
};
// Contains relevant data of a check-in activity.
-struct GCM_EXPORT CheckinActivity : Activity {
+struct CheckinActivity : Activity {
CheckinActivity();
virtual ~CheckinActivity();
};
// Contains relevant data of a registration/unregistration step.
-struct GCM_EXPORT RegistrationActivity : Activity {
+struct RegistrationActivity : Activity {
RegistrationActivity();
virtual ~RegistrationActivity();
@@ -45,7 +44,7 @@ struct GCM_EXPORT RegistrationActivity : Activity {
};
// Contains relevant data of a message receiving event.
-struct GCM_EXPORT ReceivingActivity : Activity {
+struct ReceivingActivity : Activity {
ReceivingActivity();
virtual ~ReceivingActivity();
@@ -55,7 +54,7 @@ struct GCM_EXPORT ReceivingActivity : Activity {
};
// Contains relevant data of a send-message step.
-struct GCM_EXPORT SendingActivity : Activity {
+struct SendingActivity : Activity {
SendingActivity();
virtual ~SendingActivity();
@@ -64,7 +63,7 @@ struct GCM_EXPORT SendingActivity : Activity {
std::string message_id;
};
-struct GCM_EXPORT RecordedActivities {
+struct RecordedActivities {
RecordedActivities();
virtual ~RecordedActivities();
@@ -77,4 +76,4 @@ struct GCM_EXPORT RecordedActivities {
} // namespace gcm
-#endif // GOOGLE_APIS_GCM_GCM_ACTIVITY_H_
+#endif // COMPONENTS_GCM_DRIVER_GCM_ACTIVITY_H_
diff --git a/components/gcm_driver/gcm_app_handler.h b/components/gcm_driver/gcm_app_handler.h
index f1487a7..31bab34 100644
--- a/components/gcm_driver/gcm_app_handler.h
+++ b/components/gcm_driver/gcm_app_handler.h
@@ -1,42 +1,42 @@
-// Copyright (c) 2014 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.
-
-#ifndef COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
-#define COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "google_apis/gcm/gcm_client.h"
-
-namespace gcm {
-
-// Defines the interface to provide handling and event routing logic for a given
-// app.
-class GCMAppHandler {
- public:
- GCMAppHandler() {}
- virtual ~GCMAppHandler() {}
-
- // Called to do all the cleanup when GCM is shutting down.
- // In the case that multiple apps share the same app handler, it should be
- // make safe for ShutdownHandler to be called multiple times.
- virtual void ShutdownHandler() = 0;
-
- // Called when a GCM message has been received.
- virtual void OnMessage(const std::string& app_id,
- const GCMClient::IncomingMessage& message) = 0;
-
- // Called when some GCM messages have been deleted from the server.
- virtual void OnMessagesDeleted(const std::string& app_id) = 0;
-
- // Called when a GCM message failed to be delivered.
- virtual void OnSendError(
- const std::string& app_id,
- const GCMClient::SendErrorDetails& send_error_details) = 0;
-};
-
-} // namespace gcm
-
-#endif // COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
+// Copyright (c) 2014 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.
+
+#ifndef COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
+#define COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "components/gcm_driver/gcm_client.h"
+
+namespace gcm {
+
+// Defines the interface to provide handling and event routing logic for a given
+// app.
+class GCMAppHandler {
+ public:
+ GCMAppHandler() {}
+ virtual ~GCMAppHandler() {}
+
+ // Called to do all the cleanup when GCM is shutting down.
+ // In the case that multiple apps share the same app handler, it should be
+ // make safe for ShutdownHandler to be called multiple times.
+ virtual void ShutdownHandler() = 0;
+
+ // Called when a GCM message has been received.
+ virtual void OnMessage(const std::string& app_id,
+ const GCMClient::IncomingMessage& message) = 0;
+
+ // Called when some GCM messages have been deleted from the server.
+ virtual void OnMessagesDeleted(const std::string& app_id) = 0;
+
+ // Called when a GCM message failed to be delivered.
+ virtual void OnSendError(
+ const std::string& app_id,
+ const GCMClient::SendErrorDetails& send_error_details) = 0;
+};
+
+} // namespace gcm
+
+#endif // COMPONENTS_GCM_DRIVER_GCM_APP_HANDLER_H_
diff --git a/google_apis/gcm/gcm_client.cc b/components/gcm_driver/gcm_client.cc
index 93a2d07..a028280 100644
--- a/google_apis/gcm/gcm_client.cc
+++ b/components/gcm_driver/gcm_client.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "google_apis/gcm/gcm_client.h"
+#include "components/gcm_driver/gcm_client.h"
namespace gcm {
diff --git a/google_apis/gcm/gcm_client.h b/components/gcm_driver/gcm_client.h
index 119bb38..10f9a99 100644
--- a/google_apis/gcm/gcm_client.h
+++ b/components/gcm_driver/gcm_client.h
@@ -1,9 +1,9 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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.
-#ifndef GOOGLE_APIS_GCM_GCM_CLIENT_H_
-#define GOOGLE_APIS_GCM_GCM_CLIENT_H_
+#ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_
+#define COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_
#include <map>
#include <string>
@@ -11,8 +11,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "google_apis/gcm/base/gcm_export.h"
-#include "google_apis/gcm/gcm_activity.h"
+#include "components/gcm_driver/gcm_activity.h"
template <class T> class scoped_refptr;
@@ -31,7 +30,7 @@ class Encryptor;
// Interface that encapsulates the network communications with the Google Cloud
// Messaging server. This interface is not supposed to be thread-safe.
-class GCM_EXPORT GCMClient {
+class GCMClient {
public:
enum Result {
// Successful operation.
@@ -73,7 +72,7 @@ class GCM_EXPORT GCMClient {
CHANNEL_UNKNOWN
};
- struct GCM_EXPORT ChromeBuildInfo {
+ struct ChromeBuildInfo {
ChromeBuildInfo();
~ChromeBuildInfo();
@@ -86,7 +85,7 @@ class GCM_EXPORT GCMClient {
typedef std::map<std::string, std::string> MessageData;
// Message to be delivered to the other party.
- struct GCM_EXPORT OutgoingMessage {
+ struct OutgoingMessage {
OutgoingMessage();
~OutgoingMessage();
@@ -100,7 +99,7 @@ class GCM_EXPORT GCMClient {
};
// Message being received from the other party.
- struct GCM_EXPORT IncomingMessage {
+ struct IncomingMessage {
IncomingMessage();
~IncomingMessage();
@@ -110,7 +109,7 @@ class GCM_EXPORT GCMClient {
};
// Detailed information of the Send Error event.
- struct GCM_EXPORT SendErrorDetails {
+ struct SendErrorDetails {
SendErrorDetails();
~SendErrorDetails();
@@ -120,7 +119,7 @@ class GCM_EXPORT GCMClient {
};
// Internal states and activity statistics of a GCM client.
- struct GCM_EXPORT GCMStatistics {
+ struct GCMStatistics {
public:
GCMStatistics();
~GCMStatistics();
@@ -262,4 +261,4 @@ class GCM_EXPORT GCMClient {
} // namespace gcm
-#endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_
+#endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_
diff --git a/components/gcm_driver/gcm_client_factory.cc b/components/gcm_driver/gcm_client_factory.cc
index 64d7d5c..e09f8b4 100644
--- a/components/gcm_driver/gcm_client_factory.cc
+++ b/components/gcm_driver/gcm_client_factory.cc
@@ -4,7 +4,7 @@
#include "components/gcm_driver/gcm_client_factory.h"
-#include "google_apis/gcm/gcm_client_impl.h"
+#include "components/gcm_driver/gcm_client_impl.h"
namespace gcm {
diff --git a/google_apis/gcm/gcm_client_impl.cc b/components/gcm_driver/gcm_client_impl.cc
index b5a3ae6..a60df69 100644
--- a/google_apis/gcm/gcm_client_impl.cc
+++ b/components/gcm_driver/gcm_client_impl.cc
@@ -1,8 +1,8 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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 "google_apis/gcm/gcm_client_impl.h"
+#include "components/gcm_driver/gcm_client_impl.h"
#include "base/bind.h"
#include "base/files/file_path.h"
diff --git a/google_apis/gcm/gcm_client_impl.h b/components/gcm_driver/gcm_client_impl.h
index e543d73..e74a8aa 100644
--- a/google_apis/gcm/gcm_client_impl.h
+++ b/components/gcm_driver/gcm_client_impl.h
@@ -1,9 +1,9 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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.
-#ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
-#define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
+#ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
+#define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
#include <map>
#include <string>
@@ -13,14 +13,14 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/stl_util.h"
+#include "components/gcm_driver/gcm_client.h"
+#include "components/gcm_driver/gcm_stats_recorder_impl.h"
#include "google_apis/gcm/base/mcs_message.h"
#include "google_apis/gcm/engine/gcm_store.h"
#include "google_apis/gcm/engine/gservices_settings.h"
#include "google_apis/gcm/engine/mcs_client.h"
#include "google_apis/gcm/engine/registration_request.h"
#include "google_apis/gcm/engine/unregistration_request.h"
-#include "google_apis/gcm/gcm_client.h"
-#include "google_apis/gcm/monitoring/gcm_stats_recorder_impl.h"
#include "google_apis/gcm/protocol/android_checkin.pb.h"
#include "google_apis/gcm/protocol/checkin.pb.h"
#include "net/base/net_log.h"
@@ -49,7 +49,7 @@ class GCMClientImplTest;
// Helper class for building GCM internals. Allows tests to inject fake versions
// as necessary.
-class GCM_EXPORT GCMInternalsBuilder {
+class GCMInternalsBuilder {
public:
GCMInternalsBuilder();
virtual ~GCMInternalsBuilder();
@@ -73,7 +73,7 @@ class GCM_EXPORT GCMInternalsBuilder {
// with MCS) and other pieces of GCM infrastructure like Registration and
// Checkins. It also allows for registering user delegates that host
// applications that send and receive messages.
-class GCM_EXPORT GCMClientImpl
+class GCMClientImpl
: public GCMClient, public GCMStatsRecorder::Delegate {
public:
explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder);
@@ -121,7 +121,7 @@ class GCM_EXPORT GCMClientImpl
};
// The check-in info for the user. Returned by the server.
- struct GCM_EXPORT CheckinInfo {
+ struct CheckinInfo {
CheckinInfo() : android_id(0), secret(0) {}
bool IsValid() const { return android_id != 0 && secret != 0; }
void Reset() {
@@ -298,4 +298,4 @@ class GCM_EXPORT GCMClientImpl
} // namespace gcm
-#endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_
+#endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
diff --git a/google_apis/gcm/gcm_client_impl_unittest.cc b/components/gcm_driver/gcm_client_impl_unittest.cc
index 8da4887..0363f86 100644
--- a/google_apis/gcm/gcm_client_impl_unittest.cc
+++ b/components/gcm_driver/gcm_client_impl_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "google_apis/gcm/gcm_client_impl.h"
+#include "components/gcm_driver/gcm_client_impl.h"
#include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
diff --git a/components/gcm_driver/gcm_driver.h b/components/gcm_driver/gcm_driver.h
index b86c863..e2fe882 100644
--- a/components/gcm_driver/gcm_driver.h
+++ b/components/gcm_driver/gcm_driver.h
@@ -13,7 +13,7 @@
#include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "components/gcm_driver/default_gcm_app_handler.h"
-#include "google_apis/gcm/gcm_client.h"
+#include "components/gcm_driver/gcm_client.h"
namespace gcm {
diff --git a/components/gcm_driver/gcm_driver_desktop.h b/components/gcm_driver/gcm_driver_desktop.h
index 165fbe3..3c84d13 100644
--- a/components/gcm_driver/gcm_driver_desktop.h
+++ b/components/gcm_driver/gcm_driver_desktop.h
@@ -14,9 +14,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "components/gcm_driver/gcm_client.h"
#include "components/gcm_driver/gcm_driver.h"
#include "google_apis/gaia/identity_provider.h"
-#include "google_apis/gcm/gcm_client.h"
namespace base {
class FilePath;
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder_impl.cc b/components/gcm_driver/gcm_stats_recorder_impl.cc
index 8786d51..746d5e3 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder_impl.cc
+++ b/components/gcm_driver/gcm_stats_recorder_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "google_apis/gcm/monitoring/gcm_stats_recorder_impl.h"
+#include "components/gcm_driver/gcm_stats_recorder_impl.h"
#include <deque>
#include <vector>
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder_impl.h b/components/gcm_driver/gcm_stats_recorder_impl.h
index 434cb67..4c3c57e 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder_impl.h
+++ b/components/gcm_driver/gcm_stats_recorder_impl.h
@@ -2,20 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef GOOGLE_APIS_GCM_GCM_STATS_RECORDER_IMPL_H_
-#define GOOGLE_APIS_GCM_GCM_STATS_RECORDER_IMPL_H_
+#ifndef COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_
+#define COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_
#include <deque>
#include <string>
#include <vector>
#include "base/time/time.h"
-#include "google_apis/gcm/base/gcm_export.h"
+#include "components/gcm_driver/gcm_activity.h"
#include "google_apis/gcm/engine/connection_factory.h"
#include "google_apis/gcm/engine/mcs_client.h"
#include "google_apis/gcm/engine/registration_request.h"
#include "google_apis/gcm/engine/unregistration_request.h"
-#include "google_apis/gcm/gcm_activity.h"
#include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
namespace gcm {
@@ -25,7 +24,7 @@ namespace gcm {
// by default.
// This class is not thread safe. It is meant to be owned by a gcm client
// instance.
-class GCM_EXPORT GCMStatsRecorderImpl : public GCMStatsRecorder {
+class GCMStatsRecorderImpl : public GCMStatsRecorder {
public:
GCMStatsRecorderImpl();
virtual ~GCMStatsRecorderImpl();
@@ -153,4 +152,4 @@ class GCM_EXPORT GCMStatsRecorderImpl : public GCMStatsRecorder {
} // namespace gcm
-#endif // GOOGLE_APIS_GCM_GCM_STATS_RECORDER_IMPL_H_
+#endif // COMPONENTS_GCM_DRIVER_GCM_STATS_RECORDER_IMPL_H_
diff --git a/google_apis/gcm/monitoring/gcm_stats_recorder_impl_unittest.cc b/components/gcm_driver/gcm_stats_recorder_impl_unittest.cc
index e870a60c..95fbbbf 100644
--- a/google_apis/gcm/monitoring/gcm_stats_recorder_impl_unittest.cc
+++ b/components/gcm_driver/gcm_stats_recorder_impl_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "google_apis/gcm/monitoring/gcm_stats_recorder_impl.h"
+#include "components/gcm_driver/gcm_stats_recorder_impl.h"
#include <deque>
#include <string>
diff --git a/components/invalidation/DEPS b/components/invalidation/DEPS
index 279d079..20d1ff3 100644
--- a/components/invalidation/DEPS
+++ b/components/invalidation/DEPS
@@ -1,6 +1,7 @@
include_rules = [
"-content",
+ "+components/gcm_driver",
"+components/keyed_service",
"+components/pref_registry",
diff --git a/components/invalidation/gcm_network_channel_delegate.h b/components/invalidation/gcm_network_channel_delegate.h
index 5229dec..fe997fe 100644
--- a/components/invalidation/gcm_network_channel_delegate.h
+++ b/components/invalidation/gcm_network_channel_delegate.h
@@ -8,7 +8,7 @@
#include <string>
#include "base/callback.h"
-#include "google_apis/gcm/gcm_client.h"
+#include "components/gcm_driver/gcm_client.h"
class GoogleServiceAuthError;
diff --git a/google_apis/gcm/engine/gservices_settings_unittest.cc b/google_apis/gcm/engine/gservices_settings_unittest.cc
index 0b2d063..9e02109 100644
--- a/google_apis/gcm/engine/gservices_settings_unittest.cc
+++ b/google_apis/gcm/engine/gservices_settings_unittest.cc
@@ -5,7 +5,6 @@
#include "base/strings/string_number_conversions.h"
#include "google_apis/gcm/engine/gservices_settings.h"
#include "google_apis/gcm/engine/registration_info.h"
-#include "google_apis/gcm/gcm_client.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gcm {
diff --git a/google_apis/gcm/gcm.gyp b/google_apis/gcm/gcm.gyp
index b496281..81dcf21 100644
--- a/google_apis/gcm/gcm.gyp
+++ b/google_apis/gcm/gcm.gyp
@@ -69,15 +69,7 @@
'engine/registration_request.h',
'engine/unregistration_request.cc',
'engine/unregistration_request.h',
- 'gcm_activity.cc',
- 'gcm_activity.h',
- 'gcm_client.cc',
- 'gcm_client.h',
- 'gcm_client_impl.cc',
- 'gcm_client_impl.h',
'monitoring/gcm_stats_recorder.h',
- 'monitoring/gcm_stats_recorder_impl.cc',
- 'monitoring/gcm_stats_recorder_impl.h',
'protocol/android_checkin.proto',
'protocol/checkin.proto',
'protocol/mcs.proto',
@@ -171,8 +163,6 @@
'engine/mcs_client_unittest.cc',
'engine/registration_request_unittest.cc',
'engine/unregistration_request_unittest.cc',
- 'gcm_client_impl_unittest.cc',
- 'monitoring/gcm_stats_recorder_impl_unittest.cc'
]
},
],