summaryrefslogtreecommitdiffstats
path: root/chromium/ui/views/window/native_frame_view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/views/window/native_frame_view.cc')
-rw-r--r--chromium/ui/views/window/native_frame_view.cc37
1 files changed, 27 insertions, 10 deletions
diff --git a/chromium/ui/views/window/native_frame_view.cc b/chromium/ui/views/window/native_frame_view.cc
index 1cbafabe57b..1ffbcdbb02b 100644
--- a/chromium/ui/views/window/native_frame_view.cc
+++ b/chromium/ui/views/window/native_frame_view.cc
@@ -16,6 +16,9 @@ namespace views {
////////////////////////////////////////////////////////////////////////////////
// NativeFrameView, public:
+// static
+const char NativeFrameView::kViewClassName[] = "NativeFrameView";
+
NativeFrameView::NativeFrameView(Widget* frame)
: NonClientFrameView(),
frame_(frame) {
@@ -37,8 +40,12 @@ gfx::Rect NativeFrameView::GetWindowBoundsForClientBounds(
return views::GetWindowBoundsForClientBounds(
static_cast<View*>(const_cast<NativeFrameView*>(this)), client_bounds);
#else
- // TODO(sad):
- return client_bounds;
+ // Enforce minimum size (1, 1) in case that |client_bounds| is passed with
+ // empty size.
+ gfx::Rect window_bounds = client_bounds;
+ if (window_bounds.IsEmpty())
+ window_bounds.set_size(gfx::Size(1,1));
+ return window_bounds;
#endif
}
@@ -63,20 +70,30 @@ void NativeFrameView::UpdateWindowTitle() {
// Nothing to do.
}
-// Returns the client size. On Windows, this is the expected behavior for
-// native frames (see |NativeWidgetWin::WidgetSizeIsClientSize()|), while other
-// platforms currently always return client bounds from
-// |GetWindowBoundsForClientBounds()|.
-gfx::Size NativeFrameView::GetPreferredSize() {
- return frame_->client_view()->GetPreferredSize();
+gfx::Size NativeFrameView::GetPreferredSize() const {
+ gfx::Size client_preferred_size = frame_->client_view()->GetPreferredSize();
+#if defined(OS_WIN)
+ // Returns the client size. On Windows, this is the expected behavior for
+ // native frames (see |NativeWidgetWin::WidgetSizeIsClientSize()|), while
+ // other platforms currently always return client bounds from
+ // |GetWindowBoundsForClientBounds()|.
+ return client_preferred_size;
+#else
+ return frame_->non_client_view()->GetWindowBoundsForClientBounds(
+ gfx::Rect(client_preferred_size)).size();
+#endif
}
-gfx::Size NativeFrameView::GetMinimumSize() {
+gfx::Size NativeFrameView::GetMinimumSize() const {
return frame_->client_view()->GetMinimumSize();
}
-gfx::Size NativeFrameView::GetMaximumSize() {
+gfx::Size NativeFrameView::GetMaximumSize() const {
return frame_->client_view()->GetMaximumSize();
}
+const char* NativeFrameView::GetClassName() const {
+ return kViewClassName;
+}
+
} // namespace views