| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return true; | 303 return true; |
| 304 } | 304 } |
| 305 | 305 |
| 306 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 306 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 307 bool StreamManager::NPDownloadStream::URLNotify(NPReason reason) { | 307 bool StreamManager::NPDownloadStream::URLNotify(NPReason reason) { |
| 308 if (finished_callback_.get()) { | 308 if (finished_callback_.get()) { |
| 309 // On failure, run the finished_callback. | 309 // On failure, run the finished_callback. |
| 310 // Note that the streaming case (NP_NORMAL) does not get a file | 310 // Note that the streaming case (NP_NORMAL) does not get a file |
| 311 // so we can't check its size | 311 // so we can't check its size |
| 312 if ((reason != NPRES_DONE) || | 312 if ((reason != NPRES_DONE) || |
| 313 (stream_type_ != NP_NORMAL && file_.size() == 0)) { | 313 (stream_type_ != NP_NORMAL && file_.empty())) { |
| 314 // finished_callback should only be called once. | 314 // finished_callback should only be called once. |
| 315 finished_callback_->Run(this, false, "", ""); | 315 finished_callback_->Run(this, false, "", ""); |
| 316 finished_callback_.reset(NULL); | 316 finished_callback_.reset(NULL); |
| 317 } | 317 } |
| 318 | 318 |
| 319 // Finished callback for streaming case | 319 // Finished callback for streaming case |
| 320 // where SetStreamFile() is not called | 320 // where SetStreamFile() is not called |
| 321 if (reason == NPRES_DONE && stream_type_ == NP_NORMAL) { | 321 if (reason == NPRES_DONE && stream_type_ == NP_NORMAL) { |
| 322 finished_callback_->Run(this, true, "", ""); | 322 finished_callback_->Run(this, true, "", ""); |
| 323 finished_callback_.reset(NULL); | 323 finished_callback_.reset(NULL); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 347 if (write_callback_.get()) { | 347 if (write_callback_.get()) { |
| 348 int32 n = write_callback_->Run(this, offset, len, buffer); | 348 int32 n = write_callback_->Run(this, offset, len, buffer); |
| 349 bytes_received_ += n; | 349 bytes_received_ += n; |
| 350 return n; | 350 return n; |
| 351 } | 351 } |
| 352 | 352 |
| 353 return len; | 353 return len; |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // namespace glue | 356 } // namespace glue |
| OLD | NEW |