| 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/status_area_widget_delegate.h" | 5 #include "ash/common/system/status_area_widget_delegate.h" |
| 6 | 6 |
| 7 #include "ash/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
| 8 #include "ash/common/shelf/shelf_constants.h" | 8 #include "ash/common/shelf/shelf_constants.h" |
| 9 #include "ash/common/shelf/wm_shelf.h" | 9 #include "ash/common/shelf/wm_shelf.h" |
| 10 #include "ash/common/shelf/wm_shelf_util.h" | 10 #include "ash/common/shelf/wm_shelf_util.h" |
| 11 #include "ash/common/system/tray/tray_constants.h" | 11 #include "ash/common/system/tray/tray_constants.h" |
| 12 #include "ash/common/wm_lookup.h" | |
| 13 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 13 #include "ash/common/wm_window.h" |
| 15 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
| 16 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
| 17 #include "ui/compositor/scoped_layer_animation_settings.h" | 16 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 18 #include "ui/gfx/animation/tween.h" | 17 #include "ui/gfx/animation/tween.h" |
| 19 #include "ui/views/accessible_pane_view.h" | 18 #include "ui/views/accessible_pane_view.h" |
| 20 #include "ui/views/border.h" | 19 #include "ui/views/border.h" |
| 21 #include "ui/views/layout/grid_layout.h" | 20 #include "ui/views/layout/grid_layout.h" |
| 22 | 21 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return View::GetWidget(); | 70 return View::GetWidget(); |
| 72 } | 71 } |
| 73 | 72 |
| 74 const views::Widget* StatusAreaWidgetDelegate::GetWidget() const { | 73 const views::Widget* StatusAreaWidgetDelegate::GetWidget() const { |
| 75 return View::GetWidget(); | 74 return View::GetWidget(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 void StatusAreaWidgetDelegate::OnGestureEvent(ui::GestureEvent* event) { | 77 void StatusAreaWidgetDelegate::OnGestureEvent(ui::GestureEvent* event) { |
| 79 views::Widget* target_widget = | 78 views::Widget* target_widget = |
| 80 static_cast<views::View*>(event->target())->GetWidget(); | 79 static_cast<views::View*>(event->target())->GetWidget(); |
| 81 WmWindow* target_window = WmLookup::Get()->GetWindowForWidget(target_widget); | 80 WmWindow* target_window = WmWindow::Get(target_widget->GetNativeWindow()); |
| 82 WmShelf* shelf = target_window->GetRootWindowController()->GetShelf(); | 81 WmShelf* shelf = target_window->GetRootWindowController()->GetShelf(); |
| 83 if (shelf->ProcessGestureEvent(*event)) | 82 if (shelf->ProcessGestureEvent(*event)) |
| 84 event->StopPropagation(); | 83 event->StopPropagation(); |
| 85 else | 84 else |
| 86 views::AccessiblePaneView::OnGestureEvent(event); | 85 views::AccessiblePaneView::OnGestureEvent(event); |
| 87 } | 86 } |
| 88 | 87 |
| 89 bool StatusAreaWidgetDelegate::CanActivate() const { | 88 bool StatusAreaWidgetDelegate::CanActivate() const { |
| 90 // We don't want mouse clicks to activate us, but we need to allow | 89 // We don't want mouse clicks to activate us, but we need to allow |
| 91 // activation when the user is using the keyboard (FocusCycler). | 90 // activation when the user is using the keyboard (FocusCycler). |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 child->SetBorder( | 190 child->SetBorder( |
| 192 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); | 191 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); |
| 193 | 192 |
| 194 // Layout on |child| needs to be updated based on new border value before | 193 // Layout on |child| needs to be updated based on new border value before |
| 195 // displaying; otherwise |child| will be showing with old border size. | 194 // displaying; otherwise |child| will be showing with old border size. |
| 196 // Fix for crbug.com/623438. | 195 // Fix for crbug.com/623438. |
| 197 child->Layout(); | 196 child->Layout(); |
| 198 } | 197 } |
| 199 | 198 |
| 200 } // namespace ash | 199 } // namespace ash |
| OLD | NEW |