OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/extension_view_gtk.h" | 5 #include "chrome/browser/gtk/extension_view_gtk.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
8 #include "chrome/browser/gtk/extension_popup_gtk.h" | 8 #include "chrome/browser/gtk/extension_popup_gtk.h" |
9 #include "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
10 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" | 10 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } else { | 35 } else { |
36 pending_background_ = background; | 36 pending_background_ = background; |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 void ExtensionViewGtk::UpdatePreferredSize(const gfx::Size& new_size) { | 40 void ExtensionViewGtk::UpdatePreferredSize(const gfx::Size& new_size) { |
41 if (container_) | 41 if (container_) |
42 container_->OnExtensionPreferredSizeChanged(this, new_size); | 42 container_->OnExtensionPreferredSizeChanged(this, new_size); |
43 } | 43 } |
44 | 44 |
45 void ExtensionViewGtk::CreateWidgetHostView() { | |
46 DCHECK(!render_widget_host_view_); | |
47 render_widget_host_view_ = new RenderWidgetHostViewGtk(render_view_host()); | |
48 render_widget_host_view_->InitAsChild(); | |
49 | |
50 extension_host_->CreateRenderViewSoon(render_widget_host_view_); | |
51 } | |
52 | |
53 void ExtensionViewGtk::RenderViewCreated() { | 45 void ExtensionViewGtk::RenderViewCreated() { |
54 if (!pending_background_.empty() && render_view_host()->view()) { | 46 if (!pending_background_.empty() && render_view_host()->view()) { |
55 render_widget_host_view_->SetBackground(pending_background_); | 47 render_widget_host_view_->SetBackground(pending_background_); |
56 pending_background_.reset(); | 48 pending_background_.reset(); |
57 } | 49 } |
58 | 50 |
59 // Tell the renderer not to draw scrollbars in popups unless the | 51 // Tell the renderer not to draw scrollbars in popups unless the |
60 // popups are at the maximum allowed size. | 52 // popups are at the maximum allowed size. |
61 gfx::Size largest_popup_size(ExtensionPopupGtk::kMaxWidth, | 53 gfx::Size largest_popup_size(ExtensionPopupGtk::kMaxWidth, |
62 ExtensionPopupGtk::kMaxHeight); | 54 ExtensionPopupGtk::kMaxHeight); |
63 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size); | 55 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size); |
64 } | 56 } |
| 57 |
| 58 virtual ExtensionViewGtk::~ExtensionViewGtk() { |
| 59 gtk_widget_unparent(native_view()); |
| 60 } |
| 61 |
| 62 void ExtensionViewGtk::CreateWidgetHostView() { |
| 63 DCHECK(!render_widget_host_view_); |
| 64 render_widget_host_view_ = new RenderWidgetHostViewGtk(render_view_host()); |
| 65 render_widget_host_view_->InitAsChild(); |
| 66 |
| 67 extension_host_->CreateRenderViewSoon(render_widget_host_view_); |
| 68 } |
OLD | NEW |