Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/hwnd_html_view.h" | 5 #include "chrome/browser/views/hwnd_html_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_view_host.h" | 7 #include "chrome/browser/renderer_host/render_view_host.h" |
| 8 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 8 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| 9 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 9 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 10 #include "chrome/browser/tab_contents/site_instance.h" | 10 #include "chrome/browser/tab_contents/site_instance.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 } | 25 } |
| 26 | 26 |
| 27 HWNDHtmlView::~HWNDHtmlView() { | 27 HWNDHtmlView::~HWNDHtmlView() { |
| 28 if (render_view_host_) { | 28 if (render_view_host_) { |
| 29 Detach(); | 29 Detach(); |
| 30 render_view_host_->Shutdown(); | 30 render_view_host_->Shutdown(); |
| 31 render_view_host_ = NULL; | 31 render_view_host_ = NULL; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 void HWNDHtmlView::SetVisible(bool is_visible) { | |
| 36 HWNDView::SetVisible(is_visible); | |
| 37 | |
| 38 // Also tell RenderWidgetHostView the new visibility. Despite its name, it is | |
| 39 // not part of the View heirarchy and does not know about the change unless we | |
| 40 // tell it. | |
| 41 if (render_view_host() && render_view_host()->view()) { | |
| 42 if (is_visible) | |
| 43 render_view_host()->view()->Show(); | |
| 44 else | |
| 45 render_view_host()->view()->Hide(); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 void HWNDHtmlView::DidChangeBounds(const gfx::Rect& previous, | |
| 50 const gfx::Rect& current) { | |
| 51 // Propagate the new size to RenderWidgetHostView. | |
| 52 if (render_view_host() && render_view_host()->view() && !current.IsEmpty()) | |
|
Erik does not do reviews
2009/04/27 19:47:30
I still think this isn't the correct final fix (bu
| |
| 53 render_view_host()->view()->SetSize(gfx::Size(width(), height())); | |
| 54 } | |
| 55 | |
| 35 void HWNDHtmlView::SetBackground(const SkBitmap& background) { | 56 void HWNDHtmlView::SetBackground(const SkBitmap& background) { |
| 36 if (initialized_) { | 57 if (initialized_) { |
| 37 DCHECK(render_view_host_); | 58 DCHECK(render_view_host_); |
| 38 render_view_host_->view()->SetBackground(background); | 59 render_view_host_->view()->SetBackground(background); |
| 39 } else { | 60 } else { |
| 40 pending_background_ = background; | 61 pending_background_ = background; |
| 41 } | 62 } |
| 42 } | 63 } |
| 43 | 64 |
| 44 void HWNDHtmlView::InitHidden() { | 65 void HWNDHtmlView::InitHidden() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 } | 98 } |
| 78 rvh->NavigateToURL(content_url_); | 99 rvh->NavigateToURL(content_url_); |
| 79 initialized_ = true; | 100 initialized_ = true; |
| 80 } | 101 } |
| 81 | 102 |
| 82 void HWNDHtmlView::ViewHierarchyChanged(bool is_add, View* parent, | 103 void HWNDHtmlView::ViewHierarchyChanged(bool is_add, View* parent, |
| 83 View* child) { | 104 View* child) { |
| 84 if (is_add && GetWidget() && !initialized_) | 105 if (is_add && GetWidget() && !initialized_) |
| 85 Init(GetWidget()->GetNativeView()); | 106 Init(GetWidget()->GetNativeView()); |
| 86 } | 107 } |
| OLD | NEW |