| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 int request_id, const Manifest& manifest) { | 52 int request_id, const Manifest& manifest) { |
| 53 // When sent via IPC, the Manifest must follow certain security rules. | 53 // When sent via IPC, the Manifest must follow certain security rules. |
| 54 Manifest ipc_manifest = manifest; | 54 Manifest ipc_manifest = manifest; |
| 55 ipc_manifest.name = base::NullableString16( | 55 ipc_manifest.name = base::NullableString16( |
| 56 ipc_manifest.name.string().substr(0, Manifest::kMaxIPCStringLength), | 56 ipc_manifest.name.string().substr(0, Manifest::kMaxIPCStringLength), |
| 57 ipc_manifest.name.is_null()); | 57 ipc_manifest.name.is_null()); |
| 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) { |
| 63 ipc_manifest.icons[i].type = base::NullableString16( |
| 64 ipc_manifest.icons[i].type.string().substr( |
| 65 0, Manifest::kMaxIPCStringLength), |
| 66 ipc_manifest.icons[i].type.is_null()); |
| 67 } |
| 62 | 68 |
| 63 Send(new ManifestManagerHostMsg_RequestManifestResponse( | 69 Send(new ManifestManagerHostMsg_RequestManifestResponse( |
| 64 routing_id(), request_id, ipc_manifest)); | 70 routing_id(), request_id, ipc_manifest)); |
| 65 } | 71 } |
| 66 | 72 |
| 67 void ManifestManager::GetManifest(const GetManifestCallback& callback) { | 73 void ManifestManager::GetManifest(const GetManifestCallback& callback) { |
| 68 if (!may_have_manifest_) { | 74 if (!may_have_manifest_) { |
| 69 callback.Run(Manifest()); | 75 callback.Run(Manifest()); |
| 70 return; | 76 return; |
| 71 } | 77 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 139 |
| 134 pending_callbacks_.clear(); | 140 pending_callbacks_.clear(); |
| 135 | 141 |
| 136 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); | 142 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); |
| 137 it != callbacks.end(); ++it) { | 143 it != callbacks.end(); ++it) { |
| 138 it->Run(manifest); | 144 it->Run(manifest); |
| 139 } | 145 } |
| 140 } | 146 } |
| 141 | 147 |
| 142 } // namespace content | 148 } // namespace content |
| OLD | NEW |