diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 9e2c11aec4ab..f06841cb67ad 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -251,7 +251,7 @@ void NativeWindow::SetSizeConstraints( SetContentSizeConstraints(content_constraints); } -extensions::SizeConstraints NativeWindow::GetSizeConstraints() { +extensions::SizeConstraints NativeWindow::GetSizeConstraints() const { extensions::SizeConstraints content_constraints = GetContentSizeConstraints(); extensions::SizeConstraints window_constraints; if (content_constraints.HasMaximumSize()) { @@ -272,7 +272,7 @@ void NativeWindow::SetContentSizeConstraints( size_constraints_ = size_constraints; } -extensions::SizeConstraints NativeWindow::GetContentSizeConstraints() { +extensions::SizeConstraints NativeWindow::GetContentSizeConstraints() const { return size_constraints_; } @@ -282,7 +282,7 @@ void NativeWindow::SetMinimumSize(const gfx::Size& size) { SetSizeConstraints(size_constraints); } -gfx::Size NativeWindow::GetMinimumSize() { +gfx::Size NativeWindow::GetMinimumSize() const { return GetSizeConstraints().GetMinimumSize(); } @@ -292,7 +292,7 @@ void NativeWindow::SetMaximumSize(const gfx::Size& size) { SetSizeConstraints(size_constraints); } -gfx::Size NativeWindow::GetMaximumSize() { +gfx::Size NativeWindow::GetMaximumSize() const { return GetSizeConstraints().GetMaximumSize(); } diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index b0d25e03f232..f5aa5523bffa 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -98,14 +98,14 @@ class NativeWindow : public base::SupportsUserData, virtual gfx::Rect GetContentBounds(); virtual void SetSizeConstraints( const extensions::SizeConstraints& size_constraints); - virtual extensions::SizeConstraints GetSizeConstraints(); + virtual extensions::SizeConstraints GetSizeConstraints() const; virtual void SetContentSizeConstraints( const extensions::SizeConstraints& size_constraints); - virtual extensions::SizeConstraints GetContentSizeConstraints(); + virtual extensions::SizeConstraints GetContentSizeConstraints() const; virtual void SetMinimumSize(const gfx::Size& size); - virtual gfx::Size GetMinimumSize(); + virtual gfx::Size GetMinimumSize() const; virtual void SetMaximumSize(const gfx::Size& size); - virtual gfx::Size GetMaximumSize(); + virtual gfx::Size GetMaximumSize() const; virtual void SetSheetOffset(const double offsetX, const double offsetY); virtual double GetSheetOffsetX(); virtual double GetSheetOffsetY(); @@ -147,9 +147,9 @@ class NativeWindow : public base::SupportsUserData, virtual void SetMenu(AtomMenuModel* menu); virtual void SetParentWindow(NativeWindow* parent); virtual void SetBrowserView(NativeBrowserView* browser_view) = 0; - virtual gfx::NativeView GetNativeView() = 0; - virtual gfx::NativeWindow GetNativeWindow() = 0; - virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; + virtual gfx::NativeView GetNativeView() const = 0; + virtual gfx::NativeWindow GetNativeWindow() const = 0; + virtual gfx::AcceleratedWidget GetAcceleratedWidget() const = 0; // Taskbar/Dock APIs. enum ProgressState { @@ -281,8 +281,10 @@ class NativeWindow : public base::SupportsUserData, const std::vector& regions); // Converts between content bounds and window bounds. - virtual gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) = 0; - virtual gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) = 0; + virtual gfx::Rect ContentBoundsToWindowBounds( + const gfx::Rect& bounds) const = 0; + virtual gfx::Rect WindowBoundsToContentBounds( + const gfx::Rect& bounds) const = 0; // Called when the window needs to update its draggable region. virtual void UpdateDraggableRegions( diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 00f0befd50fa..81a846268211 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -924,11 +924,11 @@ void NativeWindowViews::SetParentWindow(NativeWindow* parent) { #endif } -gfx::NativeView NativeWindowViews::GetNativeView() { +gfx::NativeView NativeWindowViews::GetNativeView() const { return window_->GetNativeView(); } -gfx::NativeWindow NativeWindowViews::GetNativeWindow() { +gfx::NativeWindow NativeWindowViews::GetNativeWindow() const { return window_->GetNativeWindow(); } @@ -999,7 +999,7 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() { return false; } -gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() { +gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() const { return GetNativeWindow()->GetHost()->GetAcceleratedWidget(); } @@ -1180,7 +1180,7 @@ void NativeWindowViews::OnWidgetMove() { } gfx::Rect NativeWindowViews::ContentBoundsToWindowBounds( - const gfx::Rect& bounds) { + const gfx::Rect& bounds) const { if (!has_frame()) return bounds; @@ -1201,7 +1201,7 @@ gfx::Rect NativeWindowViews::ContentBoundsToWindowBounds( } gfx::Rect NativeWindowViews::WindowBoundsToContentBounds( - const gfx::Rect& bounds) { + const gfx::Rect& bounds) const { if (!has_frame()) return bounds; @@ -1306,11 +1306,11 @@ void NativeWindowViews::Layout() { } } -gfx::Size NativeWindowViews::GetMinimumSize() { +gfx::Size NativeWindowViews::GetMinimumSize() const { return NativeWindow::GetMinimumSize(); } -gfx::Size NativeWindowViews::GetMaximumSize() { +gfx::Size NativeWindowViews::GetMaximumSize() const { return NativeWindow::GetMaximumSize(); } diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 15bdbad18808..a7247e8fe004 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -106,8 +106,8 @@ class NativeWindowViews : public NativeWindow, void SetMenu(AtomMenuModel* menu_model) override; void SetBrowserView(NativeBrowserView* browser_view) override; void SetParentWindow(NativeWindow* parent) override; - gfx::NativeView GetNativeView() override; - gfx::NativeWindow GetNativeWindow() override; + gfx::NativeView GetNativeView() const override; + gfx::NativeWindow GetNativeWindow() const override; void SetOverlayIcon(const gfx::Image& overlay, const std::string& description) override; void SetProgressBar(double progress, const ProgressState state) override; @@ -118,7 +118,7 @@ class NativeWindowViews : public NativeWindow, void SetVisibleOnAllWorkspaces(bool visible) override; bool IsVisibleOnAllWorkspaces() override; - gfx::AcceleratedWidget GetAcceleratedWidget() override; + gfx::AcceleratedWidget GetAcceleratedWidget() const override; #if defined(OS_WIN) void SetIcon(HICON small_icon, HICON app_icon); @@ -171,16 +171,16 @@ class NativeWindowViews : public NativeWindow, #endif // NativeWindow: - gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) override; - gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) override; + gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override; + gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override; void HandleKeyboardEvent( content::WebContents*, const content::NativeWebKeyboardEvent& event) override; // views::View: void Layout() override; - gfx::Size GetMinimumSize() override; - gfx::Size GetMaximumSize() override; + gfx::Size GetMinimumSize() const override; + gfx::Size GetMaximumSize() const override; bool AcceleratorPressed(const ui::Accelerator& accelerator) override; // Register accelerators supported by the menu model.