summaryrefslogtreecommitdiffstats
path: root/chrome_frame/chrome_protocol.h
blob: f89ac70932c84226db2c52d71dc7c0efbc414b8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_FRAME_CHROME_PROTOCOL_H_
#define CHROME_FRAME_CHROME_PROTOCOL_H_

#include <atlbase.h>
#include <atlcom.h>

#include "chrome_frame/chrome_tab.h"
#include "chrome_frame/resource.h"
#include "grit/chrome_frame_resources.h"

// ChromeProtocol
class ATL_NO_VTABLE ChromeProtocol
    : public CComObjectRootEx<CComSingleThreadModel>,
      public CComCoClass<ChromeProtocol, &CLSID_ChromeProtocol>,
      public IInternetProtocol {
 public:
  ChromeProtocol() {
  }
  DECLARE_REGISTRY_RESOURCEID(IDR_CHROMEPROTOCOL)

  BEGIN_COM_MAP(ChromeProtocol)
    COM_INTERFACE_ENTRY(IInternetProtocol)
    COM_INTERFACE_ENTRY(IInternetProtocolRoot)
  END_COM_MAP()

  DECLARE_PROTECT_FINAL_CONSTRUCT()

  HRESULT FinalConstruct() {
    return S_OK;
  }
  void FinalRelease() {
  }

 public:
  // IInternetProtocolRoot
  STDMETHOD(Start)(LPCWSTR url,
                   IInternetProtocolSink* prot_sink,
                   IInternetBindInfo* bind_info,
                   DWORD flags,
                   DWORD reserved);
  STDMETHOD(Continue)(PROTOCOLDATA* protocol_data);
  STDMETHOD(Abort)(HRESULT reason, DWORD options);
  STDMETHOD(Terminate)(DWORD options);
  STDMETHOD(Suspend)();
  STDMETHOD(Resume)();

  // IInternetProtocol based on IInternetProtocolRoot
  STDMETHOD(Read)(void* buffer,
                  ULONG buffer_size_in_bytes,
                  ULONG* bytes_read);
  STDMETHOD(Seek)(LARGE_INTEGER move_by,
                  DWORD origin,
                  ULARGE_INTEGER* new_position);
  STDMETHOD(LockRequest)(DWORD options);
  STDMETHOD(UnlockRequest)(void);
};

#endif  // CHROME_FRAME_CHROME_PROTOCOL_H_