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

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: Cleanup. 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') | ash/common/wm/wm_screen_util.h » ('J')
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"
13 #include "ash/display/window_tree_host_manager.h" 15 #include "ash/display/window_tree_host_manager.h"
14 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
15 #include "ash/screen_util.h" 17 #include "ash/screen_util.h"
16 #include "ash/shelf/shelf.h" 18 #include "ash/shelf/shelf.h"
17 #include "ash/shelf/shelf_layout_manager.h" 19 #include "ash/shelf/shelf_layout_manager.h"
18 #include "ash/shell.h" 20 #include "ash/shell.h"
19 #include "base/command_line.h" 21 #include "base/command_line.h"
20 #include "ui/app_list/app_list_constants.h" 22 #include "ui/app_list/app_list_constants.h"
21 #include "ui/app_list/app_list_switches.h" 23 #include "ui/app_list/app_list_switches.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0)); 73 0, std::max(kMinimalAnchorPositionOffset - anchor.y(), 0));
72 } 74 }
73 NOTREACHED(); 75 NOTREACHED();
74 return gfx::Vector2d(); 76 return gfx::Vector2d();
75 } 77 }
76 78
77 // Gets the point at the center of the display that a particular view is on. 79 // 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 80 // 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 81 // 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). 82 // that height (so that the app list never starts above the top of the screen).
81 gfx::Point GetCenterOfDisplayForView(const views::View* view, 83 gfx::Point GetCenterOfDisplayForView(views::View* view, int minimum_height) {
82 int minimum_height) { 84 WmWindow* window = WmLookup::Get()->GetWindowForWidget(view->GetWidget());
83 aura::Window* window = view->GetWidget()->GetNativeView(); 85 gfx::Rect bounds = wm::GetShelfDisplayBoundsForWindow(window);
84 gfx::Rect bounds = ScreenUtil::GetShelfDisplayBoundsInRoot(window);
85 bounds = ScreenUtil::ConvertRectToScreen(window->GetRootWindow(), bounds);
86 86
87 // If the virtual keyboard is active, subtract it from the display bounds, so 87 // 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. 88 // 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 89 // (Note that work_area excludes the keyboard, but it doesn't get updated
90 // until after this function is called.) 90 // until after this function is called.)
91 keyboard::KeyboardController* keyboard_controller = 91 keyboard::KeyboardController* keyboard_controller =
92 keyboard::KeyboardController::GetInstance(); 92 keyboard::KeyboardController::GetInstance();
93 if (keyboard_controller && keyboard_controller->keyboard_visible()) 93 if (keyboard_controller && keyboard_controller->keyboard_visible())
94 bounds.Subtract(keyboard_controller->current_keyboard_bounds()); 94 bounds.Subtract(keyboard_controller->current_keyboard_bounds());
95 95
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 336 }
337 337
338 //////////////////////////////////////////////////////////////////////////////// 338 ////////////////////////////////////////////////////////////////////////////////
339 // AppListPresenterDelegate, ShelfIconObserver implementation: 339 // AppListPresenterDelegate, ShelfIconObserver implementation:
340 340
341 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { 341 void AppListPresenterDelegate::OnShelfIconPositionsChanged() {
342 UpdateBounds(); 342 UpdateBounds();
343 } 343 }
344 344
345 } // namespace ash 345 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/aura/wm_shell_aura.h » ('j') | ash/common/wm/wm_screen_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698