| Index: mojo/services/native_viewport/native_viewport_service.cc
|
| diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc
|
| index 30e37b71ea82100359de696ee3df7d683188a861..176926cde554887e69dbb57b4ca1bd486aa3f4f4 100644
|
| --- a/mojo/services/native_viewport/native_viewport_service.cc
|
| +++ b/mojo/services/native_viewport/native_viewport_service.cc
|
| @@ -8,7 +8,6 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/time/time.h"
|
| #include "mojo/geometry/geometry_type_converters.h"
|
| -#include "mojo/public/cpp/bindings/allocation_scope.h"
|
| #include "mojo/public/interfaces/shell/shell.mojom.h"
|
| #include "mojo/services/gles2/command_buffer_impl.h"
|
| #include "mojo/services/native_viewport/native_viewport.h"
|
| @@ -41,12 +40,12 @@ class NativeViewportImpl
|
| native_viewport_.reset();
|
| }
|
|
|
| - virtual void Create(const Rect& bounds) OVERRIDE {
|
| + virtual void Create(RectPtr bounds) OVERRIDE {
|
| native_viewport_ =
|
| services::NativeViewport::Create(context_, this);
|
| - native_viewport_->Init(bounds);
|
| + native_viewport_->Init(bounds.To<gfx::Rect>());
|
| client()->OnCreated();
|
| - OnBoundsChanged(bounds);
|
| + OnBoundsChanged(bounds.To<gfx::Rect>());
|
| }
|
|
|
| virtual void Show() OVERRIDE {
|
| @@ -63,9 +62,9 @@ class NativeViewportImpl
|
| native_viewport_->Close();
|
| }
|
|
|
| - virtual void SetBounds(const Rect& bounds) OVERRIDE {
|
| - gfx::Rect gfx_bounds(bounds.position().x(), bounds.position().y(),
|
| - bounds.size().width(), bounds.size().height());
|
| + virtual void SetBounds(RectPtr bounds) OVERRIDE {
|
| + gfx::Rect gfx_bounds(bounds->position->x, bounds->position->y,
|
| + bounds->size->width, bounds->size->height);
|
| native_viewport_->SetBounds(gfx_bounds);
|
| }
|
|
|
| @@ -118,38 +117,33 @@ class NativeViewportImpl
|
| if (waiting_for_event_ack_ && IsRateLimitedEventType(ui_event))
|
| return false;
|
|
|
| - AllocationScope scope;
|
| -
|
| - Event::Builder event;
|
| - event.set_action(ui_event->type());
|
| - event.set_flags(ui_event->flags());
|
| - event.set_time_stamp(ui_event->time_stamp().ToInternalValue());
|
| + EventPtr event(Event::New());
|
| + event->action = ui_event->type();
|
| + event->flags = ui_event->flags();
|
| + event->time_stamp = ui_event->time_stamp().ToInternalValue();
|
|
|
| if (ui_event->IsMouseEvent() || ui_event->IsTouchEvent()) {
|
| ui::LocatedEvent* located_event =
|
| static_cast<ui::LocatedEvent*>(ui_event);
|
| - Point::Builder location;
|
| - location.set_x(located_event->location().x());
|
| - location.set_y(located_event->location().y());
|
| - event.set_location(location.Finish());
|
| + event->location = Point::New();
|
| + event->location->x = located_event->location().x();
|
| + event->location->y = located_event->location().y();
|
| }
|
|
|
| if (ui_event->IsTouchEvent()) {
|
| ui::TouchEvent* touch_event = static_cast<ui::TouchEvent*>(ui_event);
|
| - TouchData::Builder touch_data;
|
| - touch_data.set_pointer_id(touch_event->touch_id());
|
| - event.set_touch_data(touch_data.Finish());
|
| + event->touch_data = TouchData::New();
|
| + event->touch_data->pointer_id = touch_event->touch_id();
|
| } else if (ui_event->IsKeyEvent()) {
|
| ui::KeyEvent* key_event = static_cast<ui::KeyEvent*>(ui_event);
|
| - KeyData::Builder key_data;
|
| - key_data.set_key_code(key_event->key_code());
|
| - key_data.set_is_char(key_event->is_char());
|
| - event.set_key_data(key_data.Finish());
|
| + event->key_data = KeyData::New();
|
| + event->key_data->key_code = key_event->key_code();
|
| + event->key_data->is_char = key_event->is_char();
|
| }
|
|
|
| - client()->OnEvent(event.Finish(),
|
| - base::Bind(&NativeViewportImpl::AckEvent,
|
| - base::Unretained(this)));
|
| + client()->OnEvent(event.Pass(),
|
| + base::Bind(&NativeViewportImpl::AckEvent,
|
| + base::Unretained(this)));
|
| waiting_for_event_ack_ = true;
|
| return false;
|
| }
|
| @@ -162,8 +156,7 @@ class NativeViewportImpl
|
|
|
| virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE {
|
| CreateCommandBufferIfNeeded();
|
| - AllocationScope scope;
|
| - client()->OnBoundsChanged(bounds);
|
| + client()->OnBoundsChanged(Rect::From(bounds));
|
| }
|
|
|
| virtual void OnDestroyed() OVERRIDE {
|
|
|