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

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

Issue 580513002: Add support for gcm_sender_id in Manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest_start_url
Patch Set: add gcm_sender_id to ipc traits Created 6 years, 3 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ipc_manifest.gcm_sender_id = base::NullableString16(
63 ipc_manifest.gcm_sender_id.string().substr(
64 0, Manifest::kMaxIPCStringLength),
65 ipc_manifest.gcm_sender_id.is_null());
62 66
63 Send(new ManifestManagerHostMsg_RequestManifestResponse( 67 Send(new ManifestManagerHostMsg_RequestManifestResponse(
64 routing_id(), request_id, ipc_manifest)); 68 routing_id(), request_id, ipc_manifest));
65 } 69 }
66 70
67 void ManifestManager::GetManifest(const GetManifestCallback& callback) { 71 void ManifestManager::GetManifest(const GetManifestCallback& callback) {
68 if (!may_have_manifest_) { 72 if (!may_have_manifest_) {
69 callback.Run(Manifest()); 73 callback.Run(Manifest());
70 return; 74 return;
71 } 75 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 137
134 pending_callbacks_.clear(); 138 pending_callbacks_.clear();
135 139
136 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); 140 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin();
137 it != callbacks.end(); ++it) { 141 it != callbacks.end(); ++it) {
138 it->Run(manifest); 142 it->Run(manifest);
139 } 143 }
140 } 144 }
141 145
142 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698