| 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/renderer/manifest/manifest_manager.h" | 5 #include "content/renderer/manifest/manifest_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
| 9 #include "content/common/manifest_manager_messages.h" | 9 #include "content/common/manifest_manager_messages.h" |
| 10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 for (size_t i = 0; i < ipc_manifest.icons.size(); ++i) { | 64 for (size_t i = 0; i < ipc_manifest.icons.size(); ++i) { |
| 65 ipc_manifest.icons[i].type = base::NullableString16( | 65 ipc_manifest.icons[i].type = base::NullableString16( |
| 66 ipc_manifest.icons[i].type.string().substr( | 66 ipc_manifest.icons[i].type.string().substr( |
| 67 0, Manifest::kMaxIPCStringLength), | 67 0, Manifest::kMaxIPCStringLength), |
| 68 ipc_manifest.icons[i].type.is_null()); | 68 ipc_manifest.icons[i].type.is_null()); |
| 69 } | 69 } |
| 70 ipc_manifest.gcm_sender_id = base::NullableString16( | 70 ipc_manifest.gcm_sender_id = base::NullableString16( |
| 71 ipc_manifest.gcm_sender_id.string().substr( | 71 ipc_manifest.gcm_sender_id.string().substr( |
| 72 0, Manifest::kMaxIPCStringLength), | 72 0, Manifest::kMaxIPCStringLength), |
| 73 ipc_manifest.gcm_sender_id.is_null()); | 73 ipc_manifest.gcm_sender_id.is_null()); |
| 74 for (size_t i = 0; i < ipc_manifest.chrome_related_applications.size(); ++i) { |
| 75 ipc_manifest.chrome_related_applications[i].id = base::NullableString16( |
| 76 ipc_manifest.chrome_related_applications[i].id.string().substr( |
| 77 0, Manifest::kMaxIPCStringLength), |
| 78 ipc_manifest.chrome_related_applications[i].id.is_null()); |
| 79 } |
| 74 | 80 |
| 75 Send(new ManifestManagerHostMsg_RequestManifestResponse( | 81 Send(new ManifestManagerHostMsg_RequestManifestResponse( |
| 76 routing_id(), request_id, ipc_manifest)); | 82 routing_id(), request_id, ipc_manifest)); |
| 77 } | 83 } |
| 78 | 84 |
| 79 void ManifestManager::GetManifest(const GetManifestCallback& callback) { | 85 void ManifestManager::GetManifest(const GetManifestCallback& callback) { |
| 80 if (!may_have_manifest_) { | 86 if (!may_have_manifest_) { |
| 81 callback.Run(Manifest()); | 87 callback.Run(Manifest()); |
| 82 return; | 88 return; |
| 83 } | 89 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 174 |
| 169 pending_callbacks_.clear(); | 175 pending_callbacks_.clear(); |
| 170 | 176 |
| 171 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); | 177 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); |
| 172 it != callbacks.end(); ++it) { | 178 it != callbacks.end(); ++it) { |
| 173 it->Run(manifest); | 179 it->Run(manifest); |
| 174 } | 180 } |
| 175 } | 181 } |
| 176 | 182 |
| 177 } // namespace content | 183 } // namespace content |
| OLD | NEW |