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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 | 166 |
167 void ExtensionView::PreferredSizeChanged() { | 167 void ExtensionView::PreferredSizeChanged() { |
168 View::PreferredSizeChanged(); | 168 View::PreferredSizeChanged(); |
169 if (container_) | 169 if (container_) |
170 container_->OnExtensionPreferredSizeChanged(this); | 170 container_->OnExtensionPreferredSizeChanged(this); |
171 } | 171 } |
172 | 172 |
173 bool ExtensionView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 173 bool ExtensionView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { |
174 // Let the tab key event be processed by the renderer (instead of moving the | 174 // Let the tab key event be processed by the renderer (instead of moving the |
175 // focus to the next focusable view). | 175 // focus to the next focusable view). Also handle Backspace, since otherwise |
176 return (e.key_code() == ui::VKEY_TAB); | 176 // (on Windows at least), pressing Backspace, when focus is on a text field |
| 177 // within the ExtensionView, will navigate the page back instead of erasing a |
| 178 // character. |
| 179 return (e.key_code() == ui::VKEY_TAB || e.key_code() == ui::VKEY_BACK); |
177 } | 180 } |
178 | 181 |
179 void ExtensionView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 182 void ExtensionView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
180 // Propagate the new size to RenderWidgetHostView. | 183 // Propagate the new size to RenderWidgetHostView. |
181 // We can't send size zero because RenderWidget DCHECKs that. | 184 // We can't send size zero because RenderWidget DCHECKs that. |
182 if (render_view_host()->view() && !bounds().IsEmpty()) | 185 if (render_view_host()->view() && !bounds().IsEmpty()) |
183 render_view_host()->view()->SetSize(size()); | 186 render_view_host()->view()->SetSize(size()); |
184 } | 187 } |
185 | 188 |
186 void ExtensionView::HandleMouseMove() { | 189 void ExtensionView::HandleMouseMove() { |
(...skipping 11 matching lines...) Expand all Loading... |
198 render_view_host()->view()->SetBackground(pending_background_); | 201 render_view_host()->view()->SetBackground(pending_background_); |
199 pending_background_.reset(); | 202 pending_background_.reset(); |
200 } | 203 } |
201 | 204 |
202 // Tell the renderer not to draw scroll bars in popups unless the | 205 // Tell the renderer not to draw scroll bars in popups unless the |
203 // popups are at the maximum allowed size. | 206 // popups are at the maximum allowed size. |
204 gfx::Size largest_popup_size(ExtensionPopup::kMaxWidth, | 207 gfx::Size largest_popup_size(ExtensionPopup::kMaxWidth, |
205 ExtensionPopup::kMaxHeight); | 208 ExtensionPopup::kMaxHeight); |
206 host_->DisableScrollbarsForSmallWindows(largest_popup_size); | 209 host_->DisableScrollbarsForSmallWindows(largest_popup_size); |
207 } | 210 } |
OLD | NEW |