| Index: mojo/examples/aura_demo/root_window_host_mojo.cc
|
| diff --git a/mojo/examples/aura_demo/root_window_host_mojo.cc b/mojo/examples/aura_demo/root_window_host_mojo.cc
|
| index 98d96f72206e9110d2ddf58e80cee06ab4d54c08..19b2891996b1491c9fea477952ac164b6d87f0bd 100644
|
| --- a/mojo/examples/aura_demo/root_window_host_mojo.cc
|
| +++ b/mojo/examples/aura_demo/root_window_host_mojo.cc
|
| @@ -26,7 +26,8 @@ ui::ContextFactory* WindowTreeHostMojo::context_factory_ = NULL;
|
| WindowTreeHostMojo::WindowTreeHostMojo(
|
| ScopedMessagePipeHandle viewport_handle,
|
| const base::Callback<void()>& compositor_created_callback)
|
| - : native_viewport_(viewport_handle.Pass(), this),
|
| + : context_created_(false),
|
| + native_viewport_(viewport_handle.Pass(), this),
|
| compositor_created_callback_(compositor_created_callback) {
|
| native_viewport_->Open();
|
|
|
| @@ -78,7 +79,7 @@ void WindowTreeHostMojo::ToggleFullScreen() {
|
|
|
| gfx::Rect WindowTreeHostMojo::GetBounds() const {
|
| NOTIMPLEMENTED();
|
| - return gfx::Rect(500, 500);
|
| + return gfx::Rect(viewport_size_);
|
| }
|
|
|
| void WindowTreeHostMojo::SetBounds(const gfx::Rect& bounds) {
|
| @@ -148,7 +149,9 @@ void WindowTreeHostMojo::PrepareForShutdown() {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WindowTreeHostMojo, NativeViewportClient implementation:
|
|
|
| -void WindowTreeHostMojo::OnCreated() {
|
| +void WindowTreeHostMojo::OnCreated(uint32_t width, uint32_t height) {
|
| + viewport_size_ = gfx::Size(width, height);
|
| + MaybeCreateCompositor();
|
| }
|
|
|
| void WindowTreeHostMojo::OnDestroyed() {
|
| @@ -165,10 +168,17 @@ void WindowTreeHostMojo::OnEvent(const Event& event) {
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WindowTreeHostMojo, private:
|
|
|
| -void WindowTreeHostMojo::DidCreateContext(gfx::Size viewport_size) {
|
| +void WindowTreeHostMojo::DidCreateContext() {
|
| + context_created_ = true;
|
| + MaybeCreateCompositor();
|
| +}
|
| +
|
| +void WindowTreeHostMojo::MaybeCreateCompositor() {
|
| + if (viewport_size_.IsEmpty() || !context_created_)
|
| + return;
|
| CreateCompositor(GetAcceleratedWidget());
|
| compositor_created_callback_.Run();
|
| - NotifyHostResized(viewport_size);
|
| + NotifyHostResized(viewport_size_);
|
| }
|
|
|
| } // namespace examples
|
|
|