Home | History | Annotate | Download | only in tray
      1 // Copyright (c) 2012 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 #ifndef ASH_SYSTEM_TRAY_TRAY_EVENT_FILTER_H_
      6 #define ASH_SYSTEM_TRAY_TRAY_EVENT_FILTER_H_
      7 
      8 #include <set>
      9 
     10 #include "base/basictypes.h"
     11 #include "ui/base/events/event.h"
     12 #include "ui/base/events/event_handler.h"
     13 
     14 namespace aura {
     15 class Window;
     16 }
     17 
     18 namespace ash {
     19 namespace internal {
     20 
     21 class TrayBubbleWrapper;
     22 
     23 // Handles events for a tray bubble.
     24 
     25 class TrayEventFilter : public ui::EventHandler {
     26  public:
     27   explicit TrayEventFilter();
     28   virtual ~TrayEventFilter();
     29 
     30   void AddWrapper(TrayBubbleWrapper* wrapper);
     31   void RemoveWrapper(TrayBubbleWrapper* wrapper);
     32 
     33   // Overridden from ui::EventHandler.
     34   virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
     35   virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
     36 
     37  private:
     38   // Returns true if the event is handled.
     39   bool ProcessLocatedEvent(ui::LocatedEvent* event);
     40 
     41   std::set<TrayBubbleWrapper*> wrappers_;
     42 
     43   DISALLOW_COPY_AND_ASSIGN(TrayEventFilter);
     44 };
     45 
     46 }  // namespace internal
     47 }  // namespace ash
     48 
     49 #endif  // ASH_SYSTEM_TRAY_TRAY_EVENT_FILTER_H_
     50