| 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_shell.h" | |
| 13 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
| 14 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
| 14 #include "ash/shell.h" |
| 15 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
| 16 #include "ui/compositor/scoped_layer_animation_settings.h" | 16 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 17 #include "ui/gfx/animation/tween.h" | 17 #include "ui/gfx/animation/tween.h" |
| 18 #include "ui/views/accessible_pane_view.h" | 18 #include "ui/views/accessible_pane_view.h" |
| 19 #include "ui/views/border.h" | 19 #include "ui/views/border.h" |
| 20 #include "ui/views/layout/grid_layout.h" | 20 #include "ui/views/layout/grid_layout.h" |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 constexpr int kAnimationDurationMs = 250; | 24 constexpr int kAnimationDurationMs = 250; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 event->StopPropagation(); | 83 event->StopPropagation(); |
| 84 else | 84 else |
| 85 views::AccessiblePaneView::OnGestureEvent(event); | 85 views::AccessiblePaneView::OnGestureEvent(event); |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool StatusAreaWidgetDelegate::CanActivate() const { | 88 bool StatusAreaWidgetDelegate::CanActivate() const { |
| 89 // 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 |
| 90 // activation when the user is using the keyboard (FocusCycler). | 90 // activation when the user is using the keyboard (FocusCycler). |
| 91 const FocusCycler* focus_cycler = focus_cycler_for_testing_ | 91 const FocusCycler* focus_cycler = focus_cycler_for_testing_ |
| 92 ? focus_cycler_for_testing_ | 92 ? focus_cycler_for_testing_ |
| 93 : WmShell::Get()->focus_cycler(); | 93 : Shell::Get()->focus_cycler(); |
| 94 return focus_cycler->widget_activating() == GetWidget(); | 94 return focus_cycler->widget_activating() == GetWidget(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void StatusAreaWidgetDelegate::DeleteDelegate() {} | 97 void StatusAreaWidgetDelegate::DeleteDelegate() {} |
| 98 | 98 |
| 99 void StatusAreaWidgetDelegate::AddTray(views::View* tray) { | 99 void StatusAreaWidgetDelegate::AddTray(views::View* tray) { |
| 100 SetLayoutManager(NULL); // Reset layout manager before adding a child. | 100 SetLayoutManager(NULL); // Reset layout manager before adding a child. |
| 101 AddChildView(tray); | 101 AddChildView(tray); |
| 102 // Set the layout manager with the new list of children. | 102 // Set the layout manager with the new list of children. |
| 103 UpdateLayout(); | 103 UpdateLayout(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 child->SetBorder( | 190 child->SetBorder( |
| 191 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); | 191 views::CreateEmptyBorder(top_edge, left_edge, bottom_edge, right_edge)); |
| 192 | 192 |
| 193 // 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 |
| 194 // displaying; otherwise |child| will be showing with old border size. | 194 // displaying; otherwise |child| will be showing with old border size. |
| 195 // Fix for crbug.com/623438. | 195 // Fix for crbug.com/623438. |
| 196 child->Layout(); | 196 child->Layout(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace ash | 199 } // namespace ash |
| OLD | NEW |