tor-browser

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

event_win.h (1445B)


      1 // Copyright 2022 The Chromium Authors.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_ANALYSIS_AGENT_SRC_EVENT_WIN_H_
      6 #define CONTENT_ANALYSIS_AGENT_SRC_EVENT_WIN_H_
      7 
      8 #include <windows.h>
      9 
     10 #include "event_base.h"
     11 
     12 namespace content_analysis {
     13 namespace sdk {
     14 
     15 // ContentAnalysisEvent implementaton for Windows.
     16 class ContentAnalysisEventWin : public ContentAnalysisEventBase {
     17 public:
     18  ContentAnalysisEventWin(HANDLE handle,
     19                          const BrowserInfo& browser_info,
     20                          ContentAnalysisRequest request);
     21  ~ContentAnalysisEventWin() override;
     22 
     23  // Initialize the event.  This involves reading the request from Google
     24  // Chrome and making sure it is well formed.
     25  ResultCode Init();
     26 
     27  // ContentAnalysisEvent:
     28  ResultCode Close() override;
     29  ResultCode Send() override;
     30  std::string DebugString() const override;
     31  std::string SerializeStringToSendToBrowser() {
     32    return agent_to_chrome()->SerializeAsString();
     33  }
     34  void SetResponseSent() { response_sent_ = true; }
     35  
     36  HANDLE Pipe() const { return hPipe_; }
     37 
     38 private:
     39  void Shutdown();
     40 
     41  // This handle is not owned by the event.
     42  HANDLE hPipe_ = INVALID_HANDLE_VALUE;
     43 
     44  // Set to true when Send() is called the first time.
     45  bool response_sent_ = false;
     46 };
     47 
     48 }  // namespace sdk
     49 }  // namespace content_analysis
     50 
     51 #endif  // CONTENT_ANALYSIS_AGENT_SRC_EVENT_WIN_H_