| OLD | NEW |
| 1 // Copyright 2014 The Chromium OS Authors. All rights reserved. | 1 // Copyright 2014 The Chromium OS 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 <clocale> | 5 #include <clocale> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 | 7 |
| 8 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
| 9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
| 10 #include "ppapi/cpp/logging.h" | 10 #include "ppapi/cpp/logging.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 volume_iterator iterator = volumes_.find(file_system_id); | 398 volume_iterator iterator = volumes_.find(file_system_id); |
| 399 PP_DCHECK(iterator != | 399 PP_DCHECK(iterator != |
| 400 volumes_.end()); // Should call ReadFile after OpenFile. | 400 volumes_.end()); // Should call ReadFile after OpenFile. |
| 401 | 401 |
| 402 // Passing the entire dictionary because pp::CompletionCallbackFactory | 402 // Passing the entire dictionary because pp::CompletionCallbackFactory |
| 403 // cannot create callbacks with more than 3 parameters. Here we need 4: | 403 // cannot create callbacks with more than 3 parameters. Here we need 4: |
| 404 // request_id, open_request_id, offset and length. | 404 // request_id, open_request_id, offset and length. |
| 405 iterator->second->ReadFile(request_id, var_dict); | 405 iterator->second->ReadFile(request_id, var_dict); |
| 406 } | 406 } |
| 407 | 407 |
| 408 // Requests libarchive to create an archive object for the given compressor_id
. | 408 // Requests minizip to create an archive object for the given compressor_id. |
| 409 void CreateArchive(int compressor_id) { | 409 void CreateArchive(int compressor_id) { |
| 410 Compressor* compressor = | 410 Compressor* compressor = |
| 411 new Compressor(instance_handle_, compressor_id, &message_sender_); | 411 new Compressor(instance_handle_, compressor_id, &message_sender_); |
| 412 if (!compressor->Init()) { | 412 if (!compressor->Init()) { |
| 413 std::stringstream ss; | 413 std::stringstream ss; |
| 414 ss << compressor_id; | 414 ss << compressor_id; |
| 415 message_sender_.SendCompressorError( | 415 message_sender_.SendCompressorError( |
| 416 compressor_id, | 416 compressor_id, |
| 417 "Could not create a compressor for compressor id: " + ss.str() + "."); | 417 "Could not create a compressor for compressor id: " + ss.str() + "."); |
| 418 delete compressor; | 418 delete compressor; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 // The browser keeps a singleton of this module. It calls the | 492 // The browser keeps a singleton of this module. It calls the |
| 493 // CreateInstance() method on the object you return to make instances. There | 493 // CreateInstance() method on the object you return to make instances. There |
| 494 // is one instance per <embed> tag on the page. This is the main binding | 494 // is one instance per <embed> tag on the page. This is the main binding |
| 495 // point for your NaCl module with the browser. | 495 // point for your NaCl module with the browser. |
| 496 Module* CreateModule() { | 496 Module* CreateModule() { |
| 497 std::setlocale(LC_ALL, "en_US.UTF-8"); | 497 std::setlocale(LC_ALL, "en_US.UTF-8"); |
| 498 return new NaclArchiveModule(); | 498 return new NaclArchiveModule(); |
| 499 } | 499 } |
| 500 | 500 |
| 501 } // namespace pp | 501 } // namespace pp |
| OLD | NEW |