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

Side by Side Diff: ash/wm/app_list_controller.cc

Issue 1849623002: Remove unused ash::SHELF_ALIGNMENT_TOP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix autoformat problem with <x, >y Created 4 years, 8 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
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/wm/app_list_controller.h" 5 #include "ash/wm/app_list_controller.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 ui::Layer* GetLayer(views::Widget* widget) { 51 ui::Layer* GetLayer(views::Widget* widget) {
52 return widget->GetNativeView()->layer(); 52 return widget->GetNativeView()->layer();
53 } 53 }
54 54
55 // Gets arrow location based on shelf alignment. 55 // Gets arrow location based on shelf alignment.
56 views::BubbleBorder::Arrow GetBubbleArrow(aura::Window* window) { 56 views::BubbleBorder::Arrow GetBubbleArrow(aura::Window* window) {
57 DCHECK(Shell::HasInstance()); 57 DCHECK(Shell::HasInstance());
58 return Shelf::ForWindow(window)->SelectValueForShelfAlignment( 58 return Shelf::ForWindow(window)->SelectValueForShelfAlignment(
59 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER, 59 views::BubbleBorder::BOTTOM_CENTER, views::BubbleBorder::LEFT_CENTER,
60 views::BubbleBorder::RIGHT_CENTER, views::BubbleBorder::TOP_CENTER); 60 views::BubbleBorder::RIGHT_CENTER);
61 } 61 }
62 62
63 // Offset given |rect| towards shelf. 63 // Offset given |rect| towards shelf.
64 gfx::Rect OffsetTowardsShelf(const gfx::Rect& rect, views::Widget* widget) { 64 gfx::Rect OffsetTowardsShelf(const gfx::Rect& rect, views::Widget* widget) {
65 DCHECK(Shell::HasInstance()); 65 DCHECK(Shell::HasInstance());
66 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( 66 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment(
67 widget->GetNativeView()->GetRootWindow()); 67 widget->GetNativeView()->GetRootWindow());
68 gfx::Rect offseted(rect); 68 gfx::Rect offseted(rect);
69 switch (shelf_alignment) { 69 switch (shelf_alignment) {
70 case SHELF_ALIGNMENT_BOTTOM: 70 case SHELF_ALIGNMENT_BOTTOM:
71 offseted.Offset(0, kAnimationOffset); 71 offseted.Offset(0, kAnimationOffset);
72 break; 72 break;
73 case SHELF_ALIGNMENT_LEFT: 73 case SHELF_ALIGNMENT_LEFT:
74 offseted.Offset(-kAnimationOffset, 0); 74 offseted.Offset(-kAnimationOffset, 0);
75 break; 75 break;
76 case SHELF_ALIGNMENT_RIGHT: 76 case SHELF_ALIGNMENT_RIGHT:
77 offseted.Offset(kAnimationOffset, 0); 77 offseted.Offset(kAnimationOffset, 0);
78 break; 78 break;
79 case SHELF_ALIGNMENT_TOP:
80 offseted.Offset(0, -kAnimationOffset);
81 break;
82 } 79 }
83 80
84 return offseted; 81 return offseted;
85 } 82 }
86 83
87 // Using |button_bounds|, determine the anchor offset so that the bubble gets 84 // Using |button_bounds|, determine the anchor offset so that the bubble gets
88 // shown above the shelf (used for the alternate shelf theme). 85 // shown above the shelf (used for the alternate shelf theme).
89 gfx::Vector2d GetAnchorPositionOffsetToShelf( 86 gfx::Vector2d GetAnchorPositionOffsetToShelf(
90 const gfx::Rect& button_bounds, views::Widget* widget) { 87 const gfx::Rect& button_bounds, views::Widget* widget) {
91 DCHECK(Shell::HasInstance()); 88 DCHECK(Shell::HasInstance());
92 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment( 89 ShelfAlignment shelf_alignment = Shell::GetInstance()->GetShelfAlignment(
93 widget->GetNativeView()->GetRootWindow()); 90 widget->GetNativeView()->GetRootWindow());
94 gfx::Point anchor(button_bounds.CenterPoint()); 91 gfx::Point anchor(button_bounds.CenterPoint());
95 switch (shelf_alignment) { 92 switch (shelf_alignment) {
96 case SHELF_ALIGNMENT_TOP:
97 case SHELF_ALIGNMENT_BOTTOM: 93 case SHELF_ALIGNMENT_BOTTOM:
98 if (base::i18n::IsRTL()) { 94 if (base::i18n::IsRTL()) {
99 int screen_width = widget->GetWorkAreaBoundsInScreen().width(); 95 int screen_width = widget->GetWorkAreaBoundsInScreen().width();
100 return gfx::Vector2d( 96 return gfx::Vector2d(
101 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(), 97 std::min(screen_width - kMinimalAnchorPositionOffset - anchor.x(),
102 0), 0); 98 0), 0);
103 } 99 }
104 return gfx::Vector2d( 100 return gfx::Vector2d(
105 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0); 101 std::max(kMinimalAnchorPositionOffset - anchor.x(), 0), 0);
106 case SHELF_ALIGNMENT_LEFT: 102 case SHELF_ALIGNMENT_LEFT:
107 return gfx::Vector2d( 103 return gfx::Vector2d(
108 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 104 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
109 case SHELF_ALIGNMENT_RIGHT: 105 case SHELF_ALIGNMENT_RIGHT:
110 return gfx::Vector2d( 106 return gfx::Vector2d(
111 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 107 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
112 default: 108 default:
113 NOTREACHED(); 109 NOTREACHED();
114 return gfx::Vector2d(); 110 return gfx::Vector2d();
oshima 2016/03/30 23:59:57 ditto. and move return to the end.
James Cook 2016/04/04 15:56:05 Done.
115 } 111 }
116 } 112 }
117 113
118 // Gets the point at the center of the display that a particular view is on. 114 // Gets the point at the center of the display that a particular view is on.
119 // This calculation excludes the virtual keyboard area. If the height of the 115 // This calculation excludes the virtual keyboard area. If the height of the
120 // display area is less than |minimum_height|, its bottom will be extended to 116 // display area is less than |minimum_height|, its bottom will be extended to
121 // that height (so that the app list never starts above the top of the screen). 117 // that height (so that the app list never starts above the top of the screen).
122 gfx::Point GetCenterOfDisplayForView(const views::View* view, 118 gfx::Point GetCenterOfDisplayForView(const views::View* view,
123 int minimum_height) { 119 int minimum_height) {
124 aura::Window* window = view->GetWidget()->GetNativeView(); 120 aura::Window* window = view->GetWidget()->GetNativeView();
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } else if (should_snap_back_) { 549 } else if (should_snap_back_) {
554 should_snap_back_ = false; 550 should_snap_back_ = false;
555 ui::ScopedLayerAnimationSettings animation(widget_animator); 551 ui::ScopedLayerAnimationSettings animation(widget_animator);
556 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( 552 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
557 app_list::kOverscrollPageTransitionDurationMs)); 553 app_list::kOverscrollPageTransitionDurationMs));
558 widget->SetBounds(view_bounds_); 554 widget->SetBounds(view_bounds_);
559 } 555 }
560 } 556 }
561 557
562 } // namespace ash 558 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698