| OLD | NEW |
| 1 /* | 1 // @@REWRITE(insert c-copyright) |
| 2 * Copyright 2009, Google Inc. | 2 // @@REWRITE(delete-start) |
| 3 * All rights reserved. | 3 // Copyright 2008 Google Inc. All Rights Reserved. |
| 4 * | 4 // Author: piman@google.com (Antoine Labour) |
| 5 * Redistribution and use in source and binary forms, with or without | 5 // @@REWRITE(delete-end) |
| 6 * modification, are permitted provided that the following conditions are | |
| 7 * met: | |
| 8 * | |
| 9 * * Redistributions of source code must retain the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer. | |
| 11 * * Redistributions in binary form must reproduce the above | |
| 12 * copyright notice, this list of conditions and the following disclaimer | |
| 13 * in the documentation and/or other materials provided with the | |
| 14 * distribution. | |
| 15 * * Neither the name of Google Inc. nor the names of its | |
| 16 * contributors may be used to endorse or promote products derived from | |
| 17 * this software without specific prior written permission. | |
| 18 * | |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 */ | |
| 31 | |
| 32 | 6 |
| 33 // This file implements the asynchronous file-loading glue. | 7 // This file implements the asynchronous file-loading glue. |
| 34 | 8 |
| 35 #include <algorithm> | 9 #include <algorithm> |
| 36 | 10 |
| 37 #include "plugin/cross/async_loading.h" | 11 #include "plugin/cross/async_loading.h" |
| 38 #include "plugin/cross/o3d_glue.h" | 12 #include "plugin/cross/o3d_glue.h" |
| 39 #include "plugin/cross/stream_manager.h" | 13 #include "plugin/cross/stream_manager.h" |
| 40 #include "core/cross/bitmap.h" | 14 #include "core/cross/bitmap.h" |
| 41 #include "core/cross/error_status.h" | 15 #include "core/cross/error_status.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (texture) { | 74 if (texture) { |
| 101 texture->set_name(request_->uri()); | 75 texture->set_name(request_->uri()); |
| 102 request_->set_texture(texture); | 76 request_->set_texture(texture); |
| 103 } else { | 77 } else { |
| 104 success = false; | 78 success = false; |
| 105 } | 79 } |
| 106 request_->set_error(error_collector.errors()); | 80 request_->set_error(error_collector.errors()); |
| 107 } else { | 81 } else { |
| 108 // No error is passed in from the stream but we MUST have an error | 82 // No error is passed in from the stream but we MUST have an error |
| 109 // for the request to work on the javascript side. | 83 // for the request to work on the javascript side. |
| 110 request_->set_error("Could not download texture. It could be a " | 84 request_->set_error("Could not download texture: " + request_->uri()); |
| 111 "permission-related issue."); | |
| 112 } | 85 } |
| 113 request_->set_success(success); | 86 request_->set_success(success); |
| 114 // Since the standard codes only go far enough to tell us that the download | 87 // Since the standard codes only go far enough to tell us that the download |
| 115 // succeeded, we set the success [and implicitly the done] flags to give the | 88 // succeeded, we set the success [and implicitly the done] flags to give the |
| 116 // rest of the story. | 89 // rest of the story. |
| 117 if (request_->onreadystatechange()) | 90 if (request_->onreadystatechange()) |
| 118 request_->onreadystatechange()->Run(); | 91 request_->onreadystatechange()->Run(); |
| 119 } | 92 } |
| 120 | 93 |
| 121 private: | 94 private: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 187 |
| 215 // If stream is not NULL request may not exist as LoadURL may already have | 188 // If stream is not NULL request may not exist as LoadURL may already have |
| 216 // completed and therefore called the callback which may have freed the | 189 // completed and therefore called the callback which may have freed the |
| 217 // request so we can't set anything on the request here. | 190 // request so we can't set anything on the request here. |
| 218 } | 191 } |
| 219 } | 192 } |
| 220 | 193 |
| 221 } // namespace class_FileRequest | 194 } // namespace class_FileRequest |
| 222 } // namespace namespace_o3d | 195 } // namespace namespace_o3d |
| 223 } // namespace glue | 196 } // namespace glue |
| OLD | NEW |