| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 ipc_manifest.short_name = base::NullableString16( | 58 ipc_manifest.short_name = base::NullableString16( |
| 59 ipc_manifest.short_name.string().substr(0, | 59 ipc_manifest.short_name.string().substr(0, |
| 60 Manifest::kMaxIPCStringLength), | 60 Manifest::kMaxIPCStringLength), |
| 61 ipc_manifest.short_name.is_null()); | 61 ipc_manifest.short_name.is_null()); |
| 62 for (size_t i = 0; i < ipc_manifest.icons.size(); ++i) { | 62 for (size_t i = 0; i < ipc_manifest.icons.size(); ++i) { |
| 63 ipc_manifest.icons[i].type = base::NullableString16( | 63 ipc_manifest.icons[i].type = base::NullableString16( |
| 64 ipc_manifest.icons[i].type.string().substr( | 64 ipc_manifest.icons[i].type.string().substr( |
| 65 0, Manifest::kMaxIPCStringLength), | 65 0, Manifest::kMaxIPCStringLength), |
| 66 ipc_manifest.icons[i].type.is_null()); | 66 ipc_manifest.icons[i].type.is_null()); |
| 67 } | 67 } |
| 68 ipc_manifest.gcm_sender_id = base::NullableString16( |
| 69 ipc_manifest.gcm_sender_id.string().substr( |
| 70 0, Manifest::kMaxIPCStringLength), |
| 71 ipc_manifest.gcm_sender_id.is_null()); |
| 68 | 72 |
| 69 Send(new ManifestManagerHostMsg_RequestManifestResponse( | 73 Send(new ManifestManagerHostMsg_RequestManifestResponse( |
| 70 routing_id(), request_id, ipc_manifest)); | 74 routing_id(), request_id, ipc_manifest)); |
| 71 } | 75 } |
| 72 | 76 |
| 73 void ManifestManager::GetManifest(const GetManifestCallback& callback) { | 77 void ManifestManager::GetManifest(const GetManifestCallback& callback) { |
| 74 if (!may_have_manifest_) { | 78 if (!may_have_manifest_) { |
| 75 callback.Run(Manifest()); | 79 callback.Run(Manifest()); |
| 76 return; | 80 return; |
| 77 } | 81 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 143 |
| 140 pending_callbacks_.clear(); | 144 pending_callbacks_.clear(); |
| 141 | 145 |
| 142 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); | 146 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); |
| 143 it != callbacks.end(); ++it) { | 147 it != callbacks.end(); ++it) { |
| 144 it->Run(manifest); | 148 it->Run(manifest); |
| 145 } | 149 } |
| 146 } | 150 } |
| 147 | 151 |
| 148 } // namespace content | 152 } // namespace content |
| OLD | NEW |