Home | History | Annotate | Download | only in chrome_frame
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      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 CHROME_FRAME_CHROME_PROTOCOL_H_
      6 #define CHROME_FRAME_CHROME_PROTOCOL_H_
      7 
      8 #include <atlbase.h>
      9 #include <atlcom.h>
     10 
     11 #include "chrome_frame/chrome_tab.h"
     12 #include "chrome_frame/resource.h"
     13 #include "grit/chrome_frame_resources.h"
     14 
     15 // ChromeProtocol
     16 class ATL_NO_VTABLE ChromeProtocol
     17     : public CComObjectRootEx<CComSingleThreadModel>,
     18       public CComCoClass<ChromeProtocol, &CLSID_ChromeProtocol>,
     19       public IInternetProtocol {
     20  public:
     21   ChromeProtocol() {
     22   }
     23   DECLARE_REGISTRY_RESOURCEID(IDR_CHROMEPROTOCOL)
     24 
     25   BEGIN_COM_MAP(ChromeProtocol)
     26     COM_INTERFACE_ENTRY(IInternetProtocol)
     27     COM_INTERFACE_ENTRY(IInternetProtocolRoot)
     28   END_COM_MAP()
     29 
     30   DECLARE_PROTECT_FINAL_CONSTRUCT()
     31 
     32   HRESULT FinalConstruct() {
     33     return S_OK;
     34   }
     35   void FinalRelease() {
     36   }
     37 
     38  public:
     39   // IInternetProtocolRoot
     40   STDMETHOD(Start)(LPCWSTR url,
     41                    IInternetProtocolSink* prot_sink,
     42                    IInternetBindInfo* bind_info,
     43                    DWORD flags,
     44                    DWORD reserved);
     45   STDMETHOD(Continue)(PROTOCOLDATA* protocol_data);
     46   STDMETHOD(Abort)(HRESULT reason, DWORD options);
     47   STDMETHOD(Terminate)(DWORD options);
     48   STDMETHOD(Suspend)();
     49   STDMETHOD(Resume)();
     50 
     51   // IInternetProtocol based on IInternetProtocolRoot
     52   STDMETHOD(Read)(void* buffer,
     53                   ULONG buffer_size_in_bytes,
     54                   ULONG* bytes_read);
     55   STDMETHOD(Seek)(LARGE_INTEGER move_by,
     56                   DWORD origin,
     57                   ULARGE_INTEGER* new_position);
     58   STDMETHOD(LockRequest)(DWORD options);
     59   STDMETHOD(UnlockRequest)(void);
     60 };
     61 
     62 #endif  // CHROME_FRAME_CHROME_PROTOCOL_H_
     63