Chromium Code Reviews| Index: content/renderer/manifest/manifest_manager.cc |
| diff --git a/content/renderer/manifest/manifest_manager.cc b/content/renderer/manifest/manifest_manager.cc |
| index fda8c835e64796aea0195be181c8254cca309c3d..0b9f5d5725c8764ccaa5d94687ef184c94d7721c 100644 |
| --- a/content/renderer/manifest/manifest_manager.cc |
| +++ b/content/renderer/manifest/manifest_manager.cc |
| @@ -60,7 +60,8 @@ void ManifestManager::OnRequestManifest(int request_id) { |
| } |
| void ManifestManager::OnRequestManifestComplete( |
| - int request_id, const Manifest& manifest) { |
| + int request_id, const Manifest& manifest, |
| + const ManifestDebugInfo&) { |
| // When sent via IPC, the Manifest must follow certain security rules. |
| Manifest ipc_manifest = manifest; |
| ipc_manifest.name = base::NullableString16( |
| @@ -92,12 +93,12 @@ void ManifestManager::OnRequestManifestComplete( |
| void ManifestManager::GetManifest(const GetManifestCallback& callback) { |
| if (!may_have_manifest_) { |
| - callback.Run(Manifest()); |
| + callback.Run(Manifest(), ManifestDebugInfo()); |
| return; |
| } |
| if (!manifest_dirty_) { |
| - callback.Run(manifest_); |
| + callback.Run(manifest_, manifest_debug_info_); |
| return; |
| } |
| @@ -154,21 +155,21 @@ void ManifestManager::OnManifestFetchComplete( |
| } |
| ManifestUmaUtil::FetchSucceeded(); |
| - |
| ManifestParser parser(data, response.url(), document_url); |
| parser.Parse(); |
| fetcher_.reset(); |
| + manifest_debug_info_.raw_data = data; |
| + parser.TakeErrors(&manifest_debug_info_.errors); |
| - for (const std::unique_ptr<ManifestParser::ErrorInfo>& error_info : |
| - parser.errors()) { |
| + for (const auto& error : manifest_debug_info_.errors) { |
| blink::WebConsoleMessage message; |
| message.level = blink::WebConsoleMessage::LevelError; |
| - message.text = blink::WebString::fromUTF8(error_info->error_msg); |
| + message.text = blink::WebString::fromUTF8(error.message); |
| message.url = |
| render_frame()->GetWebFrame()->document().manifestURL().string(); |
| - message.lineNumber = error_info->error_line; |
| - message.columnNumber = error_info->error_column; |
| + message.lineNumber = error.line; |
| + message.columnNumber = error.column; |
| render_frame()->GetWebFrame()->addMessageToConsole(message); |
| } |
| @@ -189,14 +190,12 @@ void ManifestManager::ResolveCallbacks(ResolveState state) { |
| manifest_dirty_ = state != ResolveStateSuccess; |
| - Manifest manifest = manifest_; |
|
dgozman
2016/04/29 02:28:26
Maybe |manifest_| could change during callback, an
pfeldman
2016/04/29 02:36:18
Originally, I did not see how it was possible, but
|
| - std::list<GetManifestCallback> callbacks = pending_callbacks_; |
| - |
| - pending_callbacks_.clear(); |
| + std::list<GetManifestCallback> callbacks; |
| + callbacks.swap(pending_callbacks_); |
| for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); |
| it != callbacks.end(); ++it) { |
| - it->Run(manifest); |
| + it->Run(manifest_, manifest_debug_info_); |
| } |
| } |