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

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

Issue 270873002: Extract GCMClient data types into separate gcm_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reupload Created 6 years, 7 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_service.h ('k') | chrome/browser/services/gcm/gcm_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/services/gcm/gcm_service.cc
diff --git a/chrome/browser/services/gcm/gcm_service.cc b/chrome/browser/services/gcm/gcm_service.cc
index 0b5c74dc601e0143b80e6e65927317069ebc740f..029b309f17eb1ab4e17a56e7945639e181ef48f3 100644
--- a/chrome/browser/services/gcm/gcm_service.cc
+++ b/chrome/browser/services/gcm/gcm_service.cc
@@ -132,19 +132,19 @@ class GCMService::IOWorker : public GCMClient::Delegate {
// Called on IO thread.
virtual void OnRegisterFinished(const std::string& app_id,
const std::string& registration_id,
- GCMClient::Result result) OVERRIDE;
+ Result result) OVERRIDE;
virtual void OnUnregisterFinished(const std::string& app_id,
- GCMClient::Result result) OVERRIDE;
+ Result result) OVERRIDE;
virtual void OnSendFinished(const std::string& app_id,
const std::string& message_id,
- GCMClient::Result result) OVERRIDE;
+ Result result) OVERRIDE;
virtual void OnMessageReceived(
const std::string& app_id,
- const GCMClient::IncomingMessage& message) OVERRIDE;
+ const IncomingMessage& message) OVERRIDE;
virtual void OnMessagesDeleted(const std::string& app_id) OVERRIDE;
virtual void OnMessageSendError(
const std::string& app_id,
- const GCMClient::SendErrorDetails& send_error_details) OVERRIDE;
+ const SendErrorDetails& send_error_details) OVERRIDE;
virtual void OnGCMReady() OVERRIDE;
// Called on IO thread.
@@ -161,7 +161,7 @@ class GCMService::IOWorker : public GCMClient::Delegate {
void Unregister(const std::string& app_id);
void Send(const std::string& app_id,
const std::string& receiver_id,
- const GCMClient::OutgoingMessage& message);
+ const OutgoingMessage& message);
void GetGCMStatistics(bool clear_logs);
void SetGCMRecording(bool recording);
@@ -217,7 +217,7 @@ void GCMService::IOWorker::Initialize(
void GCMService::IOWorker::OnRegisterFinished(
const std::string& app_id,
const std::string& registration_id,
- GCMClient::Result result) {
+ Result result) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
content::BrowserThread::PostTask(content::BrowserThread::UI,
@@ -230,7 +230,7 @@ void GCMService::IOWorker::OnRegisterFinished(
}
void GCMService::IOWorker::OnUnregisterFinished(const std::string& app_id,
- GCMClient::Result result) {
+ Result result) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
content::BrowserThread::PostTask(
@@ -241,7 +241,7 @@ void GCMService::IOWorker::OnUnregisterFinished(const std::string& app_id,
void GCMService::IOWorker::OnSendFinished(const std::string& app_id,
const std::string& message_id,
- GCMClient::Result result) {
+ Result result) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
content::BrowserThread::PostTask(content::BrowserThread::UI,
@@ -255,7 +255,7 @@ void GCMService::IOWorker::OnSendFinished(const std::string& app_id,
void GCMService::IOWorker::OnMessageReceived(
const std::string& app_id,
- const GCMClient::IncomingMessage& message) {
+ const IncomingMessage& message) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
content::BrowserThread::PostTask(content::BrowserThread::UI,
@@ -278,7 +278,7 @@ void GCMService::IOWorker::OnMessagesDeleted(const std::string& app_id) {
void GCMService::IOWorker::OnMessageSendError(
const std::string& app_id,
- const GCMClient::SendErrorDetails& send_error_details) {
+ const SendErrorDetails& send_error_details) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
content::BrowserThread::PostTask(content::BrowserThread::UI,
@@ -334,7 +334,7 @@ void GCMService::IOWorker::Unregister(const std::string& app_id) {
void GCMService::IOWorker::Send(const std::string& app_id,
const std::string& receiver_id,
- const GCMClient::OutgoingMessage& message) {
+ const OutgoingMessage& message) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
gcm_client_->Send(app_id, receiver_id, message);
@@ -342,7 +342,7 @@ void GCMService::IOWorker::Send(const std::string& app_id,
void GCMService::IOWorker::GetGCMStatistics(bool clear_logs) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- gcm::GCMClient::GCMStatistics stats;
+ GCMClient::GCMStatistics stats;
if (gcm_client_.get()) {
if (clear_logs)
@@ -358,7 +358,7 @@ void GCMService::IOWorker::GetGCMStatistics(bool clear_logs) {
void GCMService::IOWorker::SetGCMRecording(bool recording) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- gcm::GCMClient::GCMStatistics stats;
+ GCMClient::GCMStatistics stats;
if (gcm_client_.get()) {
gcm_client_->SetRecording(recording);
@@ -470,15 +470,15 @@ void GCMService::Register(const std::string& app_id,
DCHECK(!sender_ids.empty());
DCHECK(!callback.is_null());
- GCMClient::Result result = EnsureAppReady(app_id);
- if (result != GCMClient::SUCCESS) {
+ Result result = EnsureAppReady(app_id);
+ if (result != RESULT_SUCCESS) {
callback.Run(std::string(), result);
return;
}
// If previous un/register operation is still in progress, bail out.
if (IsAsyncOperationPending(app_id)) {
- callback.Run(std::string(), GCMClient::ASYNC_OPERATION_PENDING);
+ callback.Run(std::string(), RESULT_ASYNC_OPERATION_PENDING);
return;
}
@@ -525,15 +525,15 @@ void GCMService::Unregister(const std::string& app_id,
DCHECK(!app_id.empty());
DCHECK(!callback.is_null());
- GCMClient::Result result = EnsureAppReady(app_id);
- if (result != GCMClient::SUCCESS) {
+ Result result = EnsureAppReady(app_id);
+ if (result != RESULT_SUCCESS) {
callback.Run(result);
return;
}
// If previous un/register operation is still in progress, bail out.
if (IsAsyncOperationPending(app_id)) {
- callback.Run(GCMClient::ASYNC_OPERATION_PENDING);
+ callback.Run(RESULT_ASYNC_OPERATION_PENDING);
return;
}
@@ -566,15 +566,15 @@ void GCMService::DoUnregister(const std::string& app_id) {
void GCMService::Send(const std::string& app_id,
const std::string& receiver_id,
- const GCMClient::OutgoingMessage& message,
+ const OutgoingMessage& message,
SendCallback callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(!app_id.empty());
DCHECK(!receiver_id.empty());
DCHECK(!callback.is_null());
- GCMClient::Result result = EnsureAppReady(app_id);
- if (result != GCMClient::SUCCESS) {
+ Result result = EnsureAppReady(app_id);
+ if (result != RESULT_SUCCESS) {
callback.Run(std::string(), result);
return;
}
@@ -582,7 +582,7 @@ void GCMService::Send(const std::string& app_id,
// If the message with send ID is still in progress, bail out.
std::pair<std::string, std::string> key(app_id, message.id);
if (send_callbacks_.find(key) != send_callbacks_.end()) {
- callback.Run(message.id, GCMClient::INVALID_PARAMETER);
+ callback.Run(message.id, RESULT_INVALID_PARAMETER);
return;
}
@@ -603,7 +603,7 @@ void GCMService::Send(const std::string& app_id,
void GCMService::DoSend(const std::string& app_id,
const std::string& receiver_id,
- const GCMClient::OutgoingMessage& message) {
+ const OutgoingMessage& message) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
content::BrowserThread::PostTask(
content::BrowserThread::IO,
@@ -723,16 +723,16 @@ void GCMService::CheckOut() {
base::Unretained(io_worker_.get())));
}
-GCMClient::Result GCMService::EnsureAppReady(const std::string& app_id) {
+Result GCMService::EnsureAppReady(const std::string& app_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
// Ensure that check-in has been done.
EnsureLoaded();
// If the service was not started, bail out.
if (account_id_.empty())
- return GCMClient::NOT_SIGNED_IN;
+ return RESULT_NOT_SIGNED_IN;
- return GCMClient::SUCCESS;
+ return RESULT_SUCCESS;
}
bool GCMService::IsAsyncOperationPending(const std::string& app_id) const {
@@ -743,7 +743,7 @@ bool GCMService::IsAsyncOperationPending(const std::string& app_id) const {
void GCMService::RegisterFinished(const std::string& app_id,
const std::string& registration_id,
- GCMClient::Result result) {
+ Result result) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
std::map<std::string, RegisterCallback>::iterator callback_iter =
@@ -759,7 +759,7 @@ void GCMService::RegisterFinished(const std::string& app_id,
}
void GCMService::UnregisterFinished(const std::string& app_id,
- GCMClient::Result result) {
+ Result result) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
std::map<std::string, UnregisterCallback>::iterator callback_iter =
@@ -774,7 +774,7 @@ void GCMService::UnregisterFinished(const std::string& app_id,
void GCMService::SendFinished(const std::string& app_id,
const std::string& message_id,
- GCMClient::Result result) {
+ Result result) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
std::map<std::pair<std::string, std::string>, SendCallback>::iterator
@@ -791,7 +791,7 @@ void GCMService::SendFinished(const std::string& app_id,
}
void GCMService::MessageReceived(const std::string& app_id,
- GCMClient::IncomingMessage message) {
+ IncomingMessage message) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
// Drop the event if signed out.
@@ -813,7 +813,7 @@ void GCMService::MessagesDeleted(const std::string& app_id) {
void GCMService::MessageSendError(
const std::string& app_id,
- const GCMClient::SendErrorDetails& send_error_details) {
+ const SendErrorDetails& send_error_details) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
// Drop the event if signed out.
« no previous file with comments | « chrome/browser/services/gcm/gcm_service.h ('k') | chrome/browser/services/gcm/gcm_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698