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

Side by Side Diff: ash/app_list/app_list_presenter_delegate.cc

Issue 2215223004: mash: Migrate ShelfLayoutManager ScreenUtil usage to ash common types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore screen bounds conversion for app list. Created 4 years, 4 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 | « no previous file | ash/aura/wm_shell_aura.h » ('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/app_list/app_list_presenter_delegate.h" 5 #include "ash/app_list/app_list_presenter_delegate.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/shelf/app_list_button.h" 8 #include "ash/common/shelf/app_list_button.h"
9 #include "ash/common/shelf/shelf_types.h" 9 #include "ash/common/shelf/shelf_types.h"
10 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
12 #include "ash/common/wm/wm_screen_util.h"
13 #include "ash/common/wm_lookup.h"
12 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
15 #include "ash/common/wm_window.h"
13 #include "ash/display/window_tree_host_manager.h" 16 #include "ash/display/window_tree_host_manager.h"
14 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
15 #include "ash/screen_util.h" 18 #include "ash/screen_util.h"
16 #include "ash/shelf/shelf.h" 19 #include "ash/shelf/shelf.h"
17 #include "ash/shelf/shelf_layout_manager.h" 20 #include "ash/shelf/shelf_layout_manager.h"
18 #include "ash/shell.h" 21 #include "ash/shell.h"
19 #include "base/command_line.h" 22 #include "base/command_line.h"
20 #include "ui/app_list/app_list_constants.h" 23 #include "ui/app_list/app_list_constants.h"
21 #include "ui/app_list/app_list_switches.h" 24 #include "ui/app_list/app_list_switches.h"
22 #include "ui/app_list/presenter/app_list_presenter.h" 25 #include "ui/app_list/presenter/app_list_presenter.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 74 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
72 } 75 }
73 NOTREACHED(); 76 NOTREACHED();
74 return gfx::Vector2d(); 77 return gfx::Vector2d();
75 } 78 }
76 79
77 // Gets the point at the center of the display that a particular view is on. 80 // Gets the point at the center of the display that a particular view is on.
78 // This calculation excludes the virtual keyboard area. If the height of the 81 // This calculation excludes the virtual keyboard area. If the height of the
79 // display area is less than |minimum_height|, its bottom will be extended to 82 // display area is less than |minimum_height|, its bottom will be extended to
80 // that height (so that the app list never starts above the top of the screen). 83 // that height (so that the app list never starts above the top of the screen).
81 gfx::Point GetCenterOfDisplayForView(const views::View* view, 84 gfx::Point GetCenterOfDisplayForView(views::View* view, int minimum_height) {
82 int minimum_height) { 85 WmWindow* window = WmLookup::Get()->GetWindowForWidget(view->GetWidget());
83 aura::Window* window = view->GetWidget()->GetNativeView(); 86 gfx::Rect bounds = wm::GetDisplayBoundsWithShelf(window);
84 gfx::Rect bounds = ScreenUtil::GetShelfDisplayBoundsInRoot(window); 87 bounds = window->GetRootWindow()->ConvertRectToScreen(bounds);
85 bounds = ScreenUtil::ConvertRectToScreen(window->GetRootWindow(), bounds);
86 88
87 // If the virtual keyboard is active, subtract it from the display bounds, so 89 // If the virtual keyboard is active, subtract it from the display bounds, so
88 // that the app list is centered in the non-keyboard area of the display. 90 // that the app list is centered in the non-keyboard area of the display.
89 // (Note that work_area excludes the keyboard, but it doesn't get updated 91 // (Note that work_area excludes the keyboard, but it doesn't get updated
90 // until after this function is called.) 92 // until after this function is called.)
91 keyboard::KeyboardController* keyboard_controller = 93 keyboard::KeyboardController* keyboard_controller =
92 keyboard::KeyboardController::GetInstance(); 94 keyboard::KeyboardController::GetInstance();
93 if (keyboard_controller && keyboard_controller->keyboard_visible()) 95 if (keyboard_controller && keyboard_controller->keyboard_visible())
94 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); 96 bounds.Subtract(keyboard_controller->current_keyboard_bounds());
95 97
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 338 }
337 339
338 //////////////////////////////////////////////////////////////////////////////// 340 ////////////////////////////////////////////////////////////////////////////////
339 // AppListPresenterDelegate, ShelfIconObserver implementation: 341 // AppListPresenterDelegate, ShelfIconObserver implementation:
340 342
341 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 343 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
342 UpdateBounds(); 344 UpdateBounds();
343 } 345 }
344 346
345 } // namespace ash 347 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/aura/wm_shell_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698