| OLD | NEW |
| 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 "content/browser/manifest/manifest_manager_host.h" | 5 #include "content/browser/manifest/manifest_manager_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/common/manifest_manager_messages.h" | 10 #include "content/common/manifest_manager_messages.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 0, Manifest::kMaxIPCStringLength), | 134 0, Manifest::kMaxIPCStringLength), |
| 135 manifest.gcm_sender_id.is_null()); | 135 manifest.gcm_sender_id.is_null()); |
| 136 for (auto& related_application : manifest.related_applications) { | 136 for (auto& related_application : manifest.related_applications) { |
| 137 if (!related_application.url.is_valid()) | 137 if (!related_application.url.is_valid()) |
| 138 related_application.url = GURL(); | 138 related_application.url = GURL(); |
| 139 related_application.id = | 139 related_application.id = |
| 140 base::NullableString16(related_application.id.string().substr( | 140 base::NullableString16(related_application.id.string().substr( |
| 141 0, Manifest::kMaxIPCStringLength), | 141 0, Manifest::kMaxIPCStringLength), |
| 142 related_application.id.is_null()); | 142 related_application.id.is_null()); |
| 143 } | 143 } |
| 144 // theme_color and background_color are 32 bit unsigned integers with 64 bit | |
| 145 // integers simply being used to encode the occurence of an error. Therefore, | |
| 146 // any value outside the range of a 32 bit integer is invalid. | |
| 147 if (manifest.theme_color < std::numeric_limits<int32_t>::min() || | |
| 148 manifest.theme_color > std::numeric_limits<int32_t>::max()) | |
| 149 manifest.theme_color = Manifest::kInvalidOrMissingColor; | |
| 150 if (manifest.background_color < std::numeric_limits<int32_t>::min() || | |
| 151 manifest.background_color > std::numeric_limits<int32_t>::max()) | |
| 152 manifest.background_color = Manifest::kInvalidOrMissingColor; | |
| 153 | 144 |
| 154 callback->Run(manifest_url, manifest); | 145 callback->Run(manifest_url, manifest); |
| 155 callbacks->Remove(request_id); | 146 callbacks->Remove(request_id); |
| 156 if (callbacks->IsEmpty()) { | 147 if (callbacks->IsEmpty()) { |
| 157 delete callbacks; | 148 delete callbacks; |
| 158 pending_get_callbacks_.erase(render_frame_host); | 149 pending_get_callbacks_.erase(render_frame_host); |
| 159 } | 150 } |
| 160 } | 151 } |
| 161 | 152 |
| 162 } // namespace content | 153 } // namespace content |
| OLD | NEW |