| 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/browser/manifest/manifest_manager_host.h" | 5 #include "content/browser/manifest/manifest_manager_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "content/common/manifest_manager_messages.h" | 10 #include "content/common/manifest_manager_messages.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void ManifestManagerHost::GetManifest(RenderFrameHost* render_frame_host, | 61 void ManifestManagerHost::GetManifest(RenderFrameHost* render_frame_host, |
| 62 const GetManifestCallback& callback) { | 62 const GetManifestCallback& callback) { |
| 63 GetCallbackMap* callbacks = GetCallbackMapForFrame(render_frame_host); | 63 GetCallbackMap* callbacks = GetCallbackMapForFrame(render_frame_host); |
| 64 if (!callbacks) { | 64 if (!callbacks) { |
| 65 callbacks = new GetCallbackMap(); | 65 callbacks = new GetCallbackMap(); |
| 66 pending_get_callbacks_[render_frame_host] = base::WrapUnique(callbacks); | 66 pending_get_callbacks_[render_frame_host] = base::WrapUnique(callbacks); |
| 67 } | 67 } |
| 68 | 68 |
| 69 int request_id = callbacks->Add(new GetManifestCallback(callback)); | 69 int request_id = callbacks->Add( |
| 70 base::MakeUnique<GetManifestCallback>(callback)); |
| 70 | 71 |
| 71 render_frame_host->Send(new ManifestManagerMsg_RequestManifest( | 72 render_frame_host->Send(new ManifestManagerMsg_RequestManifest( |
| 72 render_frame_host->GetRoutingID(), request_id)); | 73 render_frame_host->GetRoutingID(), request_id)); |
| 73 } | 74 } |
| 74 | 75 |
| 75 bool ManifestManagerHost::OnMessageReceived( | 76 bool ManifestManagerHost::OnMessageReceived( |
| 76 const IPC::Message& message, RenderFrameHost* render_frame_host) { | 77 const IPC::Message& message, RenderFrameHost* render_frame_host) { |
| 77 bool handled = true; | 78 bool handled = true; |
| 78 | 79 |
| 79 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(ManifestManagerHost, message, | 80 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(ManifestManagerHost, message, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 manifest.background_color > std::numeric_limits<int32_t>::max()) | 146 manifest.background_color > std::numeric_limits<int32_t>::max()) |
| 146 manifest.background_color = Manifest::kInvalidOrMissingColor; | 147 manifest.background_color = Manifest::kInvalidOrMissingColor; |
| 147 | 148 |
| 148 callback->Run(manifest_url, manifest); | 149 callback->Run(manifest_url, manifest); |
| 149 callbacks->Remove(request_id); | 150 callbacks->Remove(request_id); |
| 150 if (callbacks->IsEmpty()) | 151 if (callbacks->IsEmpty()) |
| 151 pending_get_callbacks_.erase(render_frame_host); | 152 pending_get_callbacks_.erase(render_frame_host); |
| 152 } | 153 } |
| 153 | 154 |
| 154 } // namespace content | 155 } // namespace content |
| OLD | NEW |