Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / views / apps / native_app_window_frame_view_mac.mm
blob444a6df4035c9770e18b577ca1e5c8d7574335ed
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/apps/native_app_window_frame_view_mac.h"
7 #import <Cocoa/Cocoa.h>
9 #import "ui/gfx/mac/coordinate_conversion.h"
10 #include "ui/views/widget/widget.h"
12 NativeAppWindowFrameViewMac::NativeAppWindowFrameViewMac(views::Widget* frame)
13     : views::NativeFrameView(frame) {
16 NativeAppWindowFrameViewMac::~NativeAppWindowFrameViewMac() {
19 gfx::Rect NativeAppWindowFrameViewMac::GetWindowBoundsForClientBounds(
20     const gfx::Rect& client_bounds) const {
21   NSWindow* ns_window = GetWidget()->GetNativeWindow();
22   gfx::Rect window_bounds = gfx::ScreenRectFromNSRect([ns_window
23       frameRectForContentRect:gfx::ScreenRectToNSRect(client_bounds)]);
24   // Enforce minimum size (1, 1) in case that |client_bounds| is passed with
25   // empty size.
26   if (window_bounds.IsEmpty())
27     window_bounds.set_size(gfx::Size(1, 1));
28   return window_bounds;