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/views/extensions/extension_view_views.h" | 5 #include "chrome/browser/ui/views/extensions/extension_view_views.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 "chrome/common/view_type.h" | |
10 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
11 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
13 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_contents_view.h" | 13 #include "content/public/browser/web_contents_view.h" |
| 14 #include "extensions/common/view_type.h" |
15 #include "ui/base/events/event.h" | 15 #include "ui/base/events/event.h" |
16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
17 | 17 |
18 ExtensionViewViews::ExtensionViewViews(extensions::ExtensionHost* host, | 18 ExtensionViewViews::ExtensionViewViews(extensions::ExtensionHost* host, |
19 Browser* browser) | 19 Browser* browser) |
20 : host_(host), | 20 : host_(host), |
21 browser_(browser), | 21 browser_(browser), |
22 initialized_(false), | 22 initialized_(false), |
23 container_(NULL), | 23 container_(NULL), |
24 is_clipped_(false) { | 24 is_clipped_(false) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // We can't send size zero because RenderWidget DCHECKs that. | 143 // We can't send size zero because RenderWidget DCHECKs that. |
144 if (render_view_host()->GetView() && !bounds().IsEmpty()) { | 144 if (render_view_host()->GetView() && !bounds().IsEmpty()) { |
145 render_view_host()->GetView()->SetSize(size()); | 145 render_view_host()->GetView()->SetSize(size()); |
146 | 146 |
147 if (container_) | 147 if (container_) |
148 container_->OnViewWasResized(); | 148 container_->OnViewWasResized(); |
149 } | 149 } |
150 } | 150 } |
151 | 151 |
152 void ExtensionViewViews::RenderViewCreated() { | 152 void ExtensionViewViews::RenderViewCreated() { |
153 chrome::ViewType host_type = host_->extension_host_type(); | 153 extensions::ViewType host_type = host_->extension_host_type(); |
154 if (host_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 154 if (host_type == extensions::VIEW_TYPE_EXTENSION_POPUP) { |
155 gfx::Size min_size(ExtensionPopup::kMinWidth, | 155 gfx::Size min_size(ExtensionPopup::kMinWidth, |
156 ExtensionPopup::kMinHeight); | 156 ExtensionPopup::kMinHeight); |
157 gfx::Size max_size(ExtensionPopup::kMaxWidth, | 157 gfx::Size max_size(ExtensionPopup::kMaxWidth, |
158 ExtensionPopup::kMaxHeight); | 158 ExtensionPopup::kMaxHeight); |
159 render_view_host()->EnableAutoResize(min_size, max_size); | 159 render_view_host()->EnableAutoResize(min_size, max_size); |
160 } | 160 } |
161 | 161 |
162 if (container_) | 162 if (container_) |
163 container_->OnViewWasResized(); | 163 container_->OnViewWasResized(); |
164 } | 164 } |
165 | 165 |
166 void ExtensionViewViews::HandleKeyboardEvent( | 166 void ExtensionViewViews::HandleKeyboardEvent( |
167 const content::NativeWebKeyboardEvent& event) { | 167 const content::NativeWebKeyboardEvent& event) { |
168 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, | 168 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, |
169 GetFocusManager()); | 169 GetFocusManager()); |
170 } | 170 } |
OLD | NEW |