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

Unified Diff: chrome/browser/extensions/api/gcm/gcm_api.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/extensions/api/gcm/gcm_api.h ('k') | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/gcm/gcm_api.cc
diff --git a/chrome/browser/extensions/api/gcm/gcm_api.cc b/chrome/browser/extensions/api/gcm/gcm_api.cc
index 343299c6b39b1acb5f224b7e8c9f66dc65134a0f..a5d7f9095b0564e6a365e9bd756ed3ed0902d0f6 100644
--- a/chrome/browser/extensions/api/gcm/gcm_api.cc
+++ b/chrome/browser/extensions/api/gcm/gcm_api.cc
@@ -35,23 +35,23 @@ const char kServerError[] = "Server error occurred.";
const char kTtlExceeded[] = "Time-to-live exceeded.";
const char kUnknownError[] = "Unknown error occurred.";
-const char* GcmResultToError(gcm::GCMClient::Result result) {
+const char* GcmResultToError(gcm::Result result) {
switch (result) {
- case gcm::GCMClient::SUCCESS:
+ case gcm::RESULT_SUCCESS:
return "";
- case gcm::GCMClient::INVALID_PARAMETER:
+ case gcm::RESULT_INVALID_PARAMETER:
return kInvalidParameter;
- case gcm::GCMClient::NOT_SIGNED_IN:
+ case gcm::RESULT_NOT_SIGNED_IN:
return kNotSignedIn;
- case gcm::GCMClient::ASYNC_OPERATION_PENDING:
+ case gcm::RESULT_ASYNC_OPERATION_PENDING:
return kAsyncOperationPending;
- case gcm::GCMClient::NETWORK_ERROR:
+ case gcm::RESULT_NETWORK_ERROR:
return kNetworkError;
- case gcm::GCMClient::SERVER_ERROR:
+ case gcm::RESULT_SERVER_ERROR:
return kServerError;
- case gcm::GCMClient::TTL_EXCEEDED:
+ case gcm::RESULT_TTL_EXCEEDED:
return kTtlExceeded;
- case gcm::GCMClient::UNKNOWN_ERROR:
+ case gcm::RESULT_UNKNOWN_ERROR:
return kUnknownError;
default:
NOTREACHED() << "Unexpected value of result cannot be converted: "
@@ -120,10 +120,10 @@ bool GcmRegisterFunction::DoWork() {
void GcmRegisterFunction::CompleteFunctionWithResult(
const std::string& registration_id,
- gcm::GCMClient::Result result) {
+ gcm::Result result) {
SetResult(new base::StringValue(registration_id));
SetError(GcmResultToError(result));
- SendResponse(gcm::GCMClient::SUCCESS == result);
+ SendResponse(gcm::RESULT_SUCCESS == result);
}
GcmUnregisterFunction::GcmUnregisterFunction() {}
@@ -139,9 +139,9 @@ bool GcmUnregisterFunction::DoWork() {
}
void GcmUnregisterFunction::CompleteFunctionWithResult(
- gcm::GCMClient::Result result) {
+ gcm::Result result) {
SetError(GcmResultToError(result));
- SendResponse(gcm::GCMClient::SUCCESS == result);
+ SendResponse(gcm::RESULT_SUCCESS == result);
}
GcmSendFunction::GcmSendFunction() {}
@@ -155,7 +155,7 @@ bool GcmSendFunction::DoWork() {
EXTENSION_FUNCTION_VALIDATE(
ValidateMessageData(params->message.data.additional_properties));
- gcm::GCMClient::OutgoingMessage outgoing_message;
+ gcm::OutgoingMessage outgoing_message;
outgoing_message.id = params->message.message_id;
outgoing_message.data = params->message.data.additional_properties;
if (params->message.time_to_live.get())
@@ -172,14 +172,14 @@ bool GcmSendFunction::DoWork() {
void GcmSendFunction::CompleteFunctionWithResult(
const std::string& message_id,
- gcm::GCMClient::Result result) {
+ gcm::Result result) {
SetResult(new base::StringValue(message_id));
SetError(GcmResultToError(result));
- SendResponse(gcm::GCMClient::SUCCESS == result);
+ SendResponse(gcm::RESULT_SUCCESS == result);
}
bool GcmSendFunction::ValidateMessageData(
- const gcm::GCMClient::MessageData& data) const {
+ const gcm::MessageData& data) const {
size_t total_size = 0u;
for (std::map<std::string, std::string>::const_iterator iter = data.begin();
iter != data.end(); ++iter) {
@@ -213,7 +213,7 @@ GcmJsEventRouter::~GcmJsEventRouter() {
void GcmJsEventRouter::OnMessage(
const std::string& app_id,
- const gcm::GCMClient::IncomingMessage& message) {
+ const gcm::IncomingMessage& message) {
api::gcm::OnMessage::Message message_arg;
message_arg.data.additional_properties = message.data;
if (!message.collapse_key.empty())
@@ -236,7 +236,7 @@ void GcmJsEventRouter::OnMessagesDeleted(const std::string& app_id) {
void GcmJsEventRouter::OnSendError(
const std::string& app_id,
- const gcm::GCMClient::SendErrorDetails& send_error_details) {
+ const gcm::SendErrorDetails& send_error_details) {
api::gcm::OnSendError::Error error;
error.message_id.reset(new std::string(send_error_details.message_id));
error.error_message = GcmResultToError(send_error_details.result);
« no previous file with comments | « chrome/browser/extensions/api/gcm/gcm_api.h ('k') | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698