diff options
Diffstat (limited to 'ceee/ie/plugin/bho/events_funnel.h')
-rw-r--r-- | ceee/ie/plugin/bho/events_funnel.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/ceee/ie/plugin/bho/events_funnel.h b/ceee/ie/plugin/bho/events_funnel.h index 2fcc19f..1d107e8 100644 --- a/ceee/ie/plugin/bho/events_funnel.h +++ b/ceee/ie/plugin/bho/events_funnel.h @@ -11,17 +11,19 @@ #include <windows.h> #include "base/basictypes.h" +#include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "ceee/ie/broker/broker_rpc_client.h" class Value; -class BrokerRpcClient; - // Defines a base class for sending events to the Broker. class EventsFunnel { protected: - EventsFunnel(); - virtual ~EventsFunnel(); + explicit EventsFunnel(IEventSender* client) : broker_client_(client) {} + EventsFunnel() : broker_client_(NULL) {} + + virtual ~EventsFunnel() {} // Send the given event to the Broker. // @param event_name The name of the event. @@ -29,14 +31,20 @@ class EventsFunnel { // protected virtual for testability... virtual HRESULT SendEvent(const char* event_name, const Value& event_args); + public: + virtual void AssignEventSender(IEventSender* client) { + broker_client_ = client; + } + protected: virtual HRESULT SendEventToBroker(const char* event_name, const char* event_args); private: - // Pointer to broker client. If is not NULL attempt to connect was performed - // and new attempts are not nessesary. - scoped_ptr<BrokerRpcClient> broker_rpc_client_; + // We're not responsible to send things to the broker directly. There is a + // client (which can be BrokerRpcClient, or not). The client should always + // outlive this class. + IEventSender* broker_client_; DISALLOW_COPY_AND_ASSIGN(EventsFunnel); }; |