summaryrefslogtreecommitdiffstats
path: root/ceee/ie/plugin/bho/webrequest_events_funnel.h
blob: 55879cc7c6bbde012595d9e5320d641dfca2018b (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Copyright (c) 2010 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.
//
// Funnel of Chrome Extension Web Request Events.

#ifndef CEEE_IE_PLUGIN_BHO_WEBREQUEST_EVENTS_FUNNEL_H_
#define CEEE_IE_PLUGIN_BHO_WEBREQUEST_EVENTS_FUNNEL_H_

#include <atlcomcli.h>

#include "base/time.h"
#include "ceee/ie/plugin/bho/events_funnel.h"

#include "toolband.h"  // NOLINT

// Implements a set of methods to send web request related events to the
// Broker.
class WebRequestEventsFunnel : public EventsFunnel {
 public:
  WebRequestEventsFunnel() : EventsFunnel(false) {}

  // Sends the webRequest.onBeforeRedirect event to the broker.
  // @param request_id The ID of the request.
  // @param url The URL of the current request.
  // @param status_code Standard HTTP status code returned by the server.
  // @param redirect_url The new URL.
  // @param time_stamp The time when the browser was about to make the redirect.
  virtual HRESULT OnBeforeRedirect(int request_id,
                                   const wchar_t* url,
                                   DWORD status_code,
                                   const wchar_t* redirect_url,
                                   const base::Time& time_stamp);

  // Sends the webRequest.onBeforeRequest event to the broker.
  // @param request_id The ID of the request.
  // @param url The URL of the request.
  // @param method Standard HTTP method, such as "GET" or "POST".
  // @param tab_handle The window handle of the tab in which the request takes
  //        place. Set to INVALID_HANDLE_VALUE if the request isn't related to a
  //        tab.
  // @param type How the requested resource will be used, such as "main_frame"
  //        or "sub_frame". Please find the complete list and explanation on
  //        http://www.chromium.org/developers/design-documents/extensions/notifications-of-web-request-and-navigation
  // @param time_stamp The time when the browser was about to make the request.
  virtual HRESULT OnBeforeRequest(int request_id,
                                  const wchar_t* url,
                                  const char* method,
                                  CeeeWindowHandle tab_handle,
                                  const char* type,
                                  const base::Time& time_stamp);

  // Sends the webRequest.onCompleted event to the broker.
  // @param request_id The ID of the request.
  // @param url The URL of the request.
  // @param status_code Standard HTTP status code returned by the server.
  // @param time_stamp The time when the response was received completely.
  virtual HRESULT OnCompleted(int request_id,
                              const wchar_t* url,
                              DWORD status_code,
                              const base::Time& time_stamp);

  // Sends the webRequest.onErrorOccurred event to the broker.
  // @param request_id The ID of the request.
  // @param url The URL of the request.
  // @param error The error description.
  // @param time_stamp The time when the error occurred.
  virtual HRESULT OnErrorOccurred(int request_id,
                                  const wchar_t* url,
                                  const wchar_t* error,
                                  const base::Time& time_stamp);

  // Sends the webRequest.onHeadersReceived event to the broker.
  // @param request_id The ID of the request.
  // @param url The URL of the request.
  // @param status_code Standard HTTP status code returned by the server.
  // @param time_stamp The time when the status line and response headers were
  //        received.
  virtual HRESULT OnHeadersReceived(int request_id,
                                    const wchar_t* url,
                                    DWORD status_code,
                                    const base::Time& time_stamp);

  // Sends the webRequest.onRequestSent event to the broker.
  // @param request_id The ID of the request.
  // @param url The URL of the request.
  // @param ip The server IP address that is actually connected to.
  // @param time_stamp The time when the browser finished sending the request.
  virtual HRESULT OnRequestSent(int request_id,
                                const wchar_t* url,
                                const char* ip,
                                const base::Time& time_stamp);

 private:
  DISALLOW_COPY_AND_ASSIGN(WebRequestEventsFunnel);
};

#endif  // CEEE_IE_PLUGIN_BHO_WEBREQUEST_EVENTS_FUNNEL_H_