Chromium Code Reviews| Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
| diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| index 40cbc5f6c0daab51c204104c669f04a69f031756..339609c8565431d50809876ced215d050e27f529 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -10,12 +10,14 @@ |
| #include "content/browser/renderer_host/render_widget_host.h" |
| #include "content/public/browser/native_web_keyboard_event.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| #include "ui/aura/desktop.h" |
| #include "ui/aura/event.h" |
| #include "ui/aura/hit_test.h" |
| #include "ui/aura/window.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/compositor/layer.h" |
| +#include "ui/gfx/screen.h" |
| #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| #include "base/bind.h" |
| @@ -94,18 +96,22 @@ void RenderWidgetHostViewAura::Init() { |
| void RenderWidgetHostViewAura::InitAsPopup( |
| RenderWidgetHostView* parent_host_view, |
| const gfx::Rect& pos) { |
| - NOTIMPLEMENTED(); |
| - // TODO(ivankr): there has to be an Init() call, otherwise |window_| |
| - // is left uninitialized and will eventually crash. |
| Init(); |
| + window_->SetParent( |
| + static_cast<RenderWidgetHostViewAura*>(parent_host_view)->window_); |
|
Ben Goodger (Google)
2011/10/27 22:56:11
It seems like these should be parented to the menu
Daniel Erat
2011/10/28 00:53:13
Done. I think that it's not a transient since thi
|
| + SetBounds(pos); |
| + Show(); |
| } |
| void RenderWidgetHostViewAura::InitAsFullscreen( |
| RenderWidgetHostView* reference_host_view) { |
| - NOTIMPLEMENTED(); |
| - // TODO(ivankr): there has to be an Init() call, otherwise |window_| |
| - // is left uninitialized and will eventually crash. |
| Init(); |
| + window_->SetParent(aura::Desktop::GetInstance()); |
|
sadrul
2011/10/27 22:47:20
Shouldn't this be parented to the default containe
Ben Goodger (Google)
2011/10/27 22:56:11
The menu container, to be exact.
Daniel Erat
2011/10/28 00:53:13
I used TYPE_POPUP here, but that just gets treated
|
| + window_->Fullscreen(); |
| + Show(); |
| + Focus(); |
| + // TODO(derat): The window is visible but it's not being updated. Figure out |
| + // why. |
| } |
| RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
| @@ -283,16 +289,20 @@ void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { |
| #if defined(OS_POSIX) |
| void RenderWidgetHostViewAura::GetDefaultScreenInfo( |
| WebKit::WebScreenInfo* results) { |
| - NOTIMPLEMENTED(); |
| + GetScreenInfo(results); |
| } |
| void RenderWidgetHostViewAura::GetScreenInfo(WebKit::WebScreenInfo* results) { |
| - NOTIMPLEMENTED(); |
| + const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| + results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| + results->availableRect = results->rect; |
| + // TODO(derat): Don't hardcode this? |
|
Ben Goodger (Google)
2011/10/27 22:56:11
leave NOTIMPLEMENTED() if there is something here
Daniel Erat
2011/10/28 00:53:13
I'm okay with this being in production. It'd idea
|
| + results->depth = 24; |
| + results->depthPerComponent = 8; |
| } |
| gfx::Rect RenderWidgetHostViewAura::GetRootWindowBounds() { |
| - NOTIMPLEMENTED(); |
| - return gfx::Rect(); |
| + return aura::Desktop::GetInstance()->bounds(); |
| } |
| #endif |
| @@ -372,8 +382,12 @@ void RenderWidgetHostViewAura::OnBlur() { |
| } |
| bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { |
| - NativeWebKeyboardEvent webkit_event(event); |
| - host_->ForwardKeyboardEvent(webkit_event); |
| + if (event->key_code() == ui::VKEY_ESCAPE) { |
|
sadrul
2011/10/27 22:47:20
This is only when 'IsPopup'?
Daniel Erat
2011/10/28 00:53:13
Whoops, yeah (fullscreen, though). Sorry for miss
|
| + host_->Shutdown(); |
|
Ben Goodger (Google)
2011/10/27 22:56:11
Side note: seems odd to me that the view has to do
Daniel Erat
2011/10/28 00:53:13
It's needed for Pepper Flash.
|
| + } else { |
| + NativeWebKeyboardEvent webkit_event(event); |
| + host_->ForwardKeyboardEvent(webkit_event); |
| + } |
| return true; |
| } |
| @@ -389,10 +403,13 @@ int RenderWidgetHostViewAura::GetNonClientComponent( |
| } |
| bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { |
| + // TODO: Mouse clicks don't have the desired effect on <SELECT> popups: |
| + // clicking on an item closes the popup, but the item doesn't get selected. |
| + // Figure out why. |
| if (event->type() == ui::ET_MOUSEWHEEL) |
| - host_->ForwardWheelEvent(content::MakeWebMouseWheelEvent(event)); |
| + host_->ForwardWheelEvent(content::MakeWebMouseWheelEvent(event, window_)); |
| else |
| - host_->ForwardMouseEvent(content::MakeWebMouseEvent(event)); |
| + host_->ForwardMouseEvent(content::MakeWebMouseEvent(event, window_)); |
| // Return true so that we receive released/drag events. |
| return true; |