OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h" | 5 #include "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h" |
6 | 6 |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "content/browser/renderer_host/render_view_host.h" | 8 #include "content/browser/renderer_host/render_view_host.h" |
9 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" | 9 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
11 | 11 |
12 BalloonViewHost::BalloonViewHost(Balloon* balloon) | 12 BalloonViewHost::BalloonViewHost(Balloon* balloon) |
13 : BalloonHost(balloon) { | 13 : BalloonHost(balloon) { |
14 } | 14 } |
15 | 15 |
16 BalloonViewHost::~BalloonViewHost() { | 16 BalloonViewHost::~BalloonViewHost() { |
17 Shutdown(); | 17 Shutdown(); |
18 } | 18 } |
19 | 19 |
20 void BalloonViewHost::UpdateActualSize(const gfx::Size& new_size) { | 20 void BalloonViewHost::UpdateActualSize(const gfx::Size& new_size) { |
21 tab_contents_->render_view_host()->view()->SetSize(new_size); | 21 RenderViewHost* host = tab_contents_->render_view_host(); |
| 22 if (host) { |
| 23 RenderWidgetHostView* view = host->view(); |
| 24 if (view) |
| 25 view->SetSize(new_size); |
| 26 } |
| 27 |
22 gtk_widget_set_size_request( | 28 gtk_widget_set_size_request( |
23 native_view(), new_size.width(), new_size.height()); | 29 native_view(), new_size.width(), new_size.height()); |
24 } | 30 } |
25 | 31 |
26 gfx::NativeView BalloonViewHost::native_view() const { | 32 gfx::NativeView BalloonViewHost::native_view() const { |
27 return tab_contents_->GetNativeView(); | 33 return tab_contents_->GetNativeView(); |
28 } | 34 } |
OLD | NEW |