| 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/system/tray/tray_background_view.h" | 9 #include "ash/system/tray/tray_background_view.h" |
| 9 #include "ash/system/tray/tray_bubble_wrapper.h" | 10 #include "ash/system/tray/tray_bubble_wrapper.h" |
| 10 #include "ash/wm/container_finder.h" | 11 #include "ash/wm/container_finder.h" |
| 11 #include "ash/wm_shell.h" | |
| 12 #include "ash/wm_window.h" | 12 #include "ash/wm_window.h" |
| 13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 | 16 |
| 17 TrayEventFilter::TrayEventFilter() {} | 17 TrayEventFilter::TrayEventFilter() {} |
| 18 | 18 |
| 19 TrayEventFilter::~TrayEventFilter() { | 19 TrayEventFilter::~TrayEventFilter() { |
| 20 DCHECK(wrappers_.empty()); | 20 DCHECK(wrappers_.empty()); |
| 21 } | 21 } |
| 22 | 22 |
| 23 void TrayEventFilter::AddWrapper(TrayBubbleWrapper* wrapper) { | 23 void TrayEventFilter::AddWrapper(TrayBubbleWrapper* wrapper) { |
| 24 bool was_empty = wrappers_.empty(); | 24 bool was_empty = wrappers_.empty(); |
| 25 wrappers_.insert(wrapper); | 25 wrappers_.insert(wrapper); |
| 26 if (was_empty && !wrappers_.empty()) { | 26 if (was_empty && !wrappers_.empty()) { |
| 27 WmShell::Get()->AddPointerWatcher(this, | 27 ShellPort::Get()->AddPointerWatcher(this, |
| 28 views::PointerWatcherEventTypes::BASIC); | 28 views::PointerWatcherEventTypes::BASIC); |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 void TrayEventFilter::RemoveWrapper(TrayBubbleWrapper* wrapper) { | 32 void TrayEventFilter::RemoveWrapper(TrayBubbleWrapper* wrapper) { |
| 33 wrappers_.erase(wrapper); | 33 wrappers_.erase(wrapper); |
| 34 if (wrappers_.empty()) | 34 if (wrappers_.empty()) |
| 35 WmShell::Get()->RemovePointerWatcher(this); | 35 ShellPort::Get()->RemovePointerWatcher(this); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void TrayEventFilter::OnPointerEventObserved( | 38 void TrayEventFilter::OnPointerEventObserved( |
| 39 const ui::PointerEvent& event, | 39 const ui::PointerEvent& event, |
| 40 const gfx::Point& location_in_screen, | 40 const gfx::Point& location_in_screen, |
| 41 views::Widget* target) { | 41 views::Widget* target) { |
| 42 if (event.type() == ui::ET_POINTER_DOWN) | 42 if (event.type() == ui::ET_POINTER_DOWN) |
| 43 ProcessPressedEvent(location_in_screen, target); | 43 ProcessPressedEvent(location_in_screen, target); |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // Close all bubbles other than the one a user clicked on the tray | 88 // Close all bubbles other than the one a user clicked on the tray |
| 89 // or its bubble. | 89 // or its bubble. |
| 90 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin(); | 90 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin(); |
| 91 iter != trays.end(); ++iter) { | 91 iter != trays.end(); ++iter) { |
| 92 (*iter)->ClickedOutsideBubble(); | 92 (*iter)->ClickedOutsideBubble(); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace ash | 96 } // namespace ash |
| OLD | NEW |