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

Unified Diff: ui/views/window/native_frame_view.cc

Issue 274273004: Use the native frame for the task manager on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed mgiuca@'s nits Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/window/native_frame_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/native_frame_view.cc
diff --git a/ui/views/window/native_frame_view.cc b/ui/views/window/native_frame_view.cc
index 1cbafabe57b22c489f7196dfcbf8d524ae882913..cabc7c04000b4cbd46e5dea8c3aab61c72510839 100644
--- a/ui/views/window/native_frame_view.cc
+++ b/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,12 +70,18 @@ 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 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() {
@@ -79,4 +92,8 @@ gfx::Size NativeFrameView::GetMaximumSize() {
return frame_->client_view()->GetMaximumSize();
}
+const char* NativeFrameView::GetClassName() const {
+ return kViewClassName;
+}
+
} // namespace views
« no previous file with comments | « ui/views/window/native_frame_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698