diff options
author | sky <sky@chromium.org> | 2014-09-29 09:28:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-29 16:29:04 +0000 |
commit | 328fbe55a2d5b03d63670bc033e4b2f7274a3cff (patch) | |
tree | 24ece17e6068570c2028f0a615693347e6137010 /mojo/services/native_viewport/native_viewport_impl.cc | |
parent | 090de747a4ff621c8d432c74a0b5f9da6692e816 (diff) | |
download | chromium_src-328fbe55a2d5b03d63670bc033e4b2f7274a3cff.zip chromium_src-328fbe55a2d5b03d63670bc033e4b2f7274a3cff.tar.gz chromium_src-328fbe55a2d5b03d63670bc033e4b2f7274a3cff.tar.bz2 |
Nukes NativeViewportClient::OnCreated
And replaces with a callback. Also renames SetBounds to SetSize.
BUG=none
TEST=none
R=ben@chromium.org
Review URL: https://codereview.chromium.org/607233002
Cr-Commit-Position: refs/heads/master@{#297187}
Diffstat (limited to 'mojo/services/native_viewport/native_viewport_impl.cc')
-rw-r--r-- | mojo/services/native_viewport/native_viewport_impl.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/mojo/services/native_viewport/native_viewport_impl.cc b/mojo/services/native_viewport/native_viewport_impl.cc index 4fce13f..6aba9ab 100644 --- a/mojo/services/native_viewport/native_viewport_impl.cc +++ b/mojo/services/native_viewport/native_viewport_impl.cc @@ -45,14 +45,16 @@ NativeViewportImpl::~NativeViewportImpl() { platform_viewport_.reset(); } -void NativeViewportImpl::Create(SizePtr bounds) { +void NativeViewportImpl::Create(SizePtr size, + const Callback<void(uint64_t)>& callback) { + create_callback_ = callback; if (is_headless_) platform_viewport_ = PlatformViewportHeadless::Create(this); else platform_viewport_ = PlatformViewport::Create(this); - gfx::Rect rect = gfx::Rect(bounds.To<gfx::Size>()); - platform_viewport_->Init(rect); - OnBoundsChanged(rect); + const gfx::Rect bounds(gfx::Rect(size.To<gfx::Size>())); + platform_viewport_->Init(bounds); + OnBoundsChanged(bounds); } void NativeViewportImpl::Show() { @@ -68,8 +70,8 @@ void NativeViewportImpl::Close() { platform_viewport_->Close(); } -void NativeViewportImpl::SetBounds(SizePtr bounds) { - platform_viewport_->SetBounds(gfx::Rect(bounds.To<gfx::Size>())); +void NativeViewportImpl::SetSize(SizePtr size) { + platform_viewport_->SetBounds(gfx::Rect(size.To<gfx::Size>())); } void NativeViewportImpl::SubmittedFrame(SurfaceIdPtr child_surface_id) { @@ -81,7 +83,7 @@ void NativeViewportImpl::SubmittedFrame(SurfaceIdPtr child_surface_id) { viewport_surface_.reset( new ViewportSurface(surfaces_service_.get(), gpu_service_.get(), - bounds_.size(), + size_, child_surface_id.To<cc::SurfaceId>())); if (widget_id_) viewport_surface_->SetWidgetId(widget_id_); @@ -92,17 +94,17 @@ void NativeViewportImpl::SubmittedFrame(SurfaceIdPtr child_surface_id) { } void NativeViewportImpl::OnBoundsChanged(const gfx::Rect& bounds) { - bounds_ = bounds; - client()->OnBoundsChanged(Size::From(bounds.size())); + size_ = bounds.size(); + client()->OnSizeChanged(Size::From(size_)); if (viewport_surface_) - viewport_surface_->SetSize(bounds.size()); + viewport_surface_->SetSize(size_); } void NativeViewportImpl::OnAcceleratedWidgetAvailable( gfx::AcceleratedWidget widget) { widget_id_ = static_cast<uint64_t>(bit_cast<uintptr_t>(widget)); // TODO(jamesr): Remove once everything is converted to surfaces. - client()->OnCreated(widget_id_); + create_callback_.Run(widget_id_); if (viewport_surface_) viewport_surface_->SetWidgetId(widget_id_); } |