| 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/views/extensions/extension_view.h" | 5 #include "chrome/browser/ui/views/extensions/extension_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
| 8 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 8 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| 9 #include "content/browser/renderer_host/render_view_host.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_view.h" | 10 #include "content/browser/renderer_host/render_widget_host_view.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // focus to the next focusable view). Also handle Backspace, since otherwise | 142 // focus to the next focusable view). Also handle Backspace, since otherwise |
| 143 // (on Windows at least), pressing Backspace, when focus is on a text field | 143 // (on Windows at least), pressing Backspace, when focus is on a text field |
| 144 // within the ExtensionView, will navigate the page back instead of erasing a | 144 // within the ExtensionView, will navigate the page back instead of erasing a |
| 145 // character. | 145 // character. |
| 146 return (e.key_code() == ui::VKEY_TAB || e.key_code() == ui::VKEY_BACK); | 146 return (e.key_code() == ui::VKEY_TAB || e.key_code() == ui::VKEY_BACK); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ExtensionView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 149 void ExtensionView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
| 150 // Propagate the new size to RenderWidgetHostView. | 150 // Propagate the new size to RenderWidgetHostView. |
| 151 // We can't send size zero because RenderWidget DCHECKs that. | 151 // We can't send size zero because RenderWidget DCHECKs that. |
| 152 if (render_view_host()->view() && !bounds().IsEmpty()) | 152 if (render_view_host()->view() && !bounds().IsEmpty()) { |
| 153 render_view_host()->view()->SetSize(size()); | 153 render_view_host()->view()->SetSize(size()); |
| 154 |
| 155 if (container_) |
| 156 container_->OnRenderViewSizeChanged(); |
| 157 } |
| 154 } | 158 } |
| 155 | 159 |
| 156 void ExtensionView::RenderViewCreated() { | 160 void ExtensionView::RenderViewCreated() { |
| 157 if (!pending_background_.empty() && render_view_host()->view()) { | 161 if (!pending_background_.empty() && render_view_host()->view()) { |
| 158 render_view_host()->view()->SetBackground(pending_background_); | 162 render_view_host()->view()->SetBackground(pending_background_); |
| 159 pending_background_.reset(); | 163 pending_background_.reset(); |
| 160 } | 164 } |
| 161 | 165 |
| 162 // Tell the renderer not to draw scroll bars in popups unless the | 166 // Tell the renderer not to draw scroll bars in popups unless the |
| 163 // popups are at the maximum allowed size. | 167 // popups are at the maximum allowed size. |
| 164 gfx::Size largest_popup_size(ExtensionPopup::kMaxWidth, | 168 gfx::Size largest_popup_size(ExtensionPopup::kMaxWidth, |
| 165 ExtensionPopup::kMaxHeight); | 169 ExtensionPopup::kMaxHeight); |
| 166 host_->DisableScrollbarsForSmallWindows(largest_popup_size); | 170 host_->DisableScrollbarsForSmallWindows(largest_popup_size); |
| 171 |
| 172 if (container_) |
| 173 container_->OnRenderViewSizeChanged(); |
| 167 } | 174 } |
| OLD | NEW |