| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Having errors while parsing the manifest doesn't mean the manifest parsing | 183 // Having errors while parsing the manifest doesn't mean the manifest parsing |
| 184 // failed. Some properties might have been ignored but some others kept. | 184 // failed. Some properties might have been ignored but some others kept. |
| 185 if (parser.failed()) { | 185 if (parser.failed()) { |
| 186 ResolveCallbacks(ResolveStateFailure); | 186 ResolveCallbacks(ResolveStateFailure); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 | 189 |
| 190 manifest_ = parser.manifest(); | 190 manifest_ = parser.manifest(); |
| 191 manifest_.url = response.url(); |
| 191 ResolveCallbacks(ResolveStateSuccess); | 192 ResolveCallbacks(ResolveStateSuccess); |
| 192 } | 193 } |
| 193 | 194 |
| 194 void ManifestManager::ResolveCallbacks(ResolveState state) { | 195 void ManifestManager::ResolveCallbacks(ResolveState state) { |
| 195 if (state == ResolveStateFailure) | 196 if (state == ResolveStateFailure) |
| 196 manifest_ = Manifest(); | 197 manifest_ = Manifest(); |
| 197 | 198 |
| 198 manifest_dirty_ = state != ResolveStateSuccess; | 199 manifest_dirty_ = state != ResolveStateSuccess; |
| 199 | 200 |
| 200 std::list<GetManifestCallback> callbacks; | 201 std::list<GetManifestCallback> callbacks; |
| 201 callbacks.swap(pending_callbacks_); | 202 callbacks.swap(pending_callbacks_); |
| 202 | 203 |
| 203 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); | 204 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); |
| 204 it != callbacks.end(); ++it) { | 205 it != callbacks.end(); ++it) { |
| 205 it->Run(manifest_, manifest_debug_info_); | 206 it->Run(manifest_, manifest_debug_info_); |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 | 209 |
| 209 void ManifestManager::OnDestruct() { | 210 void ManifestManager::OnDestruct() { |
| 210 delete this; | 211 delete this; |
| 211 } | 212 } |
| 212 | 213 |
| 213 } // namespace content | 214 } // namespace content |
| OLD | NEW |