Commit 010882ff authored by ben@chromium.org's avatar ben@chromium.org

Completes the GetWindowRect/GetRootWindowRect/GetScreenInfo changes I thought...

Completes the GetWindowRect/GetRootWindowRect/GetScreenInfo changes I thought I had finished with my last CL.

. Disable a check in BrowserMessageFilter that these messages are not handled on the UI thread, for Aura. In Aura, these messages need to be handled on the UI thread (since aura::Windows are not threadsafe). We do not have the NPAPI plugin constraints regular windows has, so this check is not important.
. Properly handle these messages in RWH, by sprinkling in some more defined(USE_AURA) to go with the defined(OS_POSIX).
. Properly define RenderWidgetHostView::GetDefaultScreenInfo() (it was being done as an override to a static?.. oops).
. Get rid of the USE_AURA NOTIMPLEMENTED() definition of the above in render_widget_host_view.cc, replacing with an impl in rwhva.cc. Also moves the _mac and _touch variants to their own .mm/.cc files.
. Gets rid of WillWmDestroy for Aura. It's normal-windows-only.

BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8566011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109965 0039d316-1c4b-4281-b951-d872f2087c98
parent e6cce5cc
...@@ -118,7 +118,7 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView, ...@@ -118,7 +118,7 @@ class RenderWidgetHostViewViews : public RenderWidgetHostView,
bool has_horizontal_scrollbar) OVERRIDE; bool has_horizontal_scrollbar) OVERRIDE;
virtual void SetScrollOffsetPinning( virtual void SetScrollOffsetPinning(
bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
#if defined(OS_WIN) #if defined(OS_WIN) && !defined(USE_AURA)
virtual void WillWmDestroy() OVERRIDE; virtual void WillWmDestroy() OVERRIDE;
#endif #endif
virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE;
......
...@@ -4,9 +4,14 @@ ...@@ -4,9 +4,14 @@
#include "chrome/browser/renderer_host/render_widget_host_view_views.h" #include "chrome/browser/renderer_host/render_widget_host_view_views.h"
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "base/logging.h" #include "base/logging.h"
#include "content/browser/renderer_host/gtk_window_utils.h"
#include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h" #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#include "views/widget/widget.h" #include "views/widget/widget.h"
static const char kRenderWidgetHostViewKey[] = "__RENDER_WIDGET_HOST_VIEW__"; static const char kRenderWidgetHostViewKey[] = "__RENDER_WIDGET_HOST_VIEW__";
......
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) { void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) {
} }
#if !defined(USE_AURA)
void RenderWidgetHostViewViews::WillWmDestroy() { void RenderWidgetHostViewViews::WillWmDestroy() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
#endif
gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() { gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
......
...@@ -100,7 +100,7 @@ void BrowserMessageFilter::BadMessageReceived() { ...@@ -100,7 +100,7 @@ void BrowserMessageFilter::BadMessageReceived() {
bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message, bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message,
IPC::Message::Sender* sender) { IPC::Message::Sender* sender) {
#if defined(OS_WIN) #if defined(OS_WIN) && !defined(USE_AURA)
// On Windows there's a potential deadlock with sync messsages going in // On Windows there's a potential deadlock with sync messsages going in
// a circle from browser -> plugin -> renderer -> browser. // a circle from browser -> plugin -> renderer -> browser.
// On Linux we can avoid this by avoiding sync messages from browser->plugin. // On Linux we can avoid this by avoiding sync messages from browser->plugin.
......
...@@ -209,7 +209,7 @@ bool RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { ...@@ -209,7 +209,7 @@ bool RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) {
OnMsgDidActivateAcceleratedCompositing) OnMsgDidActivateAcceleratedCompositing)
IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnMsgLockMouse) IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnMsgLockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnMsgUnlockMouse) IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnMsgUnlockMouse)
#if defined(OS_POSIX) #if defined(OS_POSIX) || defined(USE_AURA)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnMsgGetScreenInfo) IPC_MESSAGE_HANDLER(ViewHostMsg_GetScreenInfo, OnMsgGetScreenInfo)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect) IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect) IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect)
...@@ -1222,7 +1222,7 @@ void RenderWidgetHost::OnMsgUnlockMouse() { ...@@ -1222,7 +1222,7 @@ void RenderWidgetHost::OnMsgUnlockMouse() {
RejectMouseLockOrUnlockIfNecessary(); RejectMouseLockOrUnlockIfNecessary();
} }
#if defined(OS_POSIX) #if defined(OS_POSIX) || defined(USE_AURA)
void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId window_id, void RenderWidgetHost::OnMsgGetScreenInfo(gfx::NativeViewId window_id,
WebKit::WebScreenInfo* results) { WebKit::WebScreenInfo* results) {
if (view_) if (view_)
......
...@@ -545,7 +545,7 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Channel::Listener, ...@@ -545,7 +545,7 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Channel::Listener,
void OnMsgLockMouse(); void OnMsgLockMouse();
void OnMsgUnlockMouse(); void OnMsgUnlockMouse();
#if defined(OS_POSIX) #if defined(OS_POSIX) || defined(USE_AURA)
void OnMsgGetScreenInfo(gfx::NativeViewId view, void OnMsgGetScreenInfo(gfx::NativeViewId view,
WebKit::WebScreenInfo* results); WebKit::WebScreenInfo* results);
void OnMsgGetWindowRect(gfx::NativeViewId window_id, gfx::Rect* results); void OnMsgGetWindowRect(gfx::NativeViewId window_id, gfx::Rect* results);
......
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
#if defined(OS_MACOSX)
#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebScreenInfoFactory.h"
#endif
#if defined(TOOLKIT_USES_GTK) #if defined(TOOLKIT_USES_GTK)
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
...@@ -18,23 +14,7 @@ ...@@ -18,23 +14,7 @@
#include "content/browser/renderer_host/gtk_window_utils.h" #include "content/browser/renderer_host/gtk_window_utils.h"
#endif #endif
// TODO(jam): move this to render_widget_host_view_mac.mm when it moves to #if defined(TOUCH_UI)
// content.
#if defined(OS_MACOSX)
// static
void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) {
*results = WebKit::WebScreenInfoFactory::screenInfo(NULL);
}
#endif
#if defined(OS_POSIX) && defined(USE_AURA)
// static
void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) {
NOTIMPLEMENTED();
}
#elif defined(TOUCH_UI)
// static // static
void RenderWidgetHostView::GetDefaultScreenInfo( void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) { WebKit::WebScreenInfo* results) {
......
...@@ -271,7 +271,7 @@ class RenderWidgetHostView { ...@@ -271,7 +271,7 @@ class RenderWidgetHostView {
virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) = 0; virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) = 0;
#endif #endif
#if defined(OS_WIN) #if defined(OS_WIN) && !defined(USE_AURA)
virtual void WillWmDestroy() = 0; virtual void WillWmDestroy() = 0;
#endif #endif
......
...@@ -332,18 +332,8 @@ void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { ...@@ -332,18 +332,8 @@ void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) {
#endif #endif
} }
void RenderWidgetHostViewAura::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) {
GetScreenInfo(results);
}
void RenderWidgetHostViewAura::GetScreenInfo(WebKit::WebScreenInfo* results) { void RenderWidgetHostViewAura::GetScreenInfo(WebKit::WebScreenInfo* results) {
const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); GetDefaultScreenInfo(results);
results->rect = WebKit::WebRect(0, 0, size.width(), size.height());
results->availableRect = results->rect;
// TODO(derat): Don't hardcode this?
results->depth = 24;
results->depthPerComponent = 8;
} }
gfx::Rect RenderWidgetHostViewAura::GetRootWindowBounds() { gfx::Rect RenderWidgetHostViewAura::GetRootWindowBounds() {
...@@ -375,12 +365,6 @@ void RenderWidgetHostViewAura::SetScrollOffsetPinning( ...@@ -375,12 +365,6 @@ void RenderWidgetHostViewAura::SetScrollOffsetPinning(
// Not needed. Mac-only. // Not needed. Mac-only.
} }
#if defined(OS_WIN)
void RenderWidgetHostViewAura::WillWmDestroy() {
// Nothing to do.
}
#endif
#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
gfx::PluginWindowHandle RenderWidgetHostViewAura::GetCompositingSurface() { gfx::PluginWindowHandle RenderWidgetHostViewAura::GetCompositingSurface() {
// The GPU process renders to an offscreen surface (created by the GPU // The GPU process renders to an offscreen surface (created by the GPU
...@@ -543,3 +527,17 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { ...@@ -543,3 +527,17 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
aura::Desktop::GetInstance()->SetCursor(cursor); aura::Desktop::GetInstance()->SetCursor(cursor);
} }
////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostView, public:
// static
void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) {
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?
results->depth = 24;
results->depthPerComponent = 8;
}
...@@ -83,7 +83,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura : public RenderWidgetHostView, ...@@ -83,7 +83,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura : public RenderWidgetHostView,
virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE;
#endif #endif
virtual void SetBackground(const SkBitmap& background) OVERRIDE; virtual void SetBackground(const SkBitmap& background) OVERRIDE;
virtual void GetDefaultScreenInfo(WebKit::WebScreenInfo* results);
virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
virtual gfx::Rect GetRootWindowBounds() OVERRIDE; virtual gfx::Rect GetRootWindowBounds() OVERRIDE;
virtual void SetVisuallyDeemphasized(const SkColor* color, virtual void SetVisuallyDeemphasized(const SkColor* color,
...@@ -94,9 +93,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura : public RenderWidgetHostView, ...@@ -94,9 +93,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura : public RenderWidgetHostView,
bool has_horizontal_scrollbar) OVERRIDE; bool has_horizontal_scrollbar) OVERRIDE;
virtual void SetScrollOffsetPinning( virtual void SetScrollOffsetPinning(
bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
#if defined(OS_WIN)
virtual void WillWmDestroy() OVERRIDE;
#endif
virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE; virtual gfx::PluginWindowHandle GetCompositingSurface() OVERRIDE;
virtual bool LockMouse() OVERRIDE; virtual bool LockMouse() OVERRIDE;
virtual void UnlockMouse() OVERRIDE; virtual void UnlockMouse() OVERRIDE;
......
...@@ -209,6 +209,15 @@ NSWindow* ApparentWindowForView(NSView* view) { ...@@ -209,6 +209,15 @@ NSWindow* ApparentWindowForView(NSView* view) {
} // namespace } // namespace
///////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostView, public:
// static
void RenderWidgetHostView::GetDefaultScreenInfo(
WebKit::WebScreenInfo* results) {
*results = WebKit::WebScreenInfoFactory::screenInfo(NULL);
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostViewMac, public: // RenderWidgetHostViewMac, public:
......
...@@ -233,7 +233,7 @@ TabContents::~TabContents() { ...@@ -233,7 +233,7 @@ TabContents::~TabContents() {
content::NotificationService::NoDetails()); content::NotificationService::NoDetails());
// TODO(brettw) this should be moved to the view. // TODO(brettw) this should be moved to the view.
#if defined(OS_WIN) #if defined(OS_WIN) && !defined(USE_AURA)
// If we still have a window handle, destroy it. GetNativeView can return // If we still have a window handle, destroy it. GetNativeView can return
// NULL if this contents was part of a window that closed. // NULL if this contents was part of a window that closed.
if (GetNativeView()) { if (GetNativeView()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment