| 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/shelf/overflow_bubble.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/overflow_bubble_view.h" | 8 #include "ash/shelf/overflow_bubble_view.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_view.h" | 10 #include "ash/shelf/shelf_view.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 views::View* anchor = anchor_; | 64 views::View* anchor = anchor_; |
| 65 Hide(); | 65 Hide(); |
| 66 // Update overflow button (|anchor|) status when overflow bubble is hidden | 66 // Update overflow button (|anchor|) status when overflow bubble is hidden |
| 67 // by outside event of overflow button. | 67 // by outside event of overflow button. |
| 68 anchor->SchedulePaint(); | 68 anchor->SchedulePaint(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void OverflowBubble::ProcessPressedEvent(ui::LocatedEvent* event) { | 71 void OverflowBubble::ProcessPressedEvent(ui::LocatedEvent* event) { |
| 72 aura::Window* target = static_cast<aura::Window*>(event->target()); | 72 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 73 gfx::Point event_location_in_screen = event->location(); | 73 gfx::Point event_location_in_screen = gfx::ToFlooredPoint(event->location()); |
| 74 aura::client::GetScreenPositionClient(target->GetRootWindow())-> | 74 aura::client::GetScreenPositionClient(target->GetRootWindow())-> |
| 75 ConvertPointToScreen(target, &event_location_in_screen); | 75 ConvertPointToScreen(target, &event_location_in_screen); |
| 76 if (!shelf_view_->IsShowingMenu() && | 76 if (!shelf_view_->IsShowingMenu() && |
| 77 !bubble_->GetBoundsInScreen().Contains(event_location_in_screen) && | 77 !bubble_->GetBoundsInScreen().Contains(event_location_in_screen) && |
| 78 !anchor_->GetBoundsInScreen().Contains(event_location_in_screen)) { | 78 !anchor_->GetBoundsInScreen().Contains(event_location_in_screen)) { |
| 79 HideBubbleAndRefreshButton(); | 79 HideBubbleAndRefreshButton(); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 void OverflowBubble::OnMouseEvent(ui::MouseEvent* event) { | 83 void OverflowBubble::OnMouseEvent(ui::MouseEvent* event) { |
| 84 if (event->type() == ui::ET_MOUSE_PRESSED) | 84 if (event->type() == ui::ET_MOUSE_PRESSED) |
| 85 ProcessPressedEvent(event); | 85 ProcessPressedEvent(event); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void OverflowBubble::OnTouchEvent(ui::TouchEvent* event) { | 88 void OverflowBubble::OnTouchEvent(ui::TouchEvent* event) { |
| 89 if (event->type() == ui::ET_TOUCH_PRESSED) | 89 if (event->type() == ui::ET_TOUCH_PRESSED) |
| 90 ProcessPressedEvent(event); | 90 ProcessPressedEvent(event); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void OverflowBubble::OnWidgetDestroying(views::Widget* widget) { | 93 void OverflowBubble::OnWidgetDestroying(views::Widget* widget) { |
| 94 DCHECK(widget == bubble_->GetWidget()); | 94 DCHECK(widget == bubble_->GetWidget()); |
| 95 bubble_ = NULL; | 95 bubble_ = NULL; |
| 96 anchor_ = NULL; | 96 anchor_ = NULL; |
| 97 shelf_view_ = NULL; | 97 shelf_view_ = NULL; |
| 98 ShelfLayoutManager::ForShelf( | 98 ShelfLayoutManager::ForShelf( |
| 99 widget->GetNativeView())->shelf_widget()->shelf()->SchedulePaint(); | 99 widget->GetNativeView())->shelf_widget()->shelf()->SchedulePaint(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace ash | 102 } // namespace ash |
| OLD | NEW |