| 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 "chrome/common/view_type.h" | 9 #include "chrome/common/view_type.h" |
| 10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ExtensionViewGtk::SetBackground(const SkBitmap& background) { | 34 void ExtensionViewGtk::SetBackground(const SkBitmap& background) { |
| 35 if (render_view_host()->IsRenderViewLive() && render_view_host()->GetView()) { | 35 if (render_view_host()->IsRenderViewLive() && render_view_host()->GetView()) { |
| 36 render_view_host()->GetView()->SetBackground(background); | 36 render_view_host()->GetView()->SetBackground(background); |
| 37 } else { | 37 } else { |
| 38 pending_background_ = background; | 38 pending_background_ = background; |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 Browser* ExtensionViewGtk::GetBrowser() { |
| 43 return browser_; |
| 44 } |
| 45 |
| 46 const Browser* ExtensionViewGtk::GetBrowser() const { |
| 47 return browser_; |
| 48 } |
| 49 |
| 42 void ExtensionViewGtk::ResizeDueToAutoResize(const gfx::Size& new_size) { | 50 void ExtensionViewGtk::ResizeDueToAutoResize(const gfx::Size& new_size) { |
| 43 if (container_) | 51 if (container_) |
| 44 container_->OnExtensionSizeChanged(this, new_size); | 52 container_->OnExtensionSizeChanged(this, new_size); |
| 45 } | 53 } |
| 46 | 54 |
| 47 void ExtensionViewGtk::CreateWidgetHostView() { | |
| 48 extension_host_->CreateRenderViewSoon(); | |
| 49 } | |
| 50 | |
| 51 void ExtensionViewGtk::RenderViewCreated() { | 55 void ExtensionViewGtk::RenderViewCreated() { |
| 52 if (!pending_background_.empty() && render_view_host()->GetView()) { | 56 if (!pending_background_.empty() && render_view_host()->GetView()) { |
| 53 render_view_host()->GetView()->SetBackground(pending_background_); | 57 render_view_host()->GetView()->SetBackground(pending_background_); |
| 54 pending_background_.reset(); | 58 pending_background_.reset(); |
| 55 } | 59 } |
| 56 | 60 |
| 57 chrome::ViewType host_type = extension_host_->extension_host_type(); | 61 chrome::ViewType host_type = extension_host_->extension_host_type(); |
| 58 if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 62 if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
| 59 gfx::Size min_size(ExtensionPopupGtk::kMinWidth, | 63 gfx::Size min_size(ExtensionPopupGtk::kMinWidth, |
| 60 ExtensionPopupGtk::kMinHeight); | 64 ExtensionPopupGtk::kMinHeight); |
| 61 gfx::Size max_size(ExtensionPopupGtk::kMaxWidth, | 65 gfx::Size max_size(ExtensionPopupGtk::kMaxWidth, |
| 62 ExtensionPopupGtk::kMaxHeight); | 66 ExtensionPopupGtk::kMaxHeight); |
| 63 render_view_host()->EnableAutoResize(min_size, max_size); | 67 render_view_host()->EnableAutoResize(min_size, max_size); |
| 64 } | 68 } |
| 65 } | 69 } |
| 70 |
| 71 void ExtensionViewGtk::DidStopLoading() { |
| 72 NOTIMPLEMENTED(); |
| 73 } |
| 74 |
| 75 void ExtensionViewGtk::CreateWidgetHostView() { |
| 76 extension_host_->CreateRenderViewSoon(); |
| 77 } |
| 78 |
| 79 // static |
| 80 ExtensionView* ExtensionView::Create(extensions::ExtensionHost* host, |
| 81 Browser* browser) { |
| 82 ExtensionViewGtk* extension_view = new ExtensionViewGtk(host, browser); |
| 83 extension_view->Init(); |
| 84 return extension_view; |
| 85 } |
| OLD | NEW |