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

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

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/overlay_event_filter.cc ('k') | ash/wm/overview/window_selector.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 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/metrics/user_metrics_recorder.h" 9 #include "ash/metrics/user_metrics_recorder.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 PositionWindowsOnRoot(root_window, windows); 382 PositionWindowsOnRoot(root_window, windows);
383 } 383 }
384 384
385 void WindowOverview::PositionWindowsOnRoot( 385 void WindowOverview::PositionWindowsOnRoot(
386 aura::Window* root_window, 386 aura::Window* root_window,
387 const std::vector<WindowSelectorItem*>& windows) { 387 const std::vector<WindowSelectorItem*>& windows) {
388 if (windows.empty()) 388 if (windows.empty())
389 return; 389 return;
390 390
391 gfx::Size window_size; 391 gfx::Size window_size;
392 gfx::Rect total_bounds = ScreenUtil::ConvertRectToScreen(root_window, 392 gfx::Rect total_bounds = ScreenUtil::ConvertRectToScreen(
393 root_window,
393 ScreenUtil::GetDisplayWorkAreaBoundsInParent( 394 ScreenUtil::GetDisplayWorkAreaBoundsInParent(
394 Shell::GetContainer(root_window, 395 Shell::GetContainer(root_window, kShellWindowId_DefaultContainer)));
395 internal::kShellWindowId_DefaultContainer)));
396 396
397 // Find the minimum number of windows per row that will fit all of the 397 // Find the minimum number of windows per row that will fit all of the
398 // windows on screen. 398 // windows on screen.
399 size_t columns = std::max( 399 size_t columns = std::max(
400 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1, 400 total_bounds.width() > total_bounds.height() ? kMinCardsMajor : 1,
401 static_cast<int>(ceil(sqrt(total_bounds.width() * windows.size() / 401 static_cast<int>(ceil(sqrt(total_bounds.width() * windows.size() /
402 (kCardAspectRatio * total_bounds.height()))))); 402 (kCardAspectRatio * total_bounds.height())))));
403 size_t rows = ((windows.size() + columns - 1) / columns); 403 size_t rows = ((windows.size() + columns - 1) / columns);
404 window_size.set_width(std::min( 404 window_size.set_width(std::min(
405 static_cast<int>(total_bounds.width() / columns), 405 static_cast<int>(total_bounds.width() / columns),
(...skipping 20 matching lines...) Expand all
426 } 426 }
427 427
428 void WindowOverview::InitializeSelectionWidget() { 428 void WindowOverview::InitializeSelectionWidget() {
429 selection_widget_.reset(new views::Widget); 429 selection_widget_.reset(new views::Widget);
430 views::Widget::InitParams params; 430 views::Widget::InitParams params;
431 params.type = views::Widget::InitParams::TYPE_POPUP; 431 params.type = views::Widget::InitParams::TYPE_POPUP;
432 params.can_activate = false; 432 params.can_activate = false;
433 params.keep_on_top = false; 433 params.keep_on_top = false;
434 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 434 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
435 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; 435 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
436 params.parent = Shell::GetContainer( 436 params.parent = Shell::GetContainer(single_root_window_
437 single_root_window_ ? single_root_window_ : 437 ? single_root_window_
438 windows_->front()->GetRootWindow(), 438 : windows_->front()->GetRootWindow(),
439 internal::kShellWindowId_DefaultContainer); 439 kShellWindowId_DefaultContainer);
440 params.accept_events = false; 440 params.accept_events = false;
441 selection_widget_->set_focus_on_creation(false); 441 selection_widget_->set_focus_on_creation(false);
442 selection_widget_->Init(params); 442 selection_widget_->Init(params);
443 views::View* content_view = new views::View; 443 views::View* content_view = new views::View;
444 content_view->set_background( 444 content_view->set_background(
445 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); 445 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor));
446 selection_widget_->SetContentsView(content_view); 446 selection_widget_->SetContentsView(content_view);
447 selection_widget_->Show(); 447 selection_widget_->Show();
448 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( 448 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom(
449 selection_widget_->GetNativeWindow()); 449 selection_widget_->GetNativeWindow());
450 selection_widget_->GetNativeWindow()->layer()->SetOpacity(0); 450 selection_widget_->GetNativeWindow()->layer()->SetOpacity(0);
451 } 451 }
452 452
453 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { 453 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) {
454 gfx::Rect bounds((*windows_)[index]->bounds()); 454 gfx::Rect bounds((*windows_)[index]->bounds());
455 bounds.Inset(-kWindowOverviewSelectionPadding, 455 bounds.Inset(-kWindowOverviewSelectionPadding,
456 -kWindowOverviewSelectionPadding); 456 -kWindowOverviewSelectionPadding);
457 return bounds; 457 return bounds;
458 } 458 }
459 459
460 } // namespace ash 460 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overlay_event_filter.cc ('k') | ash/wm/overview/window_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698