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

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

Issue 2930123002: Tablet WM : Swiping on system tray bubble. (Closed)
Patch Set: Fixed comments. Created 3 years, 5 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
« no previous file with comments | « ash/system/tray/system_tray_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // During the drag, the bubble's logical bounds can extend outside of the
80 // work area, but its visual bounds are only within the work area. Restrict
81 // |bounds| so that events located outside the bubble's visual bounds are
82 // treated as outside of the bubble.
83 int bubble_container_id =
84 wm::GetContainerForWindow(bubble_widget->GetNativeWindow())->id();
85 if (Shell::Get()
86 ->maximize_mode_controller()
87 ->IsMaximizeModeWindowManagerEnabled() &&
88 bubble_container_id == kShellWindowId_SettingBubbleContainer) {
89 bounds.Intersect(bubble_widget->GetWorkAreaBoundsInScreen());
90 }
76 if (bounds.Contains(location_in_screen)) 91 if (bounds.Contains(location_in_screen))
77 continue; 92 continue;
78 if (wrapper->tray()) { 93 if (wrapper->tray()) {
79 // If the user clicks on the parent tray, don't process the event here, 94 // 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. 95 // let the tray logic handle the event and determine show/hide behavior.
81 bounds = wrapper->tray()->GetBoundsInScreen(); 96 bounds = wrapper->tray()->GetBoundsInScreen();
82 if (bounds.Contains(location_in_screen)) 97 if (bounds.Contains(location_in_screen))
83 continue; 98 continue;
84 } 99 }
85 trays.insert((*iter)->tray()); 100 trays.insert((*iter)->tray());
86 } 101 }
87 102
88 // Close all bubbles other than the one a user clicked on the tray 103 // Close all bubbles other than the one a user clicked on the tray
89 // or its bubble. 104 // or its bubble.
90 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin(); 105 for (std::set<TrayBackgroundView*>::iterator iter = trays.begin();
91 iter != trays.end(); ++iter) { 106 iter != trays.end(); ++iter) {
92 (*iter)->ClickedOutsideBubble(); 107 (*iter)->ClickedOutsideBubble();
93 } 108 }
94 } 109 }
95 110
96 } // namespace ash 111 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698