OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/api/gcm/gcm_api.h" | 5 #include "chrome/browser/extensions/api/gcm/gcm_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 default: | 60 default: |
61 NOTREACHED() << "Unexpected value of result cannot be converted: " | 61 NOTREACHED() << "Unexpected value of result cannot be converted: " |
62 << result; | 62 << result; |
63 } | 63 } |
64 | 64 |
65 // Never reached, but prevents missing return statement warning. | 65 // Never reached, but prevents missing return statement warning. |
66 return ""; | 66 return ""; |
67 } | 67 } |
68 | 68 |
69 bool IsMessageKeyValid(const std::string& key) { | 69 bool IsMessageKeyValid(const std::string& key) { |
70 std::string lower = base::StringToLowerASCII(key); | 70 std::string lower = base::ToLowerASCII(key); |
71 return !key.empty() && | 71 return !key.empty() && |
72 key.compare(0, arraysize(kCollapseKey) - 1, kCollapseKey) != 0 && | 72 key.compare(0, arraysize(kCollapseKey) - 1, kCollapseKey) != 0 && |
73 lower.compare(0, | 73 lower.compare(0, |
74 arraysize(kGoogleRestrictedPrefix) - 1, | 74 arraysize(kGoogleRestrictedPrefix) - 1, |
75 kGoogleRestrictedPrefix) != 0 && | 75 kGoogleRestrictedPrefix) != 0 && |
76 lower.compare(0, | 76 lower.compare(0, |
77 arraysize(kGoogDotRestrictedPrefix), | 77 arraysize(kGoogDotRestrictedPrefix), |
78 kGoogDotRestrictedPrefix) != 0; | 78 kGoogDotRestrictedPrefix) != 0; |
79 } | 79 } |
80 | 80 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 error.error_message = GcmResultToError(send_error_details.result); | 235 error.error_message = GcmResultToError(send_error_details.result); |
236 error.details.additional_properties = send_error_details.additional_data; | 236 error.details.additional_properties = send_error_details.additional_data; |
237 | 237 |
238 scoped_ptr<Event> event( | 238 scoped_ptr<Event> event( |
239 new Event(events::GCM_ON_SEND_ERROR, api::gcm::OnSendError::kEventName, | 239 new Event(events::GCM_ON_SEND_ERROR, api::gcm::OnSendError::kEventName, |
240 api::gcm::OnSendError::Create(error).Pass(), profile_)); | 240 api::gcm::OnSendError::Create(error).Pass(), profile_)); |
241 EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass()); | 241 EventRouter::Get(profile_)->DispatchEventToExtension(app_id, event.Pass()); |
242 } | 242 } |
243 | 243 |
244 } // namespace extensions | 244 } // namespace extensions |
OLD | NEW |