| 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 // Defines the CookieAccountant class, which is responsible for observing | 5 // Defines the CookieAccountant class, which is responsible for observing |
| 6 // and recording all cookie-related information generated by a particular | 6 // and recording all cookie-related information generated by a particular |
| 7 // IE browser session. It records and fires cookie change events, it provides | 7 // IE browser session. It records and fires cookie change events, it provides |
| 8 // access to session and persistent cookies. | 8 // access to session and persistent cookies. |
| 9 | 9 |
| 10 #ifndef CEEE_IE_PLUGIN_BHO_COOKIE_ACCOUNTANT_H_ | 10 #ifndef CEEE_IE_PLUGIN_BHO_COOKIE_ACCOUNTANT_H_ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 LPCWSTR lpszURL, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData, | 47 LPCWSTR lpszURL, LPCWSTR lpszCookieName, LPCWSTR lpszCookieData, |
| 48 DWORD dwFlags, DWORD_PTR dwReserved); | 48 DWORD dwFlags, DWORD_PTR dwReserved); |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 // Exposed to subclasses mainly for unit testing purposes; production code | 51 // Exposed to subclasses mainly for unit testing purposes; production code |
| 52 // should use the ProductionCookieAccountant class instead. | 52 // should use the ProductionCookieAccountant class instead. |
| 53 // Since this class has one instance per window, not per tab, we cannot | 53 // Since this class has one instance per window, not per tab, we cannot |
| 54 // queue the events sent to the broker. They don't need to be sent to the BHO | 54 // queue the events sent to the broker. They don't need to be sent to the BHO |
| 55 // because they don't need tab_id anyway. | 55 // because they don't need tab_id anyway. |
| 56 CookieAccountant() | 56 CookieAccountant() |
| 57 : broker_rpc_client_(true), | 57 : cookie_events_funnel_(new BrokerRpcClient(true)), |
| 58 cookie_events_funnel_(&broker_rpc_client_), | |
| 59 patching_wininet_functions_(false) { | 58 patching_wininet_functions_(false) { |
| 60 HRESULT hr = broker_rpc_client_.Connect(true); | |
| 61 DCHECK(SUCCEEDED(hr)); | |
| 62 } | 59 } |
| 63 | 60 |
| 64 virtual ~CookieAccountant(); | 61 virtual ~CookieAccountant(); |
| 65 | 62 |
| 66 // Records the modification or creation of a cookie. Fires off a | 63 // Records the modification or creation of a cookie. Fires off a |
| 67 // cookies.onChanged event to Chrome Frame. | 64 // cookies.onChanged event to Chrome Frame. |
| 68 virtual void RecordCookie( | 65 virtual void RecordCookie( |
| 69 const std::string& url, const std::string& cookie_data, | 66 const std::string& url, const std::string& cookie_data, |
| 70 const base::Time& current_time); | 67 const base::Time& current_time); |
| 71 | 68 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 103 |
| 107 // Sets the cookie expiration date for a script cookie event. | 104 // Sets the cookie expiration date for a script cookie event. |
| 108 void SetScriptCookieExpirationDate( | 105 void SetScriptCookieExpirationDate( |
| 109 const net::CookieMonster::ParsedCookie& parsed_cookie, | 106 const net::CookieMonster::ParsedCookie& parsed_cookie, |
| 110 const base::Time& current_time, | 107 const base::Time& current_time, |
| 111 cookie_api::CookieInfo* cookie); | 108 cookie_api::CookieInfo* cookie); |
| 112 | 109 |
| 113 // Sets the cookie store ID for a script cookie event. | 110 // Sets the cookie store ID for a script cookie event. |
| 114 void SetScriptCookieStoreId(cookie_api::CookieInfo* cookie); | 111 void SetScriptCookieStoreId(cookie_api::CookieInfo* cookie); |
| 115 | 112 |
| 116 // Broker RPC client. | |
| 117 BrokerRpcClient broker_rpc_client_; | |
| 118 | |
| 119 // The funnel for sending cookie events to the broker. | 113 // The funnel for sending cookie events to the broker. |
| 120 CookieEventsFunnel cookie_events_funnel_; | 114 CookieEventsFunnel cookie_events_funnel_; |
| 121 | 115 |
| 122 DISALLOW_COPY_AND_ASSIGN(CookieAccountant); | 116 DISALLOW_COPY_AND_ASSIGN(CookieAccountant); |
| 123 }; | 117 }; |
| 124 | 118 |
| 125 // A singleton that initializes and keeps the CookieAccountant used by | 119 // A singleton that initializes and keeps the CookieAccountant used by |
| 126 // production code. This class is separate so that CookieAccountant can still | 120 // production code. This class is separate so that CookieAccountant can still |
| 127 // be accessed for unit testing. | 121 // be accessed for unit testing. |
| 128 class ProductionCookieAccountant : public CookieAccountant, | 122 class ProductionCookieAccountant : public CookieAccountant, |
| 129 public Singleton<ProductionCookieAccountant> { | 123 public Singleton<ProductionCookieAccountant> { |
| 130 private: | 124 private: |
| 131 // This ensures no construction is possible outside of the class itself. | 125 // This ensures no construction is possible outside of the class itself. |
| 132 friend struct DefaultSingletonTraits<ProductionCookieAccountant>; | 126 friend struct DefaultSingletonTraits<ProductionCookieAccountant>; |
| 133 DISALLOW_IMPLICIT_CONSTRUCTORS(ProductionCookieAccountant); | 127 DISALLOW_IMPLICIT_CONSTRUCTORS(ProductionCookieAccountant); |
| 134 }; | 128 }; |
| 135 | 129 |
| 136 #endif // CEEE_IE_PLUGIN_BHO_COOKIE_ACCOUNTANT_H_ | 130 #endif // CEEE_IE_PLUGIN_BHO_COOKIE_ACCOUNTANT_H_ |
| OLD | NEW |