• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2009 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 // Implementation of ChromeProtocol
6 #include "chrome_frame/chrome_protocol.h"
7 
8 #include "base/logging.h"
9 #include "chrome_frame/utils.h"
10 
11 // ChromeProtocol
12 
13 // Starts the class associated with the asynchronous pluggable protocol.
Start(LPCWSTR url,IInternetProtocolSink * prot_sink,IInternetBindInfo * bind_info,DWORD flags,DWORD reserved)14 STDMETHODIMP ChromeProtocol::Start(LPCWSTR url,
15                                    IInternetProtocolSink* prot_sink,
16                                    IInternetBindInfo* bind_info,
17                                    DWORD flags,
18                                    DWORD reserved) {
19   DVLOG(1) << __FUNCTION__ << ": URL = " << url;
20   prot_sink->ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
21                             kChromeMimeType);
22   prot_sink->ReportData(
23       BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION |
24       BSCF_DATAFULLYAVAILABLE,
25       0,
26       0);
27   return S_OK;
28 }
29 
30 // Allows the pluggable protocol handler to continue processing data on the
31 // apartment (or user interface) thread. This method is called in response
32 // to a call to IInternetProtocolSink::Switch.
Continue(PROTOCOLDATA * protocol_data)33 STDMETHODIMP ChromeProtocol::Continue(PROTOCOLDATA* protocol_data) {
34   DVLOG(1) << __FUNCTION__;
35   return S_OK;
36 }
37 
38 // Aborts an operation in progress.
Abort(HRESULT reason,DWORD options)39 STDMETHODIMP ChromeProtocol::Abort(HRESULT reason, DWORD options) {
40   DVLOG(1) << __FUNCTION__;
41   return S_OK;
42 }
43 
Terminate(DWORD options)44 STDMETHODIMP ChromeProtocol::Terminate(DWORD options) {
45   DVLOG(1) << __FUNCTION__;
46   return S_OK;
47 }
48 
Suspend()49 STDMETHODIMP ChromeProtocol::Suspend() {
50   return E_NOTIMPL;
51 }
Resume()52 STDMETHODIMP ChromeProtocol::Resume() {
53   return E_NOTIMPL;
54 }
55 
56 // Reads data retrieved by the pluggable protocol handler.
Read(void * buffer,ULONG buffer_size_in_bytes,ULONG * bytes_read)57 STDMETHODIMP ChromeProtocol::Read(void* buffer,
58                                   ULONG buffer_size_in_bytes,
59                                   ULONG* bytes_read) {
60   DVLOG(1) << __FUNCTION__;
61   return S_FALSE;
62 }
63 
64 // Moves the current seek offset.
Seek(LARGE_INTEGER move_by,DWORD origin,ULARGE_INTEGER * new_position)65 STDMETHODIMP ChromeProtocol::Seek(LARGE_INTEGER move_by,
66                               DWORD origin,
67                               ULARGE_INTEGER* new_position) {
68   DVLOG(1) << __FUNCTION__;
69   return E_NOTIMPL;
70 }
71 
72 // Locks the request so that IInternetProtocolRoot::Terminate ()
73 // can be called and the remaining data can be read.
LockRequest(DWORD options)74 STDMETHODIMP ChromeProtocol::LockRequest(DWORD options) {
75   DVLOG(1) << __FUNCTION__;
76   return S_OK;
77 }
78 
79 // Frees any resources associated with a lock. Called only if
80 // IInternetProtocol::LockRequest () was called.
UnlockRequest()81 STDMETHODIMP ChromeProtocol::UnlockRequest() {
82   DVLOG(1) << __FUNCTION__;
83   return S_OK;
84 }
85