#include "content/common/view_messages.h"
#include "content/port/browser/render_widget_host_view_frame_subscriber.h"
#include "content/port/browser/render_widget_host_view_port.h"
-#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "ui/base/hit_test.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ui_base_types.h"
+#include "ui/compositor/compositor_vsync_manager.h"
#include "ui/compositor/layer.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/wm/public/window_types.h"
#if defined(OS_WIN)
-#include "base/win/windows_version.h"
#include "content/browser/accessibility/browser_accessibility_manager_win.h"
#include "content/browser/accessibility/browser_accessibility_win.h"
+#include "content/browser/renderer_host/legacy_render_widget_host_win.h"
#include "content/common/plugin_constants_win.h"
#include "ui/base/win/hidden_window.h"
#include "ui/gfx/gdi_util.h"
namespace {
void MailboxReleaseCallback(scoped_ptr<base::SharedMemory> shared_memory,
- unsigned sync_point, bool lost_resource) {
+ uint32 sync_point,
+ bool lost_resource) {
// NOTE: shared_memory will get released when we go out of scope.
}
cutout_rects.push_back(offset_cutout);
}
gfx::SubtractRectanglesFromRegion(hrgn, cutout_rects);
- SetWindowRgn(window, hrgn, TRUE);
+ // If we don't have any cutout rects then no point in messing with the
+ // window region.
+ if (cutout_rects.size())
+ SetWindowRgn(window, hrgn, TRUE);
}
return TRUE;
}
results->deviceScaleFactor = display.device_scale_factor();
}
-bool ShouldSendPinchGesture() {
-#if defined(OS_WIN)
- if (base::win::GetVersion() >= base::win::VERSION_WIN8)
- return true;
-#endif
- static bool pinch_allowed =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViewport) ||
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePinch);
- return pinch_allowed;
-}
-
bool PointerEventActivates(const ui::Event& event) {
if (event.type() == ui::ET_MOUSE_PRESSED)
return true;
DCHECK(!texture_to_produce.get() || !skip_frame);
if (texture_to_produce.get()) {
GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
- std::string mailbox_name = texture_to_produce->Produce();
- std::copy(mailbox_name.data(),
- mailbox_name.data() + mailbox_name.length(),
- reinterpret_cast<char*>(ack.gl_frame_data->mailbox.name));
+ ack.gl_frame_data->mailbox = texture_to_produce->Produce();
ack.gl_frame_data->size = texture_to_produce->size();
ack.gl_frame_data->sync_point =
gl_helper ? gl_helper->InsertSyncPoint() : 0;
void AcknowledgeBufferForGpu(
int32 route_id,
int gpu_host_id,
- const std::string& received_mailbox,
+ const gpu::Mailbox& received_mailbox,
bool skip_frame,
const scoped_refptr<ui::Texture>& texture_to_produce) {
AcceleratedSurfaceMsg_BufferPresented_Params ack;
DCHECK(!texture_to_produce.get() || !skip_frame);
if (texture_to_produce.get()) {
GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
- ack.mailbox_name = texture_to_produce->Produce();
+ ack.mailbox = texture_to_produce->Produce();
sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0;
} else if (skip_frame) {
- ack.mailbox_name = received_mailbox;
+ ack.mailbox = received_mailbox;
ack.sync_point = 0;
}
// We need to watch for mouse events outside a Web Popup or its parent
// and dismiss the popup for certain events.
-class RenderWidgetHostViewAura::EventFilterForPopupExit :
- public ui::EventHandler {
+class RenderWidgetHostViewAura::EventFilterForPopupExit
+ : public ui::EventHandler {
public:
explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva)
: rwhva_(rwhva) {
rwhva_->ApplyEventFilterForPopupExit(event);
}
+ virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE {
+ rwhva_->ApplyEventFilterForPopupExit(event);
+ }
+
private:
RenderWidgetHostViewAura* rwhva_;
};
void RenderWidgetHostViewAura::ApplyEventFilterForPopupExit(
- ui::MouseEvent* event) {
- if (in_shutdown_ || is_fullscreen_)
+ ui::LocatedEvent* event) {
+ if (in_shutdown_ || is_fullscreen_ || !event->target())
return;
- if (event->type() != ui::ET_MOUSE_PRESSED || !event->target())
+ if (event->type() != ui::ET_MOUSE_PRESSED &&
+ event->type() != ui::ET_TOUCH_PRESSED) {
return;
+ }
aura::Window* target = static_cast<aura::Window*>(event->target());
if (target != window_ &&
accelerated_compositing_state_changed_(false),
can_lock_compositor_(YES),
cursor_visibility_state_in_renderer_(UNKNOWN),
- paint_observer_(NULL),
touch_editing_client_(NULL),
delegated_frame_evictor_(new DelegatedFrameEvictor(this)),
weak_ptr_factory_(this) {
gfx::Screen::GetScreenFor(window_)->AddObserver(this);
software_frame_manager_.reset(new SoftwareFrameManager(
weak_ptr_factory_.GetWeakPtr()));
-#if defined(OS_WIN)
- plugin_parent_window_ = NULL;
-#endif
ImageTransportFactory::GetInstance()->AddObserver(this);
}
}
#if defined(OS_WIN)
+ if (legacy_render_widget_host_HWND_) {
+ // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent
+ // window before reparenting any plugins. This ensures that the plugin
+ // windows stay on top of the child Zorder in the parent and receive
+ // mouse events, etc.
+ legacy_render_widget_host_HWND_->UpdateParent(
+ GetNativeView()->GetDispatcher()->host()->GetAcceleratedWidget());
+ legacy_render_widget_host_HWND_->SetBounds(
+ window_->GetBoundsInRootWindow());
+ }
LPARAM lparam = reinterpret_cast<LPARAM>(this);
EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam);
-
- if (::IsWindow(plugin_parent_window_)) {
- gfx::Rect window_bounds = window_->GetBoundsInRootWindow();
- ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(),
- window_bounds.y(), window_bounds.width(),
- window_bounds.height(), 0);
- }
#endif
}
if (dispatcher) {
HWND parent = dispatcher->host()->GetAcceleratedWidget();
LPARAM lparam = reinterpret_cast<LPARAM>(this);
-
EnumChildWindows(parent, HideWindowsCallback, lparam);
+ // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global
+ // hidden window on the same lines as Windowed plugin windows.
+ if (legacy_render_widget_host_HWND_)
+ legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow());
}
- if (::IsWindow(plugin_parent_window_))
- ::SetWindowPos(plugin_parent_window_, NULL, 0, 0, 0, 0, 0);
#endif
}
void RenderWidgetHostViewAura::Show() {
window_->Show();
WasShown();
+#if defined(OS_WIN)
+ if (legacy_render_widget_host_HWND_)
+ legacy_render_widget_host_HWND_->Show();
+#endif
}
void RenderWidgetHostViewAura::Hide() {
window_->Hide();
WasHidden();
+#if defined(OS_WIN)
+ if (legacy_render_widget_host_HWND_)
+ legacy_render_widget_host_HWND_->Hide();
+#endif
}
bool RenderWidgetHostViewAura::IsShowing() {
}
void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
- if (is_loading_ && !is_loading && paint_observer_)
- paint_observer_->OnPageLoadComplete();
is_loading_ = is_loading;
UpdateCursorIfOverSelf();
}
ConvertRectToPixel(current_device_scale_factor_, src_subrect);
request->set_area(src_subrect_in_pixel);
if (subscriber_texture.get()) {
- request->SetTextureMailbox(cc::TextureMailbox(
- subscriber_texture->mailbox(), subscriber_texture->sync_point()));
+ request->SetTextureMailbox(
+ cc::TextureMailbox(subscriber_texture->mailbox(),
+ subscriber_texture->target(),
+ subscriber_texture->sync_point()));
}
RequestCopyOfOutput(request.Pass());
}
selection_focus_rect_);
}
#if defined(OS_WIN)
- // Create the dummy plugin parent window which will be passed as the
- // container window to windowless plugins.
+ // Create the legacy dummy window which corresponds to the bounds of the
+ // webcontents. This will be passed as the container window for windowless
+ // plugins.
// Plugins like Flash assume the container window which is returned via the
// NPNVnetscapeWindow property corresponds to the bounds of the webpage.
// This is not true in Aura where we have only HWND which is the main Aura
// window. If we return this window to plugins like Flash then it causes the
// coordinate translations done by these plugins to break.
- if (!plugin_parent_window_ && GetNativeViewId()) {
- plugin_parent_window_ = ::CreateWindowEx(
- 0, L"Static", NULL, WS_CHILDWINDOW, 0, 0, 0, 0,
- reinterpret_cast<HWND>(GetNativeViewId()), NULL, NULL, NULL);
- if (::IsWindow(plugin_parent_window_))
- ::SetProp(plugin_parent_window_, content::kPluginDummyParentProperty,
- reinterpret_cast<HANDLE>(true));
- }
- if (::IsWindow(plugin_parent_window_)) {
- gfx::Rect window_bounds = window_->GetBoundsInRootWindow();
- ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(),
- window_bounds.y(), window_bounds.width(),
- window_bounds.height(), 0);
+ // Additonally the legacy dummy window is needed for accessibility and for
+ // scrolling to work in legacy drivers for trackpoints/trackpads, etc.
+ if (GetNativeViewId()) {
+ if (!legacy_render_widget_host_HWND_) {
+ legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create(
+ reinterpret_cast<HWND>(GetNativeViewId()));
+ }
+ if (legacy_render_widget_host_HWND_) {
+ legacy_render_widget_host_HWND_->SetBounds(
+ window_->GetBoundsInRootWindow());
+ }
}
#endif
}
const gfx::Rect& surface_rect,
float surface_scale_factor,
const gfx::Rect& damage_rect,
- const std::string& mailbox_name,
+ const gpu::Mailbox& mailbox,
const BufferPresentedCallback& ack_callback) {
if (last_swapped_surface_size_ != surface_rect.size()) {
// The surface could have shrunk since we skipped an update, in which
if (ShouldSkipFrame(ConvertSizeToDIP(surface_scale_factor,
surface_rect.size())) ||
- mailbox_name.empty()) {
+ mailbox.IsZero()) {
skipped_damage_.op(RectToSkIRect(damage_rect), SkRegion::kUnion_Op);
ack_callback.Run(true, scoped_refptr<ui::Texture>());
return false;
return false;
}
- current_surface_->Consume(mailbox_name, surface_rect.size());
+ current_surface_->Consume(mailbox, surface_rect.size());
released_front_lock_ = NULL;
UpdateExternalTexture();
#if defined(OS_WIN)
void RenderWidgetHostViewAura::UpdateConstrainedWindowRects(
const std::vector<gfx::Rect>& rects) {
+ // Check this before setting constrained_rects_, so that next time they're set
+ // and we have a root window we don't early return.
+ if (!window_->GetDispatcher())
+ return;
+
if (rects == constrained_rects_)
return;
+
constrained_rects_ = rects;
- UpdateCutoutRects();
-}
-void RenderWidgetHostViewAura::UpdateCutoutRects() {
- if (!window_->GetRootWindow())
- return;
HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget();
CutoutRectsParams params;
params.widget = this;
&AcknowledgeBufferForGpu,
params_in_pixel.route_id,
gpu_host_id,
- params_in_pixel.mailbox_name);
+ params_in_pixel.mailbox);
BuffersSwapped(params_in_pixel.size,
gfx::Rect(params_in_pixel.size),
params_in_pixel.scale_factor,
- params_in_pixel.mailbox_name,
+ params_in_pixel.mailbox,
params_in_pixel.latency_info,
ack_callback);
}
current_frame_size_ = frame_size_in_dip;
CheckResizeLock();
- if (paint_observer_)
- paint_observer_->OnUpdateCompositorContent();
window_->SchedulePaintInRect(damage_rect_in_dip);
pending_delegated_ack_count_++;
void RenderWidgetHostViewAura::SendReturnedDelegatedResources(
uint32 output_surface_id) {
+ DCHECK(resource_collection_);
+
cc::CompositorFrameAck ack;
- if (resource_collection_)
- resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources);
+ resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources);
DCHECK(!ack.resources.empty());
+
RenderWidgetHostImpl::SendReclaimCompositorResources(
host_->GetRoutingID(),
output_surface_id,
base::Bind(&RenderWidgetHostViewAura::SendSoftwareFrameAck,
AsWeakPtr(),
output_surface_id));
+ } else {
+ SendSoftwareFrameAck(output_surface_id);
}
- if (paint_observer_)
- paint_observer_->OnUpdateCompositorContent();
DidReceiveFrameFromRenderer();
software_frame_manager_->SwapToNewFrameComplete(!host_->is_hidden());
GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
gl_helper->WaitSyncPoint(frame->gl_frame_data->sync_point);
- std::string mailbox_name(
- reinterpret_cast<const char*>(frame->gl_frame_data->mailbox.name),
- sizeof(frame->gl_frame_data->mailbox.name));
BuffersSwapped(frame->gl_frame_data->size,
frame->gl_frame_data->sub_buffer_rect,
frame->metadata.device_scale_factor,
- mailbox_name,
+ frame->gl_frame_data->mailbox,
frame->metadata.latency_info,
ack_callback);
}
gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin()
const {
- return reinterpret_cast<gfx::NativeViewId>(plugin_parent_window_);
+ if (legacy_render_widget_host_HWND_) {
+ return reinterpret_cast<gfx::NativeViewId>(
+ legacy_render_widget_host_HWND_->hwnd());
+ }
+ return NULL;
}
#endif
const gfx::Size& surface_size,
const gfx::Rect& damage_rect,
float surface_scale_factor,
- const std::string& mailbox_name,
+ const gpu::Mailbox& mailbox,
const std::vector<ui::LatencyInfo>& latency_info,
const BufferPresentedCallback& ack_callback) {
scoped_refptr<ui::Texture> previous_texture(current_surface_);
if (!SwapBuffersPrepare(surface_rect,
surface_scale_factor,
damage_rect,
- mailbox_name,
+ mailbox,
ack_callback)) {
return;
}
rect_to_paint.Inset(-1, -1);
rect_to_paint.Intersect(window_->bounds());
- if (paint_observer_)
- paint_observer_->OnUpdateCompositorContent();
window_->SchedulePaintInRect(rect_to_paint);
for (size_t i = 0; i < latency_info.size(); i++)
compositor->SetLatencyInfo(latency_info[i]);
base::Bind(&AcknowledgeBufferForGpu,
params_in_pixel.route_id,
gpu_host_id,
- params_in_pixel.mailbox_name);
+ params_in_pixel.mailbox);
BuffersSwapped(params_in_pixel.surface_size,
damage_rect,
params_in_pixel.surface_scale_factor,
- params_in_pixel.mailbox_name,
+ params_in_pixel.mailbox,
params_in_pixel.latency_info,
ack_callback);
}
}
DCHECK(result->HasBitmap());
- PrepareBitmapCopyOutputResult(dst_size_in_pixel, callback, result.Pass());
+ PrepareBitmapCopyOutputResult(dst_size_in_pixel, config, callback,
+ result.Pass());
}
static void CopyFromCompositingSurfaceFinished(
scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock,
bool result) {
bitmap_pixels_lock.reset();
- release_callback->Run(0, false);
+
+ uint32 sync_point = 0;
+ if (result) {
+ GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
+ sync_point = gl_helper->InsertSyncPoint();
+ }
+ bool lost_resource = sync_point == 0;
+ release_callback->Run(sync_point, lost_resource);
+
callback.Run(result, *bitmap);
}
const SkBitmap::Config config,
const base::Callback<void(bool, const SkBitmap&)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
+ DCHECK(result->HasTexture());
base::ScopedClosureRunner scoped_callback_runner(
base::Bind(callback, false, SkBitmap()));
- DCHECK(result->HasTexture());
- if (!result->HasTexture())
- return;
-
scoped_ptr<SkBitmap> bitmap(new SkBitmap);
- bitmap->setConfig(SkBitmap::kARGB_8888_Config,
+ bitmap->setConfig(config,
dst_size_in_pixel.width(), dst_size_in_pixel.height(),
0, kOpaque_SkAlphaType);
if (!bitmap->allocPixels())
ignore_result(scoped_callback_runner.Release());
gl_helper->CropScaleReadbackAndCleanMailbox(
- texture_mailbox.name(),
+ texture_mailbox.mailbox(),
texture_mailbox.sync_point(),
result->size(),
gfx::Rect(result->size()),
// static
void RenderWidgetHostViewAura::PrepareBitmapCopyOutputResult(
const gfx::Size& dst_size_in_pixel,
+ const SkBitmap::Config config,
const base::Callback<void(bool, const SkBitmap&)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
+ if (config != SkBitmap::kARGB_8888_Config) {
+ NOTIMPLEMENTED();
+ callback.Run(false, SkBitmap());
+ return;
+ }
DCHECK(result->HasBitmap());
-
base::ScopedClosureRunner scoped_callback_runner(
base::Bind(callback, false, SkBitmap()));
- if (!result->HasBitmap())
- return;
scoped_ptr<SkBitmap> source = result->TakeBitmap();
DCHECK(source);
bool result) {
callback.Run(result);
- GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
- uint32 sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0;
+ uint32 sync_point = 0;
+ if (result) {
+ GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
+ sync_point = gl_helper->InsertSyncPoint();
+ }
if (release_callback) {
// A release callback means the texture came from the compositor, so there
// should be no |subscriber_texture|.
DCHECK(!subscriber_texture);
- release_callback->Run(sync_point, false);
+ bool lost_resource = sync_point == 0;
+ release_callback->Run(sync_point, lost_resource);
}
ReturnSubscriberTexture(rwhva, subscriber_texture, sync_point);
}
callback,
subscriber_texture,
base::Passed(&release_callback));
- yuv_readback_pipeline->ReadbackYUV(
- texture_mailbox.name(),
- texture_mailbox.sync_point(),
- video_frame.get(),
- finished_callback);
+ yuv_readback_pipeline->ReadbackYUV(texture_mailbox.mailbox(),
+ texture_mailbox.sync_point(),
+ video_frame.get(),
+ finished_callback);
}
void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
#endif
}
-void RenderWidgetHostViewAura::GestureEventAck(int gesture_event_type,
- InputEventAckState ack_result) {
+void RenderWidgetHostViewAura::GestureEventAck(
+ const blink::WebGestureEvent& event,
+ InputEventAckState ack_result) {
if (touch_editing_client_)
- touch_editing_client_->GestureEventAck(gesture_event_type);
+ touch_editing_client_->GestureEventAck(event.type);
}
void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
if (GetBrowserAccessibilityManager())
return;
+ BrowserAccessibilityManager* manager = NULL;
#if defined(OS_WIN)
aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
if (!dispatcher)
gfx::NativeViewAccessible accessible_parent =
host_->GetParentNativeViewAccessible();
- BrowserAccessibilityManager* manager = new BrowserAccessibilityManagerWin(
- hwnd, accessible_parent,
- BrowserAccessibilityManagerWin::GetEmptyDocument(), this);
+ if (legacy_render_widget_host_HWND_) {
+ manager = new BrowserAccessibilityManagerWin(
+ legacy_render_widget_host_HWND_.get(), accessible_parent,
+ BrowserAccessibilityManagerWin::GetEmptyDocument(), this);
+ }
#else
- BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create(
+ manager = BrowserAccessibilityManager::Create(
BrowserAccessibilityManager::GetEmptyDocument(), this);
#endif
-
SetBrowserAccessibilityManager(manager);
}
void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
base::AutoReset<bool> in_bounds_changed(&in_bounds_changed_, true);
- // We care about this only in fullscreen mode, where there is no
- // WebContentsViewAura. We are sized via SetSize() or SetBounds() by
- // WebContentsViewAura in other cases.
- if (is_fullscreen_)
- SetSize(new_bounds.size());
+ // We care about this whenever RenderWidgetHostViewAura is not owned by a
+ // WebContentsViewAura since changes to the Window's bounds need to be
+ // messaged to the renderer. WebContentsViewAura invokes SetSize() or
+ // SetBounds() itself. No matter how we got here, any redundant calls are
+ // harmless.
+ SetSize(new_bounds.size());
}
gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) {
paint_canvas_ = NULL;
backing_store->SkiaShowRect(gfx::Point(), canvas);
- if (paint_observer_)
- paint_observer_->OnPaintComplete();
ui::Compositor* compositor = GetCompositor();
if (compositor) {
for (size_t i = 0; i < software_latency_info_.size(); i++)
break;
}
- // Needed to propagate mouse event to native_tab_contents_view_aura.
+ // Needed to propagate mouse event to |window_->parent()->delegate()|, but
+ // note that it might be something other than a WebContentsViewAura instance.
// TODO(pkotwicz): Find a better way of doing this.
// In fullscreen mode which is typically used by flash, don't forward
// the mouse events to the parent. The renderer and the plugin process
// handle these events.
if (!is_fullscreen_ && window_->parent()->delegate() &&
- !(event->flags() & ui::EF_FROM_TOUCH))
+ !(event->flags() & ui::EF_FROM_TOUCH)) {
+ event->ConvertLocationToTarget(window_, window_->parent());
window_->parent()->delegate()->OnMouseEvent(event);
+ }
if (!IsXButtonUpEvent(event))
event->SetHandled();
void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent");
- // Pinch gestures are currently disabled by default. See crbug.com/128477.
if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
- event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) {
+ event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) {
event->SetHandled();
return;
}
void RenderWidgetHostViewAura::OnCompositingEnded(
ui::Compositor* compositor) {
- if (paint_observer_)
- paint_observer_->OnCompositingComplete();
}
void RenderWidgetHostViewAura::OnCompositingAborted(
}
void RenderWidgetHostViewAura::OnUpdateVSyncParameters(
- ui::Compositor* compositor,
base::TimeTicks timebase,
base::TimeDelta interval) {
if (IsShowing()) {
// RenderWidgetHostViewAura, private:
RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
- if (paint_observer_)
- paint_observer_->OnViewDestroyed();
if (touch_editing_client_)
touch_editing_client_->OnViewDestroyed();
active_frame_subscriber_textures_.clear();
#if defined(OS_WIN)
- if (::IsWindow(plugin_parent_window_))
- ::DestroyWindow(plugin_parent_window_);
+ legacy_render_widget_host_HWND_.reset(NULL);
#endif
+
+ DCHECK(!vsync_manager_);
}
void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
void RenderWidgetHostViewAura::AddedToRootWindow() {
window_->GetDispatcher()->AddRootWindowObserver(this);
- host_->ParentChanged(GetNativeViewId());
UpdateScreenInfo(window_);
aura::client::CursorClient* cursor_client =
if (input_method)
input_method->SetFocusedTextInputClient(this);
}
+
+#if defined(OS_WIN)
+ // The parent may have changed here. Ensure that the legacy window is
+ // reparented accordingly.
+ if (legacy_render_widget_host_HWND_)
+ legacy_render_widget_host_HWND_->UpdateParent(
+ reinterpret_cast<HWND>(GetNativeViewId()));
+#endif
+
+ ui::Compositor* compositor = GetCompositor();
+ if (compositor) {
+ DCHECK(!vsync_manager_);
+ vsync_manager_ = compositor->vsync_manager();
+ vsync_manager_->AddObserver(this);
+ }
}
void RenderWidgetHostViewAura::RemovingFromRootWindow() {
DetachFromInputMethod();
window_->GetDispatcher()->RemoveRootWindowObserver(this);
- host_->ParentChanged(0);
ui::Compositor* compositor = GetCompositor();
if (current_surface_.get()) {
// We can't get notification for commits after this point, which would
RunOnCommitCallbacks();
resize_lock_.reset();
host_->WasResized();
+
if (compositor && compositor->HasObserver(this))
compositor->RemoveObserver(this);
+
+#if defined(OS_WIN)
+ // Update the legacy window's parent temporarily to the desktop window. It
+ // will eventually get reparented to the right root.
+ if (legacy_render_widget_host_HWND_)
+ legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
+#endif
+
+ if (vsync_manager_) {
+ vsync_manager_->RemoveObserver(this);
+ vsync_manager_ = NULL;
+ }
}
ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const {