- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / notifications / balloon_view_host_mac.mm
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.
4
5 #include "chrome/browser/ui/cocoa/notifications/balloon_view_host_mac.h"
6
7 #import <Cocoa/Cocoa.h>
8
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"
12
13 BalloonViewHost::BalloonViewHost(Balloon* balloon)
14     : BalloonHost(balloon) {
15 }
16
17 BalloonViewHost::~BalloonViewHost() {
18    Shutdown();
19 }
20
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();
27
28   [view setFrame:frame];
29   [view setNeedsDisplay:YES];
30 }
31
32 gfx::NativeView BalloonViewHost::native_view() const {
33   return web_contents_->GetView()->GetContentNativeView();
34 }