Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: ash/system/tray/tray_event_filter.cc

Issue 2930123002: Tablet WM : Swiping on system tray bubble. (Closed)
Patch Set: Fixed UT. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h"
8 #include "ash/shell_port.h" 9 #include "ash/shell_port.h"
9 #include "ash/system/tray/tray_background_view.h" 10 #include "ash/system/tray/tray_background_view.h"
10 #include "ash/system/tray/tray_bubble_wrapper.h" 11 #include "ash/system/tray/tray_bubble_wrapper.h"
11 #include "ash/wm/container_finder.h" 12 #include "ash/wm/container_finder.h"
13 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
12 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
13 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
14 16
15 namespace ash { 17 namespace ash {
16 18
17 TrayEventFilter::TrayEventFilter() {} 19 TrayEventFilter::TrayEventFilter() {}
18 20
19 TrayEventFilter::~TrayEventFilter() { 21 TrayEventFilter::~TrayEventFilter() {
20 DCHECK(wrappers_.empty()); 22 DCHECK(wrappers_.empty());
21 } 23 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // happens inside of any of those wrappers. 68 // happens inside of any of those wrappers.
67 for (std::set<TrayBubbleWrapper*>::const_iterator iter = wrappers_.begin(); 69 for (std::set<TrayBubbleWrapper*>::const_iterator iter = wrappers_.begin();
68 iter != wrappers_.end(); ++iter) { 70 iter != wrappers_.end(); ++iter) {
69 const TrayBubbleWrapper* wrapper = *iter; 71 const TrayBubbleWrapper* wrapper = *iter;
70 const views::Widget* bubble_widget = wrapper->bubble_widget(); 72 const views::Widget* bubble_widget = wrapper->bubble_widget();
71 if (!bubble_widget) 73 if (!bubble_widget)
72 continue; 74 continue;
73 75
74 gfx::Rect bounds = bubble_widget->GetWindowBoundsInScreen(); 76 gfx::Rect bounds = bubble_widget->GetWindowBoundsInScreen();
75 bounds.Inset(wrapper->bubble_view()->GetBorderInsets()); 77 bounds.Inset(wrapper->bubble_view()->GetBorderInsets());
78 // System tray can be dragged to show the bubble if it is in maximize mode.
79 // The events happened on the clipped part of the bubble should be considerd
80 // happened outside the bubble.
tdanderson 2017/06/26 18:13:02 Suggestion to re-word the second sentence: "During
minch1 2017/06/26 23:26:48 Yes, thanks.
81 if (Shell::Get()
82 ->maximize_mode_controller()
83 ->IsMaximizeModeWindowManagerEnabled()) {
tdanderson 2017/06/26 18:13:02 Do you intentionally not check container_id == kSh
minch1 2017/06/26 23:26:49 I don't think that for all the other containers th
84 bounds.Intersect(bubble_widget->GetWorkAreaBoundsInScreen());
85 }
76 if (bounds.Contains(location_in_screen)) 86 if (bounds.Contains(location_in_screen))
77 continue; 87 continue;
78 if (wrapper->tray()) { 88 if (wrapper->tray()) {
79 // If the user clicks on the parent tray, don't process the event here, 89 // If the user clicks on the parent tray, don't process the event here,
80 // let the tray logic handle the event and determine show/hide behavior. 90 // let the tray logic handle the event and determine show/hide behavior.
81 bounds = wrapper->tray()->GetBoundsInScreen(); 91 bounds = wrapper->tray()->GetBoundsInScreen();
82 if (bounds.Contains(location_in_screen)) 92 if (bounds.Contains(location_in_screen))
83 continue; 93 continue;
84 } 94 }
85 trays.insert((*iter)->tray()); 95 trays.insert((*iter)->tray());
86 } 96 }
87 97
88 // Close all bubbles other than the one a user clicked on the tray 98 // Close all bubbles other than the one a user clicked on the tray
89 // or its bubble. 99 // or its bubble.
90 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin(); 100 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin();
91 iter != trays.end(); ++iter) { 101 iter != trays.end(); ++iter) {
92 (*iter)->ClickedOutsideBubble(); 102 (*iter)->ClickedOutsideBubble();
93 } 103 }
94 } 104 }
95 105
96 } // namespace ash 106 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698