OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "apps/ui/web_contents_sizer.h" | 5 #include "chrome/browser/ui/web_contents_sizer.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 | 10 |
11 namespace apps { | |
12 | |
13 void ResizeWebContents(content::WebContents* web_contents, | 11 void ResizeWebContents(content::WebContents* web_contents, |
14 const gfx::Size& new_size) { | 12 const gfx::Size& new_size) { |
15 NSView* view = web_contents->GetNativeView(); | 13 NSView* view = web_contents->GetNativeView(); |
16 NSRect old_wcv_frame = [view frame]; | 14 NSRect old_wcv_frame = [view frame]; |
17 CGFloat new_x = old_wcv_frame.origin.x; | 15 CGFloat new_x = old_wcv_frame.origin.x; |
18 CGFloat new_y = | 16 CGFloat new_y = |
19 old_wcv_frame.origin.y + (old_wcv_frame.size.height - new_size.height()); | 17 old_wcv_frame.origin.y + (old_wcv_frame.size.height - new_size.height()); |
20 NSRect new_wcv_frame = | 18 NSRect new_wcv_frame = |
21 NSMakeRect(new_x, new_y, new_size.width(), new_size.height()); | 19 NSMakeRect(new_x, new_y, new_size.width(), new_size.height()); |
22 [view setFrame:new_wcv_frame]; | 20 [view setFrame:new_wcv_frame]; |
23 } | 21 } |
24 | |
25 } // namespace apps | |
OLD | NEW |