1 // Copyright (c) 2012 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/cocoa/notifications/balloon_view_host_mac.h"
7 #import <Cocoa/Cocoa.h>
9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h"
13 BalloonViewHost::BalloonViewHost(Balloon* balloon)
14 : BalloonHost(balloon) {
17 BalloonViewHost::~BalloonViewHost() {
21 void BalloonViewHost::UpdateActualSize(const gfx::Size& new_size) {
22 web_contents_->GetView()->SizeContents(new_size);
23 NSView* view = native_view();
24 NSRect frame = [view frame];
25 frame.size.width = new_size.width();
26 frame.size.height = new_size.height();
28 [view setFrame:frame];
29 [view setNeedsDisplay:YES];
32 gfx::NativeView BalloonViewHost::native_view() const {
33 return web_contents_->GetView()->GetContentNativeView();