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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/window_overview.h ('k') | ash/wm/overview/window_selector.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_overview.h" 5 #include "ash/wm/overview/window_overview.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 void CleanupWidgetAfterAnimationObserver::OnLayerAnimationScheduled( 112 void CleanupWidgetAfterAnimationObserver::OnLayerAnimationScheduled(
113 ui::LayerAnimationSequence* sequence) { 113 ui::LayerAnimationSequence* sequence) {
114 } 114 }
115 115
116 } // namespace 116 } // namespace
117 117
118 WindowOverview::WindowOverview(WindowSelector* window_selector, 118 WindowOverview::WindowOverview(WindowSelector* window_selector,
119 WindowSelectorItemList* windows, 119 WindowSelectorItemList* windows,
120 aura::RootWindow* single_root_window) 120 aura::Window* single_root_window)
121 : window_selector_(window_selector), 121 : window_selector_(window_selector),
122 windows_(windows), 122 windows_(windows),
123 selection_index_(0), 123 selection_index_(0),
124 single_root_window_(single_root_window), 124 single_root_window_(single_root_window),
125 overview_start_time_(base::Time::Now()), 125 overview_start_time_(base::Time::Now()),
126 cursor_client_(NULL) { 126 cursor_client_(NULL) {
127 for (WindowSelectorItemList::iterator iter = windows_->begin(); 127 for (WindowSelectorItemList::iterator iter = windows_->begin();
128 iter != windows_->end(); ++iter) { 128 iter != windows_->end(); ++iter) {
129 (*iter)->PrepareForOverview(); 129 (*iter)->PrepareForOverview();
130 } 130 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 selection_widget_->GetNativeWindow()->layer()->SetOpacity( 232 selection_widget_->GetNativeWindow()->layer()->SetOpacity(
233 kWindowOverviewSelectionOpacity); 233 kWindowOverviewSelectionOpacity);
234 } 234 }
235 selection_index_ = index; 235 selection_index_ = index;
236 } 236 }
237 237
238 void WindowOverview::OnWindowsChanged() { 238 void WindowOverview::OnWindowsChanged() {
239 PositionWindows(); 239 PositionWindows();
240 } 240 }
241 241
242 void WindowOverview::MoveToSingleRootWindow(aura::RootWindow* root_window) { 242 void WindowOverview::MoveToSingleRootWindow(aura::Window* root_window) {
243 single_root_window_ = root_window; 243 single_root_window_ = root_window;
244 PositionWindows(); 244 PositionWindows();
245 } 245 }
246 246
247 void WindowOverview::OnKeyEvent(ui::KeyEvent* event) { 247 void WindowOverview::OnKeyEvent(ui::KeyEvent* event) {
248 if (GetTargetedWindow(static_cast<aura::Window*>(event->target()))) 248 if (GetTargetedWindow(static_cast<aura::Window*>(event->target())))
249 event->StopPropagation(); 249 event->StopPropagation();
250 if (event->type() != ui::ET_KEY_PRESSED) 250 if (event->type() != ui::ET_KEY_PRESSED)
251 return; 251 return;
252 252
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 windows.push_back(*iter); 341 windows.push_back(*iter);
342 } 342 }
343 PositionWindowsOnRoot(single_root_window_, windows); 343 PositionWindowsOnRoot(single_root_window_, windows);
344 } else { 344 } else {
345 Shell::RootWindowList root_window_list = Shell::GetAllRootWindows(); 345 Shell::RootWindowList root_window_list = Shell::GetAllRootWindows();
346 for (size_t i = 0; i < root_window_list.size(); ++i) 346 for (size_t i = 0; i < root_window_list.size(); ++i)
347 PositionWindowsFromRoot(root_window_list[i]); 347 PositionWindowsFromRoot(root_window_list[i]);
348 } 348 }
349 } 349 }
350 350
351 void WindowOverview::PositionWindowsFromRoot(aura::RootWindow* root_window) { 351 void WindowOverview::PositionWindowsFromRoot(aura::Window* root_window) {
352 std::vector<WindowSelectorItem*> windows; 352 std::vector<WindowSelectorItem*> windows;
353 for (WindowSelectorItemList::iterator iter = windows_->begin(); 353 for (WindowSelectorItemList::iterator iter = windows_->begin();
354 iter != windows_->end(); ++iter) { 354 iter != windows_->end(); ++iter) {
355 if ((*iter)->GetRootWindow() == root_window) 355 if ((*iter)->GetRootWindow() == root_window)
356 windows.push_back(*iter); 356 windows.push_back(*iter);
357 } 357 }
358 PositionWindowsOnRoot(root_window, windows); 358 PositionWindowsOnRoot(root_window, windows);
359 } 359 }
360 360
361 void WindowOverview::PositionWindowsOnRoot( 361 void WindowOverview::PositionWindowsOnRoot(
362 aura::RootWindow* root_window, 362 aura::Window* root_window,
363 const std::vector<WindowSelectorItem*>& windows) { 363 const std::vector<WindowSelectorItem*>& windows) {
364 if (windows.empty()) 364 if (windows.empty())
365 return; 365 return;
366 366
367 gfx::Size window_size; 367 gfx::Size window_size;
368 gfx::Rect total_bounds = ScreenAsh::ConvertRectToScreen(root_window, 368 gfx::Rect total_bounds = ScreenAsh::ConvertRectToScreen(root_window,
369 ScreenAsh::GetDisplayWorkAreaBoundsInParent( 369 ScreenAsh::GetDisplayWorkAreaBoundsInParent(
370 Shell::GetContainer(root_window, 370 Shell::GetContainer(root_window,
371 internal::kShellWindowId_DefaultContainer))); 371 internal::kShellWindowId_DefaultContainer)));
372 372
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 427 }
428 428
429 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { 429 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) {
430 gfx::Rect bounds((*windows_)[index]->bounds()); 430 gfx::Rect bounds((*windows_)[index]->bounds());
431 bounds.Inset(-kWindowOverviewSelectionPadding, 431 bounds.Inset(-kWindowOverviewSelectionPadding,
432 -kWindowOverviewSelectionPadding); 432 -kWindowOverviewSelectionPadding);
433 return bounds; 433 return bounds;
434 } 434 }
435 435
436 } // namespace ash 436 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_overview.h ('k') | ash/wm/overview/window_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698