Skip to content

Commit

Permalink
Remove now-unnecessary wrappers around gfx::Screen::GetScreen()
Browse files Browse the repository at this point in the history
- ash::Shell::GetScreen()
- DisplayInfoProvider::GetActiveScreen()

Followup to https://codereview.chromium.org/1608733002/.

R=oshima@chromium.org, sky@chromium.org
BUG=558054

Review URL: https://codereview.chromium.org/1608053002

Cr-Commit-Position: refs/heads/master@{#371733}
  • Loading branch information
sgraham authored and Commit bot committed Jan 27, 2016
1 parent fc512ff commit e8b0429
Show file tree
Hide file tree
Showing 109 changed files with 588 additions and 513 deletions.
5 changes: 3 additions & 2 deletions ash/accelerators/accelerator_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ void HandleRotateScreen() {
return;

base::RecordAction(UserMetricsAction("Accel_Rotate_Window"));
gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point);
gfx::Point point = gfx::Screen::GetScreen()->GetCursorScreenPoint();
gfx::Display display =
gfx::Screen::GetScreen()->GetDisplayNearestPoint(point);
const DisplayInfo& display_info =
Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id());
ash::ScreenRotationAnimator(display.id())
Expand Down
5 changes: 3 additions & 2 deletions ash/accelerators/accelerator_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,9 @@ TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) {

// Center the window using accelerator.
GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER);
gfx::Rect work_area =
Shell::GetScreen()->GetDisplayNearestWindow(window.get()).work_area();
gfx::Rect work_area = gfx::Screen::GetScreen()
->GetDisplayNearestWindow(window.get())
.work_area();
gfx::Rect bounds = window->GetBoundsInScreen();
EXPECT_NEAR(bounds.x() - work_area.x(),
work_area.right() - bounds.right(),
Expand Down
4 changes: 2 additions & 2 deletions ash/content/keyboard_overlay/keyboard_overlay_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ views::Widget* KeyboardOverlayDelegate::Show(views::WebDialogView* view) {
gfx::Size size;
GetDialogSize(&size);
const gfx::Rect& rect =
Shell::GetScreen()
gfx::Screen::GetScreen()
->GetDisplayNearestWindow(widget_->GetNativeView())
.work_area();
gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2,
Expand Down Expand Up @@ -108,7 +108,7 @@ void KeyboardOverlayDelegate::GetWebUIMessageHandlers(
void KeyboardOverlayDelegate::GetDialogSize(gfx::Size* size) const {
using std::min;
DCHECK(widget_);
gfx::Rect rect = ash::Shell::GetScreen()
gfx::Rect rect = gfx::Screen::GetScreen()
->GetDisplayNearestWindow(widget_->GetNativeView())
.work_area();
const int width = min(kBaseWidth, rect.width() - kHorizontalMargin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ TEST_P(KeyboardOverlayDelegateTest, ShowAndClose) {
widget->GetNativeWindow()->GetRootWindow());

// The widget is horizontally centered at the bottom of the work area.
gfx::Rect work_area = Shell::GetScreen()->GetPrimaryDisplay().work_area();
gfx::Rect work_area =
gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area();
gfx::Rect bounds = widget->GetRestoredBounds();
EXPECT_EQ(work_area.CenterPoint().x(), bounds.CenterPoint().x());
EXPECT_EQ(work_area.bottom(), bounds.bottom());
Expand Down
4 changes: 3 additions & 1 deletion ash/desktop_background/desktop_background_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"

using wallpaper::WallpaperResizer;
Expand Down Expand Up @@ -162,7 +163,8 @@ void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) {
gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() {
int width = 0;
int height = 0;
std::vector<gfx::Display> displays = Shell::GetScreen()->GetAllDisplays();
std::vector<gfx::Display> displays =
gfx::Screen::GetScreen()->GetAllDisplays();
DisplayManager* display_manager = Shell::GetInstance()->display_manager();

for (std::vector<gfx::Display>::iterator iter = displays.begin();
Expand Down
3 changes: 2 additions & 1 deletion ash/desktop_background/desktop_background_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "ui/gfx/geometry/safe_integer_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/transform.h"
#include "ui/views/widget/widget.h"

Expand Down Expand Up @@ -52,7 +53,7 @@ class LayerControlView : public views::View {

// Overrides views::View.
void Layout() override {
gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow(
gfx::Display display = gfx::Screen::GetScreen()->GetDisplayNearestWindow(
GetWidget()->GetNativeView());
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
DisplayInfo info = display_manager->GetDisplayInfo(display.id());
Expand Down
4 changes: 2 additions & 2 deletions ash/dip_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ TEST_F(DIPTest, WorkArea) {

aura::Window* root = Shell::GetPrimaryRootWindow();
const gfx::Display display =
Shell::GetScreen()->GetDisplayNearestWindow(root);
gfx::Screen::GetScreen()->GetDisplayNearestWindow(root);

EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
gfx::Rect work_area = display.work_area();
EXPECT_EQ("0,0 1000x853", work_area.ToString());
EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString());

UpdateDisplay("2000x1800*2.0f");
gfx::Screen* screen = Shell::GetScreen();
gfx::Screen* screen = gfx::Screen::GetScreen();

const gfx::Display display_2x = screen->GetDisplayNearestWindow(root);
const DisplayInfo display_info_2x =
Expand Down
5 changes: 3 additions & 2 deletions ash/display/cursor_window_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/screen.h"

namespace ash {

Expand Down Expand Up @@ -101,7 +102,7 @@ void CursorWindowController::SetCursorCompositingEnabled(bool enabled) {

void CursorWindowController::UpdateContainer() {
if (is_cursor_compositing_enabled_) {
gfx::Screen* screen = Shell::GetScreen();
gfx::Screen* screen = gfx::Screen::GetScreen();
gfx::Display display = screen->GetDisplayNearestPoint(
screen->GetCursorScreenPoint());
DCHECK(display.is_valid());
Expand All @@ -113,7 +114,7 @@ void CursorWindowController::UpdateContainer() {
->mirror_window_controller()
->GetWindow();
if (mirror_window)
display_ = Shell::GetScreen()->GetPrimaryDisplay();
display_ = gfx::Screen::GetScreen()->GetPrimaryDisplay();
SetContainer(mirror_window);
}
// Updates the hot point based on the current display.
Expand Down
12 changes: 7 additions & 5 deletions ash/display/cursor_window_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,19 @@ TEST_F(CursorWindowControllerTest, VisibilityTest) {
// the DSF becomes 1x as a result of zooming out.
TEST_F(CursorWindowControllerTest, DSF) {
UpdateDisplay("1000x500*2");
int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id();
int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();

test::ScopedSetInternalDisplayId set_internal(primary_id);
SetCursorCompositionEnabled(true);
ASSERT_EQ(2.0f,
Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
ASSERT_EQ(
2.0f,
gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f));

ASSERT_TRUE(SetDisplayUIScale(primary_id, 2.0f));
ASSERT_EQ(1.0f,
Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor());
ASSERT_EQ(
1.0f,
gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f));
}
#endif
Expand Down
Loading

0 comments on commit e8b0429

Please sign in to comment.