Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Side by Side Diff: content/renderer/manifest/manifest_manager.cc

Issue 919293002: Add related_applications field to manifest parser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/common/manifest.cc ('k') | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 int request_id, const Manifest& manifest) { 54 int request_id, const Manifest& manifest) {
55 // When sent via IPC, the Manifest must follow certain security rules. 55 // When sent via IPC, the Manifest must follow certain security rules.
56 Manifest ipc_manifest = manifest; 56 Manifest ipc_manifest = manifest;
57 ipc_manifest.name = base::NullableString16( 57 ipc_manifest.name = base::NullableString16(
58 ipc_manifest.name.string().substr(0, Manifest::kMaxIPCStringLength), 58 ipc_manifest.name.string().substr(0, Manifest::kMaxIPCStringLength),
59 ipc_manifest.name.is_null()); 59 ipc_manifest.name.is_null());
60 ipc_manifest.short_name = base::NullableString16( 60 ipc_manifest.short_name = base::NullableString16(
61 ipc_manifest.short_name.string().substr(0, 61 ipc_manifest.short_name.string().substr(0,
62 Manifest::kMaxIPCStringLength), 62 Manifest::kMaxIPCStringLength),
63 ipc_manifest.short_name.is_null()); 63 ipc_manifest.short_name.is_null());
64 for (size_t i = 0; i < ipc_manifest.icons.size(); ++i) { 64 for (auto& icon : ipc_manifest.icons) {
65 ipc_manifest.icons[i].type = base::NullableString16( 65 icon.type = base::NullableString16(
66 ipc_manifest.icons[i].type.string().substr( 66 icon.type.string().substr(0, Manifest::kMaxIPCStringLength),
67 0, Manifest::kMaxIPCStringLength), 67 icon.type.is_null());
68 ipc_manifest.icons[i].type.is_null());
69 } 68 }
70 ipc_manifest.gcm_sender_id = base::NullableString16( 69 ipc_manifest.gcm_sender_id = base::NullableString16(
71 ipc_manifest.gcm_sender_id.string().substr( 70 ipc_manifest.gcm_sender_id.string().substr(
72 0, Manifest::kMaxIPCStringLength), 71 0, Manifest::kMaxIPCStringLength),
73 ipc_manifest.gcm_sender_id.is_null()); 72 ipc_manifest.gcm_sender_id.is_null());
73 for (auto& related_application : ipc_manifest.related_applications) {
74 related_application.id =
75 base::NullableString16(related_application.id.string().substr(
76 0, Manifest::kMaxIPCStringLength),
77 related_application.id.is_null());
78 }
74 79
75 Send(new ManifestManagerHostMsg_RequestManifestResponse( 80 Send(new ManifestManagerHostMsg_RequestManifestResponse(
76 routing_id(), request_id, ipc_manifest)); 81 routing_id(), request_id, ipc_manifest));
77 } 82 }
78 83
79 void ManifestManager::GetManifest(const GetManifestCallback& callback) { 84 void ManifestManager::GetManifest(const GetManifestCallback& callback) {
80 if (!may_have_manifest_) { 85 if (!may_have_manifest_) {
81 callback.Run(Manifest()); 86 callback.Run(Manifest());
82 return; 87 return;
83 } 88 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 178
174 pending_callbacks_.clear(); 179 pending_callbacks_.clear();
175 180
176 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); 181 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin();
177 it != callbacks.end(); ++it) { 182 it != callbacks.end(); ++it) {
178 it->Run(manifest); 183 it->Run(manifest);
179 } 184 }
180 } 185 }
181 186
182 } // namespace content 187 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/manifest.cc ('k') | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698