OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Funnel of Chrome Extension Events from whereever through the Broker. | 5 // Funnel of Chrome Extension Events from whereever through the Broker. |
6 | 6 |
7 #include "ceee/ie/plugin/bho/webrequest_events_funnel.h" | 7 #include "ceee/ie/plugin/bho/webrequest_events_funnel.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 HRESULT WebRequestEventsFunnel::OnBeforeRedirect(int request_id, | 23 HRESULT WebRequestEventsFunnel::OnBeforeRedirect(int request_id, |
24 const wchar_t* url, | 24 const wchar_t* url, |
25 DWORD status_code, | 25 DWORD status_code, |
26 const wchar_t* redirect_url, | 26 const wchar_t* redirect_url, |
27 const base::Time& time_stamp) { | 27 const base::Time& time_stamp) { |
28 DictionaryValue args; | 28 DictionaryValue args; |
29 args.SetInteger(keys::kRequestIdKey, request_id); | 29 args.SetInteger(keys::kRequestIdKey, request_id); |
30 args.SetString(keys::kUrlKey, url); | 30 args.SetString(keys::kUrlKey, url); |
31 args.SetInteger(keys::kStatusCodeKey, status_code); | 31 args.SetInteger(keys::kStatusCodeKey, status_code); |
32 args.SetString(keys::kRedirectUrlKey, redirect_url); | 32 args.SetString(keys::kRedirectUrlKey, redirect_url); |
33 args.SetReal(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); | 33 args.SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); |
34 | 34 |
35 return SendEvent(keys::kOnBeforeRedirect, args); | 35 return SendEvent(keys::kOnBeforeRedirect, args); |
36 } | 36 } |
37 | 37 |
38 HRESULT WebRequestEventsFunnel::OnBeforeRequest(int request_id, | 38 HRESULT WebRequestEventsFunnel::OnBeforeRequest(int request_id, |
39 const wchar_t* url, | 39 const wchar_t* url, |
40 const char* method, | 40 const char* method, |
41 CeeeWindowHandle tab_handle, | 41 CeeeWindowHandle tab_handle, |
42 const char* type, | 42 const char* type, |
43 const base::Time& time_stamp) { | 43 const base::Time& time_stamp) { |
44 DictionaryValue args; | 44 DictionaryValue args; |
45 args.SetInteger(keys::kRequestIdKey, request_id); | 45 args.SetInteger(keys::kRequestIdKey, request_id); |
46 args.SetString(keys::kUrlKey, url); | 46 args.SetString(keys::kUrlKey, url); |
47 args.SetString(keys::kMethodKey, method); | 47 args.SetString(keys::kMethodKey, method); |
48 args.SetInteger(keys::kTabIdKey, static_cast<int>(tab_handle)); | 48 args.SetInteger(keys::kTabIdKey, static_cast<int>(tab_handle)); |
49 args.SetString(keys::kTypeKey, type); | 49 args.SetString(keys::kTypeKey, type); |
50 args.SetReal(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); | 50 args.SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); |
51 | 51 |
52 return SendEvent(keys::kOnBeforeRequest, args); | 52 return SendEvent(keys::kOnBeforeRequest, args); |
53 } | 53 } |
54 | 54 |
55 HRESULT WebRequestEventsFunnel::OnCompleted(int request_id, | 55 HRESULT WebRequestEventsFunnel::OnCompleted(int request_id, |
56 const wchar_t* url, | 56 const wchar_t* url, |
57 DWORD status_code, | 57 DWORD status_code, |
58 const base::Time& time_stamp) { | 58 const base::Time& time_stamp) { |
59 DictionaryValue args; | 59 DictionaryValue args; |
60 args.SetInteger(keys::kRequestIdKey, request_id); | 60 args.SetInteger(keys::kRequestIdKey, request_id); |
61 args.SetString(keys::kUrlKey, url); | 61 args.SetString(keys::kUrlKey, url); |
62 args.SetInteger(keys::kStatusCodeKey, status_code); | 62 args.SetInteger(keys::kStatusCodeKey, status_code); |
63 args.SetReal(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); | 63 args.SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); |
64 | 64 |
65 return SendEvent(keys::kOnCompleted, args); | 65 return SendEvent(keys::kOnCompleted, args); |
66 } | 66 } |
67 | 67 |
68 HRESULT WebRequestEventsFunnel::OnErrorOccurred(int request_id, | 68 HRESULT WebRequestEventsFunnel::OnErrorOccurred(int request_id, |
69 const wchar_t* url, | 69 const wchar_t* url, |
70 const wchar_t* error, | 70 const wchar_t* error, |
71 const base::Time& time_stamp) { | 71 const base::Time& time_stamp) { |
72 DictionaryValue args; | 72 DictionaryValue args; |
73 args.SetInteger(keys::kRequestIdKey, request_id); | 73 args.SetInteger(keys::kRequestIdKey, request_id); |
74 args.SetString(keys::kUrlKey, url); | 74 args.SetString(keys::kUrlKey, url); |
75 args.SetString(keys::kErrorKey, error); | 75 args.SetString(keys::kErrorKey, error); |
76 args.SetReal(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); | 76 args.SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); |
77 | 77 |
78 return SendEvent(keys::kOnErrorOccurred, args); | 78 return SendEvent(keys::kOnErrorOccurred, args); |
79 } | 79 } |
80 | 80 |
81 HRESULT WebRequestEventsFunnel::OnHeadersReceived( | 81 HRESULT WebRequestEventsFunnel::OnHeadersReceived( |
82 int request_id, | 82 int request_id, |
83 const wchar_t* url, | 83 const wchar_t* url, |
84 DWORD status_code, | 84 DWORD status_code, |
85 const base::Time& time_stamp) { | 85 const base::Time& time_stamp) { |
86 DictionaryValue args; | 86 DictionaryValue args; |
87 args.SetInteger(keys::kRequestIdKey, request_id); | 87 args.SetInteger(keys::kRequestIdKey, request_id); |
88 args.SetString(keys::kUrlKey, url); | 88 args.SetString(keys::kUrlKey, url); |
89 args.SetInteger(keys::kStatusCodeKey, status_code); | 89 args.SetInteger(keys::kStatusCodeKey, status_code); |
90 args.SetReal(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); | 90 args.SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); |
91 | 91 |
92 return SendEvent(keys::kOnHeadersReceived, args); | 92 return SendEvent(keys::kOnHeadersReceived, args); |
93 } | 93 } |
94 | 94 |
95 HRESULT WebRequestEventsFunnel::OnRequestSent(int request_id, | 95 HRESULT WebRequestEventsFunnel::OnRequestSent(int request_id, |
96 const wchar_t* url, | 96 const wchar_t* url, |
97 const char* ip, | 97 const char* ip, |
98 const base::Time& time_stamp) { | 98 const base::Time& time_stamp) { |
99 DictionaryValue args; | 99 DictionaryValue args; |
100 args.SetInteger(keys::kRequestIdKey, request_id); | 100 args.SetInteger(keys::kRequestIdKey, request_id); |
101 args.SetString(keys::kUrlKey, url); | 101 args.SetString(keys::kUrlKey, url); |
102 args.SetString(keys::kIpKey, ip); | 102 args.SetString(keys::kIpKey, ip); |
103 args.SetReal(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); | 103 args.SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(time_stamp)); |
104 | 104 |
105 return SendEvent(keys::kOnRequestSent, args); | 105 return SendEvent(keys::kOnRequestSent, args); |
106 } | 106 } |
OLD | NEW |