| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const GURL& document_url, | 143 const GURL& document_url, |
| 144 const blink::WebURLResponse& response, | 144 const blink::WebURLResponse& response, |
| 145 const std::string& data) { | 145 const std::string& data) { |
| 146 if (response.isNull() && data.empty()) { | 146 if (response.isNull() && data.empty()) { |
| 147 ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_UNSPECIFIED_REASON); | 147 ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_UNSPECIFIED_REASON); |
| 148 ResolveCallbacks(ResolveStateFailure); | 148 ResolveCallbacks(ResolveStateFailure); |
| 149 return; | 149 return; |
| 150 } | 150 } |
| 151 | 151 |
| 152 ManifestUmaUtil::FetchSucceeded(); | 152 ManifestUmaUtil::FetchSucceeded(); |
| 153 ManifestParser parser(data, response.url(), document_url); | 153 GURL response_url = response.url(); |
| 154 base::StringPiece data_piece(data); |
| 155 ManifestParser parser(data_piece, response_url, document_url); |
| 154 parser.Parse(); | 156 parser.Parse(); |
| 155 | 157 |
| 156 fetcher_.reset(); | 158 fetcher_.reset(); |
| 157 manifest_debug_info_.raw_data = data; | 159 manifest_debug_info_.raw_data = data; |
| 158 parser.TakeErrors(&manifest_debug_info_.errors); | 160 parser.TakeErrors(&manifest_debug_info_.errors); |
| 159 | 161 |
| 160 for (const auto& error : manifest_debug_info_.errors) { | 162 for (const auto& error : manifest_debug_info_.errors) { |
| 161 blink::WebConsoleMessage message; | 163 blink::WebConsoleMessage message; |
| 162 message.level = error.critical ? blink::WebConsoleMessage::LevelError : | 164 message.level = error.critical ? blink::WebConsoleMessage::LevelError : |
| 163 blink::WebConsoleMessage::LevelWarning; | 165 blink::WebConsoleMessage::LevelWarning; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 it != callbacks.end(); ++it) { | 203 it != callbacks.end(); ++it) { |
| 202 it->Run(manifest_url_, manifest_, manifest_debug_info_); | 204 it->Run(manifest_url_, manifest_, manifest_debug_info_); |
| 203 } | 205 } |
| 204 } | 206 } |
| 205 | 207 |
| 206 void ManifestManager::OnDestruct() { | 208 void ManifestManager::OnDestruct() { |
| 207 delete this; | 209 delete this; |
| 208 } | 210 } |
| 209 | 211 |
| 210 } // namespace content | 212 } // namespace content |
| OLD | NEW |