| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/overflow_bubble.h" | 5 #include "ash/common/shelf/overflow_bubble.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/overflow_bubble_view.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" |
| 7 #include "ash/common/system/tray/tray_background_view.h" | 9 #include "ash/common/system/tray/tray_background_view.h" |
| 8 #include "ash/shelf/overflow_bubble_view.h" | 10 #include "ash/common/wm_shell.h" |
| 9 #include "ash/shelf/shelf.h" | |
| 10 #include "ash/shelf/shelf_view.h" | 11 #include "ash/shelf/shelf_view.h" |
| 11 #include "ash/shelf/shelf_widget.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ash/shell.h" | |
| 13 #include "ui/events/event.h" | |
| 14 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 15 | 14 |
| 16 namespace ash { | 15 namespace ash { |
| 17 | 16 |
| 18 OverflowBubble::OverflowBubble() | 17 OverflowBubble::OverflowBubble(WmShelf* wm_shelf) |
| 19 : bubble_(NULL), anchor_(NULL), shelf_view_(NULL) { | 18 : wm_shelf_(wm_shelf), |
| 20 Shell::GetInstance()->AddPointerWatcher(this); | 19 bubble_(nullptr), |
| 20 anchor_(nullptr), |
| 21 shelf_view_(nullptr) { |
| 22 WmShell::Get()->AddPointerWatcher(this); |
| 21 } | 23 } |
| 22 | 24 |
| 23 OverflowBubble::~OverflowBubble() { | 25 OverflowBubble::~OverflowBubble() { |
| 24 Hide(); | 26 Hide(); |
| 25 Shell::GetInstance()->RemovePointerWatcher(this); | 27 WmShell::Get()->RemovePointerWatcher(this); |
| 26 } | 28 } |
| 27 | 29 |
| 28 void OverflowBubble::Show(views::View* anchor, ShelfView* shelf_view) { | 30 void OverflowBubble::Show(views::View* anchor, ShelfView* shelf_view) { |
| 29 Hide(); | 31 Hide(); |
| 30 | 32 |
| 31 bubble_ = new OverflowBubbleView(); | 33 bubble_ = new OverflowBubbleView(wm_shelf_); |
| 32 bubble_->InitOverflowBubble(anchor, shelf_view); | 34 bubble_->InitOverflowBubble(anchor, shelf_view); |
| 33 shelf_view_ = shelf_view; | 35 shelf_view_ = shelf_view; |
| 34 anchor_ = anchor; | 36 anchor_ = anchor; |
| 35 | 37 |
| 36 TrayBackgroundView::InitializeBubbleAnimations(bubble_->GetWidget()); | 38 TrayBackgroundView::InitializeBubbleAnimations(bubble_->GetWidget()); |
| 37 bubble_->GetWidget()->AddObserver(this); | 39 bubble_->GetWidget()->AddObserver(this); |
| 38 bubble_->GetWidget()->Show(); | 40 bubble_->GetWidget()->Show(); |
| 39 } | 41 } |
| 40 | 42 |
| 41 void OverflowBubble::Hide() { | 43 void OverflowBubble::Hide() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void OverflowBubble::OnTouchPressed(const ui::TouchEvent& event, | 80 void OverflowBubble::OnTouchPressed(const ui::TouchEvent& event, |
| 79 const gfx::Point& location_in_screen, | 81 const gfx::Point& location_in_screen, |
| 80 views::Widget* target) { | 82 views::Widget* target) { |
| 81 ProcessPressedEvent(location_in_screen); | 83 ProcessPressedEvent(location_in_screen); |
| 82 } | 84 } |
| 83 | 85 |
| 84 void OverflowBubble::OnWidgetDestroying(views::Widget* widget) { | 86 void OverflowBubble::OnWidgetDestroying(views::Widget* widget) { |
| 85 DCHECK(widget == bubble_->GetWidget()); | 87 DCHECK(widget == bubble_->GetWidget()); |
| 86 bubble_ = NULL; | 88 bubble_ = NULL; |
| 87 anchor_ = NULL; | 89 anchor_ = NULL; |
| 88 shelf_view_->shelf()->SchedulePaint(); | 90 wm_shelf_->SchedulePaint(); |
| 89 shelf_view_ = NULL; | 91 shelf_view_ = NULL; |
| 90 } | 92 } |
| 91 | 93 |
| 92 } // namespace ash | 94 } // namespace ash |
| OLD | NEW |