Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: ash/system/status_area_widget_delegate.cc

Issue 2075923002: mash: Convert FocusCycler to wm common types and move to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/system/status_area_widget_delegate.h"
6 6
7 #include "ash/ash_export.h" 7 #include "ash/ash_export.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/common/focus_cycler.h"
9 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/shelf/shelf_constants.h" 11 #include "ash/common/shelf/shelf_constants.h"
11 #include "ash/common/shelf/wm_shelf_util.h" 12 #include "ash/common/shelf/wm_shelf_util.h"
12 #include "ash/common/shell_window_ids.h" 13 #include "ash/common/shell_window_ids.h"
13 #include "ash/common/system/tray/tray_constants.h" 14 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/focus_cycler.h" 15 #include "ash/common/wm_shell.h"
15 #include "ash/shelf/shelf_util.h"
16 #include "ash/shell.h"
17 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
18 #include "ui/aura/window_event_dispatcher.h"
19 #include "ui/compositor/layer.h" 17 #include "ui/compositor/layer.h"
20 #include "ui/compositor/scoped_layer_animation_settings.h" 18 #include "ui/compositor/scoped_layer_animation_settings.h"
21 #include "ui/gfx/animation/tween.h" 19 #include "ui/gfx/animation/tween.h"
22 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
24 #include "ui/views/accessible_pane_view.h" 22 #include "ui/views/accessible_pane_view.h"
25 #include "ui/views/border.h" 23 #include "ui/views/border.h"
26 #include "ui/views/layout/grid_layout.h" 24 #include "ui/views/layout/grid_layout.h"
27 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
28 26
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 ->GetNativeWindow(); 85 ->GetNativeWindow();
88 if (gesture_handler_.ProcessGestureEvent(*event, target_window)) 86 if (gesture_handler_.ProcessGestureEvent(*event, target_window))
89 event->StopPropagation(); 87 event->StopPropagation();
90 else 88 else
91 views::AccessiblePaneView::OnGestureEvent(event); 89 views::AccessiblePaneView::OnGestureEvent(event);
92 } 90 }
93 91
94 bool StatusAreaWidgetDelegate::CanActivate() const { 92 bool StatusAreaWidgetDelegate::CanActivate() const {
95 // We don't want mouse clicks to activate us, but we need to allow 93 // We don't want mouse clicks to activate us, but we need to allow
96 // activation when the user is using the keyboard (FocusCycler). 94 // activation when the user is using the keyboard (FocusCycler).
97 const FocusCycler* focus_cycler = focus_cycler_for_testing_ ? 95 const FocusCycler* focus_cycler = focus_cycler_for_testing_
98 focus_cycler_for_testing_ : Shell::GetInstance()->focus_cycler(); 96 ? focus_cycler_for_testing_
97 : WmShell::Get()->focus_cycler();
99 return focus_cycler->widget_activating() == GetWidget(); 98 return focus_cycler->widget_activating() == GetWidget();
100 } 99 }
101 100
102 void StatusAreaWidgetDelegate::DeleteDelegate() { 101 void StatusAreaWidgetDelegate::DeleteDelegate() {
103 } 102 }
104 103
105 void StatusAreaWidgetDelegate::AddTray(views::View* tray) { 104 void StatusAreaWidgetDelegate::AddTray(views::View* tray) {
106 SetLayoutManager(NULL); // Reset layout manager before adding a child. 105 SetLayoutManager(NULL); // Reset layout manager before adding a child.
107 AddChildView(tray); 106 AddChildView(tray);
108 // Set the layout manager with the new list of children. 107 // Set the layout manager with the new list of children.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0; 237 on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0;
239 right_edge = 238 right_edge =
240 GetShelfConstant(SHELF_SIZE) - kShelfItemInset - kShelfItemHeight; 239 GetShelfConstant(SHELF_SIZE) - kShelfItemInset - kShelfItemHeight;
241 } 240 }
242 } 241 }
243 child->SetBorder(views::Border::CreateEmptyBorder(top_edge, left_edge, 242 child->SetBorder(views::Border::CreateEmptyBorder(top_edge, left_edge,
244 bottom_edge, right_edge)); 243 bottom_edge, right_edge));
245 } 244 }
246 245
247 } // namespace ash 246 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/window_cycle_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698