Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_browser_frame_view.h |
| =================================================================== |
| --- chrome/browser/ui/panels/panel_browser_frame_view.h (revision 86006) |
| +++ chrome/browser/ui/panels/panel_browser_frame_view.h (working copy) |
| @@ -7,6 +7,7 @@ |
| #pragma once |
| #include "base/gtest_prod_util.h" |
| +#include "base/message_loop.h" |
| #include "base/scoped_ptr.h" |
| #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| #include "chrome/browser/ui/views/tab_icon_view.h" |
| @@ -73,6 +74,30 @@ |
| PAINT_AS_ACTIVE |
| }; |
| + class MouseWatcher : public MessageLoopForUI::Observer { |
|
jennb
2011/05/20 23:13:12
Did you look at using views/mouse_watcher.h? Mous
jianli
2011/05/23 21:21:03
Yes, I've looked at views/mouse_watcher.* to see i
|
| + public: |
| + explicit MouseWatcher(PanelBrowserFrameView* view); |
| + virtual ~MouseWatcher(); |
| + |
| + virtual bool IsCursorInViewBounds() const; |
| + |
| + #if defined(OS_WIN) |
| + virtual void WillProcessMessage(const MSG& msg) OVERRIDE { } |
| + virtual void DidProcessMessage(const MSG& msg) OVERRIDE; |
| + #else |
| + virtual void WillProcessEvent(GdkEvent* event) OVERRIDE { } |
| + virtual void DidProcessEvent(GdkEvent* event) OVERRIDE; |
| + #endif |
| + |
| + private: |
| + void HandleGlobalMouseMoveEvent(); |
| + |
| + PanelBrowserFrameView* view_; |
| + bool in_view_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MouseWatcher); |
| + }; |
| + |
| // Returns the thickness of the entire nonclient left, right, and bottom |
| // borders, including both the window frame and any client edge. |
| int NonClientBorderThickness() const; |
| @@ -88,6 +113,20 @@ |
| void PaintFrameBorder(gfx::Canvas* canvas); |
| void PaintClientEdge(gfx::Canvas* canvas); |
| + // Called by MouseWatcher to notify if the mouse enters or leaves the window. |
| + void OnMouseEnterOrLeaveWindow(bool mouse_entered); |
| + |
| + // Make info button visible if either of the conditions is met: |
| + // 1) The panel is active, i.e. having focus. |
| + // 2) The mouse is over the panel. |
| + void UpdateInfoButtonVisibility(bool active, bool cursor_in_view); |
| + |
| +#ifdef UNIT_TEST |
| + void set_mouse_watcher(MouseWatcher* mouse_watcher) { |
| + mouse_watcher_.reset(mouse_watcher); |
| + } |
| +#endif |
| + |
| // The frame that hosts this view. This is a weak reference such that frame_ |
| // will always be valid in the lifetime of this view. |
| BrowserFrame* frame_; |
| @@ -103,6 +142,7 @@ |
| TabIconView* title_icon_; |
| views::Label* title_label_; |
| gfx::Rect client_view_bounds_; |
| + scoped_ptr<MouseWatcher> mouse_watcher_; |
| DISALLOW_COPY_AND_ASSIGN(PanelBrowserFrameView); |
| }; |