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.
14STDMETHODIMP 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.
33STDMETHODIMP ChromeProtocol::Continue(PROTOCOLDATA* protocol_data) {
34  DVLOG(1) << __FUNCTION__;
35  return S_OK;
36}
37
38// Aborts an operation in progress.
39STDMETHODIMP ChromeProtocol::Abort(HRESULT reason, DWORD options) {
40  DVLOG(1) << __FUNCTION__;
41  return S_OK;
42}
43
44STDMETHODIMP ChromeProtocol::Terminate(DWORD options) {
45  DVLOG(1) << __FUNCTION__;
46  return S_OK;
47}
48
49STDMETHODIMP ChromeProtocol::Suspend() {
50  return E_NOTIMPL;
51}
52STDMETHODIMP ChromeProtocol::Resume() {
53  return E_NOTIMPL;
54}
55
56// Reads data retrieved by the pluggable protocol handler.
57STDMETHODIMP 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.
65STDMETHODIMP 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.
74STDMETHODIMP 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.
81STDMETHODIMP ChromeProtocol::UnlockRequest() {
82  DVLOG(1) << __FUNCTION__;
83  return S_OK;
84}
85