ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / ui / web_contents_sizer.mm
blob46d3e861d4db7e6cfa4bca75b5e3adc2ad1920e8
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/web_contents_sizer.h"
7 #import <Cocoa/Cocoa.h>
9 #include "content/public/browser/web_contents.h"
11 void ResizeWebContents(content::WebContents* web_contents,
12                        const gfx::Size& new_size) {
13   NSView* view = web_contents->GetNativeView();
14   NSRect old_wcv_frame = [view frame];
15   CGFloat new_x = old_wcv_frame.origin.x;
16   CGFloat new_y =
17       old_wcv_frame.origin.y + (old_wcv_frame.size.height - new_size.height());
18   NSRect new_wcv_frame =
19       NSMakeRect(new_x, new_y, new_size.width(), new_size.height());
20   [view setFrame:new_wcv_frame];