OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ash/system/tray/tray_event_filter.h" | 5 #include "ash/system/tray/tray_event_filter.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/shell_port.h" | 8 #include "ash/shell_port.h" |
9 #include "ash/system/tray/tray_background_view.h" | 9 #include "ash/system/tray/tray_background_view.h" |
10 #include "ash/system/tray/tray_bubble_wrapper.h" | 10 #include "ash/system/tray/tray_bubble_wrapper.h" |
11 #include "ash/wm/container_finder.h" | 11 #include "ash/wm/container_finder.h" |
12 #include "ash/wm_window.h" | 12 #include "ash/wm_window.h" |
| 13 #include "ui/aura/window.h" |
13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
14 | 15 |
15 namespace ash { | 16 namespace ash { |
16 | 17 |
17 TrayEventFilter::TrayEventFilter() {} | 18 TrayEventFilter::TrayEventFilter() {} |
18 | 19 |
19 TrayEventFilter::~TrayEventFilter() { | 20 TrayEventFilter::~TrayEventFilter() { |
20 DCHECK(wrappers_.empty()); | 21 DCHECK(wrappers_.empty()); |
21 } | 22 } |
22 | 23 |
(...skipping 17 matching lines...) Expand all Loading... |
40 const gfx::Point& location_in_screen, | 41 const gfx::Point& location_in_screen, |
41 views::Widget* target) { | 42 views::Widget* target) { |
42 if (event.type() == ui::ET_POINTER_DOWN) | 43 if (event.type() == ui::ET_POINTER_DOWN) |
43 ProcessPressedEvent(location_in_screen, target); | 44 ProcessPressedEvent(location_in_screen, target); |
44 } | 45 } |
45 | 46 |
46 void TrayEventFilter::ProcessPressedEvent(const gfx::Point& location_in_screen, | 47 void TrayEventFilter::ProcessPressedEvent(const gfx::Point& location_in_screen, |
47 views::Widget* target) { | 48 views::Widget* target) { |
48 if (target) { | 49 if (target) { |
49 WmWindow* window = WmWindow::Get(target->GetNativeWindow()); | 50 WmWindow* window = WmWindow::Get(target->GetNativeWindow()); |
50 int container_id = wm::GetContainerForWindow(window)->GetShellWindowId(); | 51 int container_id = wm::GetContainerForWindow(window)->aura_window()->id(); |
51 // Don't process events that occurred inside an embedded menu, for example | 52 // Don't process events that occurred inside an embedded menu, for example |
52 // the right-click menu in a popup notification. | 53 // the right-click menu in a popup notification. |
53 if (container_id == kShellWindowId_MenuContainer) | 54 if (container_id == kShellWindowId_MenuContainer) |
54 return; | 55 return; |
55 // Don't process events that occurred inside a popup notification | 56 // Don't process events that occurred inside a popup notification |
56 // from message center. | 57 // from message center. |
57 if (container_id == kShellWindowId_StatusContainer && | 58 if (container_id == kShellWindowId_StatusContainer && |
58 window->GetType() == ui::wm::WINDOW_TYPE_POPUP && | 59 window->GetType() == ui::wm::WINDOW_TYPE_POPUP && |
59 target->IsAlwaysOnTop()) { | 60 target->IsAlwaysOnTop()) { |
60 return; | 61 return; |
(...skipping 26 matching lines...) Expand all Loading... |
87 | 88 |
88 // Close all bubbles other than the one a user clicked on the tray | 89 // Close all bubbles other than the one a user clicked on the tray |
89 // or its bubble. | 90 // or its bubble. |
90 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin(); | 91 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin(); |
91 iter != trays.end(); ++iter) { | 92 iter != trays.end(); ++iter) { |
92 (*iter)->ClickedOutsideBubble(); | 93 (*iter)->ClickedOutsideBubble(); |
93 } | 94 } |
94 } | 95 } |
95 | 96 |
96 } // namespace ash | 97 } // namespace ash |
OLD | NEW |