| 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/system/status_area_widget_delegate.h" | 5 #include "ash/common/system/status_area_widget_delegate.h" |
| 6 | 6 |
| 7 #include "ash/ash_export.h" | 7 #include "ash/ash_export.h" |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/focus_cycler.h" | 9 #include "ash/common/focus_cycler.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 11 #include "ash/common/shelf/shelf_constants.h" | 11 #include "ash/common/shelf/shelf_constants.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" |
| 12 #include "ash/common/shelf/wm_shelf_util.h" | 13 #include "ash/common/shelf/wm_shelf_util.h" |
| 13 #include "ash/common/shell_window_ids.h" | 14 #include "ash/common/shell_window_ids.h" |
| 14 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/wm_lookup.h" |
| 17 #include "ash/common/wm_root_window_controller.h" |
| 15 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/common/wm_window.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 17 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
| 18 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 19 #include "ui/gfx/animation/tween.h" | 23 #include "ui/gfx/animation/tween.h" |
| 20 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 21 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 22 #include "ui/views/accessible_pane_view.h" | 26 #include "ui/views/accessible_pane_view.h" |
| 23 #include "ui/views/border.h" | 27 #include "ui/views/border.h" |
| 24 #include "ui/views/layout/grid_layout.h" | 28 #include "ui/views/layout/grid_layout.h" |
| 25 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 75 |
| 72 views::Widget* StatusAreaWidgetDelegate::GetWidget() { | 76 views::Widget* StatusAreaWidgetDelegate::GetWidget() { |
| 73 return View::GetWidget(); | 77 return View::GetWidget(); |
| 74 } | 78 } |
| 75 | 79 |
| 76 const views::Widget* StatusAreaWidgetDelegate::GetWidget() const { | 80 const views::Widget* StatusAreaWidgetDelegate::GetWidget() const { |
| 77 return View::GetWidget(); | 81 return View::GetWidget(); |
| 78 } | 82 } |
| 79 | 83 |
| 80 void StatusAreaWidgetDelegate::OnGestureEvent(ui::GestureEvent* event) { | 84 void StatusAreaWidgetDelegate::OnGestureEvent(ui::GestureEvent* event) { |
| 81 aura::Window* target_window = static_cast<views::View*>(event->target()) | 85 views::Widget* target_widget = |
| 82 ->GetWidget() | 86 static_cast<views::View*>(event->target())->GetWidget(); |
| 83 ->GetNativeWindow(); | 87 WmWindow* target_window = WmLookup::Get()->GetWindowForWidget(target_widget); |
| 84 if (gesture_handler_.ProcessGestureEvent(*event, target_window)) | 88 WmShelf* shelf = target_window->GetRootWindowController()->GetShelf(); |
| 89 if (shelf->ProcessGestureEvent(*event, target_window)) |
| 85 event->StopPropagation(); | 90 event->StopPropagation(); |
| 86 else | 91 else |
| 87 views::AccessiblePaneView::OnGestureEvent(event); | 92 views::AccessiblePaneView::OnGestureEvent(event); |
| 88 } | 93 } |
| 89 | 94 |
| 90 bool StatusAreaWidgetDelegate::CanActivate() const { | 95 bool StatusAreaWidgetDelegate::CanActivate() const { |
| 91 // We don't want mouse clicks to activate us, but we need to allow | 96 // We don't want mouse clicks to activate us, but we need to allow |
| 92 // activation when the user is using the keyboard (FocusCycler). | 97 // activation when the user is using the keyboard (FocusCycler). |
| 93 const FocusCycler* focus_cycler = focus_cycler_for_testing_ | 98 const FocusCycler* focus_cycler = focus_cycler_for_testing_ |
| 94 ? focus_cycler_for_testing_ | 99 ? focus_cycler_for_testing_ |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 bottom_edge = | 227 bottom_edge = |
| 223 on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0; | 228 on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0; |
| 224 right_edge = shelf_size - kShelfItemInset - item_height; | 229 right_edge = shelf_size - kShelfItemInset - item_height; |
| 225 } | 230 } |
| 226 } | 231 } |
| 227 child->SetBorder(views::Border::CreateEmptyBorder(top_edge, left_edge, | 232 child->SetBorder(views::Border::CreateEmptyBorder(top_edge, left_edge, |
| 228 bottom_edge, right_edge)); | 233 bottom_edge, right_edge)); |
| 229 } | 234 } |
| 230 | 235 |
| 231 } // namespace ash | 236 } // namespace ash |
| OLD | NEW |