| 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/common/system/tray/tray_bubble_wrapper.h" | 5 #include "ash/common/system/tray/tray_bubble_wrapper.h" |
| 6 | 6 |
| 7 #include "ash/common/system/tray/tray_background_view.h" | 7 #include "ash/common/system/tray/tray_background_view.h" |
| 8 #include "ash/common/system/tray/tray_event_filter.h" | 8 #include "ash/common/system/tray/tray_event_filter.h" |
| 9 #include "ash/common/wm_lookup.h" | |
| 10 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 11 #include "ui/views/bubble/tray_bubble_view.h" | 10 #include "ui/views/bubble/tray_bubble_view.h" |
| 12 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
| 13 | 12 |
| 14 namespace ash { | 13 namespace ash { |
| 15 | 14 |
| 16 TrayBubbleWrapper::TrayBubbleWrapper(TrayBackgroundView* tray, | 15 TrayBubbleWrapper::TrayBubbleWrapper(TrayBackgroundView* tray, |
| 17 views::TrayBubbleView* bubble_view) | 16 views::TrayBubbleView* bubble_view) |
| 18 : tray_(tray), bubble_view_(bubble_view) { | 17 : tray_(tray), bubble_view_(bubble_view) { |
| 19 bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_); | 18 bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 | 35 |
| 37 void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) { | 36 void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) { |
| 38 CHECK_EQ(bubble_widget_, widget); | 37 CHECK_EQ(bubble_widget_, widget); |
| 39 bubble_widget_->RemoveObserver(this); | 38 bubble_widget_->RemoveObserver(this); |
| 40 bubble_widget_ = NULL; | 39 bubble_widget_ = NULL; |
| 41 | 40 |
| 42 // Although the bubble is already closed, the next mouse release event | 41 // Although the bubble is already closed, the next mouse release event |
| 43 // will invoke PerformAction which reopens the bubble again. To prevent the | 42 // will invoke PerformAction which reopens the bubble again. To prevent the |
| 44 // reopen, the mouse capture of |tray_| has to be released. | 43 // reopen, the mouse capture of |tray_| has to be released. |
| 45 // See crbug.com/177075 | 44 // See crbug.com/177075 |
| 46 WmLookup::Get()->GetWindowForWidget(tray_->GetWidget())->ReleaseCapture(); | 45 WmWindow::Get(tray_->GetWidget()->GetNativeWindow())->ReleaseCapture(); |
| 47 | 46 |
| 48 tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_| | 47 tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_| |
| 49 } | 48 } |
| 50 | 49 |
| 51 void TrayBubbleWrapper::OnWidgetBoundsChanged(views::Widget* widget, | 50 void TrayBubbleWrapper::OnWidgetBoundsChanged(views::Widget* widget, |
| 52 const gfx::Rect& new_bounds) { | 51 const gfx::Rect& new_bounds) { |
| 53 DCHECK_EQ(bubble_widget_, widget); | 52 DCHECK_EQ(bubble_widget_, widget); |
| 54 tray_->BubbleResized(bubble_view_); | 53 tray_->BubbleResized(bubble_view_); |
| 55 } | 54 } |
| 56 | 55 |
| 57 } // namespace ash | 56 } // namespace ash |
| OLD | NEW |