Commit 03f91d5f authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Make functions named XXXInWindow() actually use a NativeWindow.

That seems more consistent to me.

Bug: none
Change-Id: I962a8e1eee04a33436157dc132e81e0231c0d088
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147079Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758525}
parent 98fd13bd
...@@ -53,15 +53,15 @@ void Screen::SetDisplayForNewWindows(int64_t display_id) { ...@@ -53,15 +53,15 @@ void Screen::SetDisplayForNewWindows(int64_t display_id) {
display_id_for_new_windows_ = display_id; display_id_for_new_windows_ = display_id;
} }
gfx::Rect Screen::ScreenToDIPRectInWindow(gfx::NativeView view, gfx::Rect Screen::ScreenToDIPRectInWindow(gfx::NativeWindow window,
const gfx::Rect& screen_rect) const { const gfx::Rect& screen_rect) const {
float scale = GetDisplayNearestView(view).device_scale_factor(); float scale = GetDisplayNearestWindow(window).device_scale_factor();
return ScaleToEnclosingRect(screen_rect, 1.0f / scale); return ScaleToEnclosingRect(screen_rect, 1.0f / scale);
} }
gfx::Rect Screen::DIPToScreenRectInWindow(gfx::NativeView view, gfx::Rect Screen::DIPToScreenRectInWindow(gfx::NativeWindow window,
const gfx::Rect& dip_rect) const { const gfx::Rect& dip_rect) const {
float scale = GetDisplayNearestView(view).device_scale_factor(); float scale = GetDisplayNearestWindow(window).device_scale_factor();
return ScaleToEnclosingRect(dip_rect, scale); return ScaleToEnclosingRect(dip_rect, scale);
} }
......
...@@ -90,16 +90,18 @@ class DISPLAY_EXPORT Screen { ...@@ -90,16 +90,18 @@ class DISPLAY_EXPORT Screen {
virtual void AddObserver(DisplayObserver* observer) = 0; virtual void AddObserver(DisplayObserver* observer) = 0;
virtual void RemoveObserver(DisplayObserver* observer) = 0; virtual void RemoveObserver(DisplayObserver* observer) = 0;
// Converts |screen_rect| to DIP coordinates in the context of |view| clamping // Converts |screen_rect| to DIP coordinates in the context of |window|
// to the enclosing rect if the coordinates do not fall on pixel boundaries. // clamping to the enclosing rect if the coordinates do not fall on pixel
// If |view| is null, the primary display is used as the context. // boundaries. If |window| is null, the primary display is used as the
virtual gfx::Rect ScreenToDIPRectInWindow(gfx::NativeView view, // context.
virtual gfx::Rect ScreenToDIPRectInWindow(gfx::NativeWindow window,
const gfx::Rect& screen_rect) const; const gfx::Rect& screen_rect) const;
// Converts |dip_rect| to screen coordinates in the context of |view| clamping // Converts |dip_rect| to screen coordinates in the context of |window|
// to the enclosing rect if the coordinates do not fall on pixel boundaries. // clamping to the enclosing rect if the coordinates do not fall on pixel
// If |view| is null, the primary display is used as the context. // boundaries. If |window| is null, the primary display is used as the
virtual gfx::Rect DIPToScreenRectInWindow(gfx::NativeView view, // context.
virtual gfx::Rect DIPToScreenRectInWindow(gfx::NativeWindow window,
const gfx::Rect& dip_rect) const; const gfx::Rect& dip_rect) const;
// Returns true if the display with |display_id| is found and returns that // Returns true if the display with |display_id| is found and returns that
......
...@@ -635,7 +635,7 @@ void ScreenWin::SetHDREnabled(bool hdr_enabled) { ...@@ -635,7 +635,7 @@ void ScreenWin::SetHDREnabled(bool hdr_enabled) {
} }
} }
HWND ScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { HWND ScreenWin::GetHWNDFromNativeWindow(gfx::NativeWindow window) const {
NOTREACHED(); NOTREACHED();
return nullptr; return nullptr;
} }
...@@ -678,7 +678,7 @@ const std::vector<Display>& ScreenWin::GetAllDisplays() const { ...@@ -678,7 +678,7 @@ const std::vector<Display>& ScreenWin::GetAllDisplays() const {
} }
Display ScreenWin::GetDisplayNearestWindow(gfx::NativeWindow window) const { Display ScreenWin::GetDisplayNearestWindow(gfx::NativeWindow window) const {
const HWND window_hwnd = window ? GetHWNDFromNativeView(window) : nullptr; const HWND window_hwnd = window ? GetHWNDFromNativeWindow(window) : nullptr;
// When |window| isn't rooted to a display, we should just return the default // When |window| isn't rooted to a display, we should just return the default
// display so we get some correct display information like the scaling factor. // display so we get some correct display information like the scaling factor.
return window_hwnd ? GetScreenWinDisplayNearestHWND(window_hwnd).display() return window_hwnd ? GetScreenWinDisplayNearestHWND(window_hwnd).display()
...@@ -707,15 +707,15 @@ void ScreenWin::RemoveObserver(DisplayObserver* observer) { ...@@ -707,15 +707,15 @@ void ScreenWin::RemoveObserver(DisplayObserver* observer) {
} }
gfx::Rect ScreenWin::ScreenToDIPRectInWindow( gfx::Rect ScreenWin::ScreenToDIPRectInWindow(
gfx::NativeView view, gfx::NativeWindow window,
const gfx::Rect& screen_rect) const { const gfx::Rect& screen_rect) const {
const HWND hwnd = view ? GetHWNDFromNativeView(view) : nullptr; const HWND hwnd = window ? GetHWNDFromNativeWindow(window) : nullptr;
return ScreenToDIPRect(hwnd, screen_rect); return ScreenToDIPRect(hwnd, screen_rect);
} }
gfx::Rect ScreenWin::DIPToScreenRectInWindow(gfx::NativeView view, gfx::Rect ScreenWin::DIPToScreenRectInWindow(gfx::NativeWindow window,
const gfx::Rect& dip_rect) const { const gfx::Rect& dip_rect) const {
const HWND hwnd = view ? GetHWNDFromNativeView(view) : nullptr; const HWND hwnd = window ? GetHWNDFromNativeWindow(window) : nullptr;
return DIPToScreenRect(hwnd, dip_rect); return DIPToScreenRect(hwnd, dip_rect);
} }
......
...@@ -148,10 +148,10 @@ class DISPLAY_EXPORT ScreenWin : public Screen, ...@@ -148,10 +148,10 @@ class DISPLAY_EXPORT ScreenWin : public Screen,
// to return that HDR is supported. // to return that HDR is supported.
static void SetHDREnabled(bool hdr_enabled); static void SetHDREnabled(bool hdr_enabled);
// Returns the HWND associated with the NativeView. // Returns the HWND associated with the NativeWindow.
virtual HWND GetHWNDFromNativeView(gfx::NativeView view) const; virtual HWND GetHWNDFromNativeWindow(gfx::NativeWindow view) const;
// Returns the NativeView associated with the HWND. // Returns the NativeWindow associated with the HWND.
virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const;
protected: protected:
...@@ -170,9 +170,10 @@ class DISPLAY_EXPORT ScreenWin : public Screen, ...@@ -170,9 +170,10 @@ class DISPLAY_EXPORT ScreenWin : public Screen,
void AddObserver(DisplayObserver* observer) override; void AddObserver(DisplayObserver* observer) override;
void RemoveObserver(DisplayObserver* observer) override; void RemoveObserver(DisplayObserver* observer) override;
gfx::Rect ScreenToDIPRectInWindow( gfx::Rect ScreenToDIPRectInWindow(
gfx::NativeView view, const gfx::Rect& screen_rect) const override; gfx::NativeWindow window,
gfx::Rect DIPToScreenRectInWindow( const gfx::Rect& screen_rect) const override;
gfx::NativeView view, const gfx::Rect& dip_rect) const override; gfx::Rect DIPToScreenRectInWindow(gfx::NativeWindow window,
const gfx::Rect& dip_rect) const override;
// ColorProfileReader::Client: // ColorProfileReader::Client:
void OnColorProfilesChanged() override; void OnColorProfilesChanged() override;
......
// Copyright 2015 The Chromium Authors. All rights reserved. // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -43,9 +43,9 @@ class TestScreenWin : public ScreenWin { ...@@ -43,9 +43,9 @@ class TestScreenWin : public ScreenWin {
protected: protected:
// win::ScreenWin: // win::ScreenWin:
HWND GetHWNDFromNativeView(gfx::NativeView window) const override { HWND GetHWNDFromNativeWindow(gfx::NativeWindow window) const override {
// NativeView is only used as an identifier in these tests, so interchange // NativeWindow is only used as an identifier in these tests, so interchange
// a NativeView for an HWND for convenience. // a NativeWindow for an HWND for convenience.
return reinterpret_cast<HWND>(window); return reinterpret_cast<HWND>(window);
} }
......
...@@ -29,7 +29,7 @@ display::Display DesktopScreenWin::GetDisplayMatching( ...@@ -29,7 +29,7 @@ display::Display DesktopScreenWin::GetDisplayMatching(
return GetDisplayNearestPoint(match_rect.CenterPoint()); return GetDisplayNearestPoint(match_rect.CenterPoint());
} }
HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { HWND DesktopScreenWin::GetHWNDFromNativeWindow(gfx::NativeWindow window) const {
aura::WindowTreeHost* host = window->GetHost(); aura::WindowTreeHost* host = window->GetHost();
return host ? host->GetAcceleratedWidget() : nullptr; return host ? host->GetAcceleratedWidget() : nullptr;
} }
......
...@@ -20,7 +20,7 @@ class VIEWS_EXPORT DesktopScreenWin : public display::win::ScreenWin { ...@@ -20,7 +20,7 @@ class VIEWS_EXPORT DesktopScreenWin : public display::win::ScreenWin {
// Overridden from display::win::ScreenWin: // Overridden from display::win::ScreenWin:
display::Display GetDisplayMatching( display::Display GetDisplayMatching(
const gfx::Rect& match_rect) const override; const gfx::Rect& match_rect) const override;
HWND GetHWNDFromNativeView(gfx::NativeView window) const override; HWND GetHWNDFromNativeWindow(gfx::NativeWindow window) const override;
gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const override; gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const override;
DISALLOW_COPY_AND_ASSIGN(DesktopScreenWin); DISALLOW_COPY_AND_ASSIGN(DesktopScreenWin);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment