| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/extensions/extension_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/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/ui/gtk/extensions/extension_popup_gtk.h" | 8 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| 9 #include "content/browser/renderer_host/render_view_host.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
| 10 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 gfx::NativeView ExtensionViewGtk::native_view() { | 25 gfx::NativeView ExtensionViewGtk::native_view() { |
| 26 return extension_host_->host_contents()->GetView()->GetNativeView(); | 26 return extension_host_->host_contents()->GetView()->GetNativeView(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 RenderViewHost* ExtensionViewGtk::render_view_host() const { | 29 RenderViewHost* ExtensionViewGtk::render_view_host() const { |
| 30 return extension_host_->render_view_host(); | 30 return extension_host_->render_view_host(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void ExtensionViewGtk::SetBackground(const SkBitmap& background) { | 33 void ExtensionViewGtk::SetBackground(const SkBitmap& background) { |
| 34 if (render_view_host()->IsRenderViewLive() && render_view_host()->view()) { | 34 if (render_view_host()->IsRenderViewLive() && render_view_host()->GetView()) { |
| 35 render_view_host()->view()->SetBackground(background); | 35 render_view_host()->GetView()->SetBackground(background); |
| 36 } else { | 36 } else { |
| 37 pending_background_ = background; | 37 pending_background_ = background; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 void ExtensionViewGtk::UpdatePreferredSize(const gfx::Size& new_size) { | 41 void ExtensionViewGtk::UpdatePreferredSize(const gfx::Size& new_size) { |
| 42 if (container_) | 42 if (container_) |
| 43 container_->OnExtensionPreferredSizeChanged(this, new_size); | 43 container_->OnExtensionPreferredSizeChanged(this, new_size); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void ExtensionViewGtk::CreateWidgetHostView() { | 46 void ExtensionViewGtk::CreateWidgetHostView() { |
| 47 extension_host_->CreateRenderViewSoon(); | 47 extension_host_->CreateRenderViewSoon(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void ExtensionViewGtk::RenderViewCreated() { | 50 void ExtensionViewGtk::RenderViewCreated() { |
| 51 if (!pending_background_.empty() && render_view_host()->view()) { | 51 if (!pending_background_.empty() && render_view_host()->GetView()) { |
| 52 render_view_host()->view()->SetBackground(pending_background_); | 52 render_view_host()->GetView()->SetBackground(pending_background_); |
| 53 pending_background_.reset(); | 53 pending_background_.reset(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Tell the renderer not to draw scrollbars in popups unless the | 56 // Tell the renderer not to draw scrollbars in popups unless the |
| 57 // popups are at the maximum allowed size. | 57 // popups are at the maximum allowed size. |
| 58 gfx::Size largest_popup_size(ExtensionPopupGtk::kMaxWidth, | 58 gfx::Size largest_popup_size(ExtensionPopupGtk::kMaxWidth, |
| 59 ExtensionPopupGtk::kMaxHeight); | 59 ExtensionPopupGtk::kMaxHeight); |
| 60 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size); | 60 extension_host_->DisableScrollbarsForSmallWindows(largest_popup_size); |
| 61 } | 61 } |
| OLD | NEW |