tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

file_sink.h (692B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef FILE_SINK_H
      6 #define FILE_SINK_H
      7 
      8 #include <nsWindowsHelpers.h>
      9 #include <string>
     10 #include <windows.h>
     11 #include "data_sink.h"
     12 
     13 class FileSink : public DataSink {
     14 public:
     15  // Open the download receiver
     16  bool open(std::wstring& filename);
     17  // Send data to the download receiver
     18  bool accept(char* buf, int bytesToWrite) override;
     19  // Make our handle read-only so we can run the file
     20  bool freeze();
     21 
     22 private:
     23  nsAutoHandle fileHandle;
     24  std::wstring mFilename;
     25 };
     26 
     27 #endif