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

Side by Side Diff: ash/wm/overview/window_grid.cc

Issue 2860163005: chromeos: gets rid of wm_screen_util (Closed)
Patch Set: include Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/overview/window_grid.h" 5 #include "ash/wm/overview/window_grid.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/ash_switches.h" 13 #include "ash/ash_switches.h"
14 #include "ash/public/cpp/shelf_types.h" 14 #include "ash/public/cpp/shelf_types.h"
15 #include "ash/public/cpp/shell_window_ids.h" 15 #include "ash/public/cpp/shell_window_ids.h"
16 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
17 #include "ash/screen_util.h"
17 #include "ash/shelf/wm_shelf.h" 18 #include "ash/shelf/wm_shelf.h"
18 #include "ash/wm/overview/cleanup_animation_observer.h" 19 #include "ash/wm/overview/cleanup_animation_observer.h"
19 #include "ash/wm/overview/scoped_overview_animation_settings.h" 20 #include "ash/wm/overview/scoped_overview_animation_settings.h"
20 #include "ash/wm/overview/scoped_overview_animation_settings_factory.h" 21 #include "ash/wm/overview/scoped_overview_animation_settings_factory.h"
21 #include "ash/wm/overview/window_selector.h" 22 #include "ash/wm/overview/window_selector.h"
22 #include "ash/wm/overview/window_selector_delegate.h" 23 #include "ash/wm/overview/window_selector_delegate.h"
23 #include "ash/wm/overview/window_selector_item.h" 24 #include "ash/wm/overview/window_selector_item.h"
24 #include "ash/wm/window_state.h" 25 #include "ash/wm/window_state.h"
25 #include "ash/wm/window_state_aura.h" 26 #include "ash/wm/window_state_aura.h"
26 #include "ash/wm/wm_screen_util.h"
27 #include "ash/wm_window.h" 27 #include "ash/wm_window.h"
28 #include "base/command_line.h" 28 #include "base/command_line.h"
29 #include "base/i18n/string_search.h" 29 #include "base/i18n/string_search.h"
30 #include "base/memory/ptr_util.h" 30 #include "base/memory/ptr_util.h"
31 #include "base/strings/string_number_conversions.h" 31 #include "base/strings/string_number_conversions.h"
32 #include "third_party/skia/include/core/SkColor.h" 32 #include "third_party/skia/include/core/SkColor.h"
33 #include "third_party/skia/include/pathops/SkPathOps.h" 33 #include "third_party/skia/include/pathops/SkPathOps.h"
34 #include "ui/compositor/layer_animation_observer.h" 34 #include "ui/compositor/layer_animation_observer.h"
35 #include "ui/compositor/scoped_layer_animation_settings.h" 35 #include "ui/compositor/scoped_layer_animation_settings.h"
36 #include "ui/gfx/animation/tween.h" 36 #include "ui/gfx/animation/tween.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 336 }
337 337
338 void WindowGrid::PositionWindows(bool animate) { 338 void WindowGrid::PositionWindows(bool animate) {
339 if (window_selector_->is_shut_down() || window_list_.empty()) 339 if (window_selector_->is_shut_down() || window_list_.empty())
340 return; 340 return;
341 DCHECK(shield_widget_.get()); 341 DCHECK(shield_widget_.get());
342 // Keep the background shield widget covering the whole screen. 342 // Keep the background shield widget covering the whole screen.
343 WmWindow* widget_window = WmWindow::Get(shield_widget_->GetNativeWindow()); 343 WmWindow* widget_window = WmWindow::Get(shield_widget_->GetNativeWindow());
344 const gfx::Rect bounds = widget_window->GetParent()->GetBounds(); 344 const gfx::Rect bounds = widget_window->GetParent()->GetBounds();
345 widget_window->SetBounds(bounds); 345 widget_window->SetBounds(bounds);
346 gfx::Rect total_bounds = 346 gfx::Rect total_bounds = root_window_->ConvertRectToScreen(
347 root_window_->ConvertRectToScreen(wm::GetDisplayWorkAreaBoundsInParent( 347 ScreenUtil::GetDisplayWorkAreaBoundsInParent(
348 root_window_->GetChildByShellWindowId( 348 root_window_->GetChildByShellWindowId(kShellWindowId_DefaultContainer)
349 kShellWindowId_DefaultContainer))); 349 ->aura_window()));
350 // Windows occupy vertically centered area with additional vertical insets. 350 // Windows occupy vertically centered area with additional vertical insets.
351 int horizontal_inset = 351 int horizontal_inset =
352 gfx::ToFlooredInt(std::min(kOverviewInsetRatio * total_bounds.width(), 352 gfx::ToFlooredInt(std::min(kOverviewInsetRatio * total_bounds.width(),
353 kOverviewInsetRatio * total_bounds.height())); 353 kOverviewInsetRatio * total_bounds.height()));
354 int vertical_inset = 354 int vertical_inset =
355 horizontal_inset + 355 horizontal_inset +
356 kOverviewVerticalInset * (total_bounds.height() - 2 * horizontal_inset); 356 kOverviewVerticalInset * (total_bounds.height() - 2 * horizontal_inset);
357 total_bounds.Inset(std::max(0, horizontal_inset - kWindowMargin), 357 total_bounds.Inset(std::max(0, horizontal_inset - kWindowMargin),
358 std::max(0, vertical_inset - kWindowMargin)); 358 std::max(0, vertical_inset - kWindowMargin));
359 std::vector<gfx::Rect> rects; 359 std::vector<gfx::Rect> rects;
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 *min_right = left; 835 *min_right = left;
836 if (*max_right < left) 836 if (*max_right < left)
837 *max_right = left; 837 *max_right = left;
838 } 838 }
839 *max_bottom = top + height; 839 *max_bottom = top + height;
840 } 840 }
841 return windows_fit; 841 return windows_fit;
842 } 842 }
843 843
844 } // namespace ash 844 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698