balloon_view_host_gtk.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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/gtk/notifications/balloon_view_host_gtk.h"
6
7#include <gtk/gtk.h>
8
9#include "chrome/browser/notifications/balloon.h"
10#include "content/public/browser/render_view_host.h"
11#include "content/public/browser/render_widget_host_view.h"
12#include "content/public/browser/web_contents.h"
13#include "content/public/browser/web_contents_view.h"
14
15BalloonViewHost::BalloonViewHost(Balloon* balloon)
16    : BalloonHost(balloon) {
17}
18
19BalloonViewHost::~BalloonViewHost() {
20  Shutdown();
21}
22
23void BalloonViewHost::UpdateActualSize(const gfx::Size& new_size) {
24  content::RenderViewHost* host = web_contents_->GetRenderViewHost();
25  if (host) {
26    content::RenderWidgetHostView* view = host->GetView();
27    if (view)
28      view->SetSize(new_size);
29  }
30
31  gtk_widget_set_size_request(
32      native_view(), new_size.width(), new_size.height());
33}
34
35gfx::NativeView BalloonViewHost::native_view() const {
36  return web_contents_->GetView()->GetNativeView();
37}
38