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

Side by Side Diff: google_apis/gcm/engine/account_mapping.cc

Issue 2427633005: Improve GCM enum switch type safety (Closed)
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "google_apis/gcm/engine/account_mapping.h" 5 #include "google_apis/gcm/engine/account_mapping.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 19 matching lines...) Expand all
30 std::string StatusToString(AccountMapping::MappingStatus status) { 30 std::string StatusToString(AccountMapping::MappingStatus status) {
31 switch (status) { 31 switch (status) {
32 case AccountMapping::NEW: 32 case AccountMapping::NEW:
33 return kStatusNew; 33 return kStatusNew;
34 case AccountMapping::ADDING: 34 case AccountMapping::ADDING:
35 return kStatusAdding; 35 return kStatusAdding;
36 case AccountMapping::MAPPED: 36 case AccountMapping::MAPPED:
37 return kStatusMapped; 37 return kStatusMapped;
38 case AccountMapping::REMOVING: 38 case AccountMapping::REMOVING:
39 return kStatusRemoving; 39 return kStatusRemoving;
40 default:
41 NOTREACHED();
42 } 40 }
41 NOTREACHED();
43 return std::string(); 42 return std::string();
44 } 43 }
45 44
46 bool StringToStatus(const std::string& status_str, 45 bool StringToStatus(const std::string& status_str,
47 AccountMapping::MappingStatus* status) { 46 AccountMapping::MappingStatus* status) {
48 if (status_str.compare(kStatusAdding) == 0) 47 if (status_str.compare(kStatusAdding) == 0)
49 *status = AccountMapping::ADDING; 48 *status = AccountMapping::ADDING;
50 else if (status_str.compare(kStatusMapped) == 0) 49 else if (status_str.compare(kStatusMapped) == 0)
51 *status = AccountMapping::MAPPED; 50 *status = AccountMapping::MAPPED;
52 else if (status_str.compare(kStatusRemoving) == 0) 51 else if (status_str.compare(kStatusRemoving) == 0)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 121
123 if (values.size() == kSizeWithMessage) 122 if (values.size() == kSizeWithMessage)
124 last_message_id = values[kMessageIdIndex]; 123 last_message_id = values[kMessageIdIndex];
125 else 124 else
126 last_message_id.clear(); 125 last_message_id.clear();
127 126
128 return true; 127 return true;
129 } 128 }
130 129
131 } // namespace gcm 130 } // namespace gcm
OLDNEW
« no previous file with comments | « components/gcm_driver/instance_id/instance_id_impl.cc ('k') | google_apis/gcm/engine/checkin_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698