OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/panels/panel_mouse_watcher_win.h" | 5 #include "chrome/browser/ui/panels/panel_mouse_watcher_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (hook_struct) | 63 if (hook_struct) |
64 mouse_watcher->OnMouseAction(hook_struct->pt.x, hook_struct->pt.y); | 64 mouse_watcher->OnMouseAction(hook_struct->pt.x, hook_struct->pt.y); |
65 } | 65 } |
66 return ::CallNextHookEx(NULL, code, wparam, lparam); | 66 return ::CallNextHookEx(NULL, code, wparam, lparam); |
67 } | 67 } |
68 | 68 |
69 void PanelMouseWatcherWin::OnMouseAction(int mouse_x, int mouse_y) { | 69 void PanelMouseWatcherWin::OnMouseAction(int mouse_x, int mouse_y) { |
70 PanelManager* panel_manager = PanelManager::GetInstance(); | 70 PanelManager* panel_manager = PanelManager::GetInstance(); |
71 | 71 |
72 bool bring_up_titlebar = | 72 bool bring_up_titlebar = |
73 panel_manager->ShouldBringUpTitleBarForAllMinimizedPanels( | 73 panel_manager->ShouldBringUpTitlebarForAllMinimizedPanels( |
74 mouse_x, mouse_y); | 74 mouse_x, mouse_y); |
75 if (bring_up_titlebar == bring_up_titlebar_) | 75 if (bring_up_titlebar == bring_up_titlebar_) |
76 return; | 76 return; |
77 bring_up_titlebar_ = bring_up_titlebar; | 77 bring_up_titlebar_ = bring_up_titlebar; |
78 | 78 |
79 panel_manager->BringUpOrDownTitleBarForAllMinimizedPanels(bring_up_titlebar); | 79 panel_manager->BringUpOrDownTitlebarForAllMinimizedPanels(bring_up_titlebar); |
80 } | 80 } |
81 | 81 |
82 } | 82 } |
83 | 83 |
84 void EnsureMouseWatcherStarted() { | 84 void EnsureMouseWatcherStarted() { |
85 if (!mouse_watcher.get()) | 85 if (!mouse_watcher.get()) |
86 mouse_watcher.reset(new PanelMouseWatcherWin()); | 86 mouse_watcher.reset(new PanelMouseWatcherWin()); |
87 } | 87 } |
88 | 88 |
89 void StopMouseWatcher() { | 89 void StopMouseWatcher() { |
90 mouse_watcher.reset(NULL); | 90 mouse_watcher.reset(NULL); |
91 } | 91 } |
92 | 92 |
93 bool IsMouseWatcherStarted() { | 93 bool IsMouseWatcherStarted() { |
94 return mouse_watcher.get() != NULL; | 94 return mouse_watcher.get() != NULL; |
95 } | 95 } |
OLD | NEW |