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

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

Issue 2085133002: Convert TrayBubbleWrapper to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eventfilter
Patch Set: rebase Created 4 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
« no previous file with comments | « no previous file | 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_bubble_wrapper.h" 5 #include "ash/system/tray/tray_bubble_wrapper.h"
6 6
7 #include "ash/common/wm_lookup.h"
8 #include "ash/common/wm_window.h"
7 #include "ash/system/tray/tray_background_view.h" 9 #include "ash/system/tray/tray_background_view.h"
8 #include "ash/system/tray/tray_event_filter.h" 10 #include "ash/system/tray/tray_event_filter.h"
9 #include "ash/wm/window_properties.h"
10 #include "ui/aura/client/capture_client.h"
11 #include "ui/aura/window.h"
12 #include "ui/aura/window_event_dispatcher.h"
13 #include "ui/views/bubble/tray_bubble_view.h" 11 #include "ui/views/bubble/tray_bubble_view.h"
14 #include "ui/views/widget/widget.h" 12 #include "ui/views/widget/widget.h"
15 13
16 namespace ash { 14 namespace ash {
17 15
18 TrayBubbleWrapper::TrayBubbleWrapper(TrayBackgroundView* tray, 16 TrayBubbleWrapper::TrayBubbleWrapper(TrayBackgroundView* tray,
19 views::TrayBubbleView* bubble_view) 17 views::TrayBubbleView* bubble_view)
20 : tray_(tray), 18 : tray_(tray),
21 bubble_view_(bubble_view) { 19 bubble_view_(bubble_view) {
22 bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_); 20 bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_);
(...skipping 16 matching lines...) Expand all
39 37
40 void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) { 38 void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) {
41 CHECK_EQ(bubble_widget_, widget); 39 CHECK_EQ(bubble_widget_, widget);
42 bubble_widget_->RemoveObserver(this); 40 bubble_widget_->RemoveObserver(this);
43 bubble_widget_ = NULL; 41 bubble_widget_ = NULL;
44 42
45 // Although the bubble is already closed, the next mouse release event 43 // Although the bubble is already closed, the next mouse release event
46 // will invoke PerformAction which reopens the bubble again. To prevent the 44 // will invoke PerformAction which reopens the bubble again. To prevent the
47 // reopen, the mouse capture of |tray_| has to be released. 45 // reopen, the mouse capture of |tray_| has to be released.
48 // See crbug.com/177075 46 // See crbug.com/177075
49 aura::client::CaptureClient* capture_client = aura::client::GetCaptureClient( 47 WmLookup::Get()->GetWindowForWidget(tray_->GetWidget())->ReleaseCapture();
50 tray_->GetWidget()->GetNativeView()->GetRootWindow()); 48
51 if (capture_client)
52 capture_client->ReleaseCapture(tray_->GetWidget()->GetNativeView());
53 tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_| 49 tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_|
54 } 50 }
55 51
56 void TrayBubbleWrapper::OnWidgetBoundsChanged(views::Widget* widget, 52 void TrayBubbleWrapper::OnWidgetBoundsChanged(views::Widget* widget,
57 const gfx::Rect& new_bounds) { 53 const gfx::Rect& new_bounds) {
58 DCHECK_EQ(bubble_widget_, widget); 54 DCHECK_EQ(bubble_widget_, widget);
59 tray_->BubbleResized(bubble_view_); 55 tray_->BubbleResized(bubble_view_);
60 } 56 }
61 57
62 } // namespace ash 58 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698