Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1589)

Unified Diff: mojo/aura/window_tree_host_mojo.cc

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows bustage Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/aura/window_tree_host_mojo.cc
diff --git a/mojo/aura/window_tree_host_mojo.cc b/mojo/aura/window_tree_host_mojo.cc
index 2abc5f799fc544cd9db842828e8463e3c9092482..9ca55e0c7d71de3e82627a7630a751ebc9c1df47 100644
--- a/mojo/aura/window_tree_host_mojo.cc
+++ b/mojo/aura/window_tree_host_mojo.cc
@@ -7,7 +7,6 @@
#include "mojo/aura/context_factory_mojo.h"
#include "mojo/geometry/geometry_type_converters.h"
#include "mojo/public/c/gles2/gles2.h"
-#include "mojo/public/cpp/bindings/allocation_scope.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
@@ -33,9 +32,7 @@ WindowTreeHostMojo::WindowTreeHostMojo(
compositor_created_callback_(compositor_created_callback),
bounds_(bounds) {
native_viewport_.set_client(this);
-
- AllocationScope scope;
- native_viewport_->Create(bounds);
+ native_viewport_->Create(Rect::From(bounds));
ScopedMessagePipeHandle gles2_handle, gles2_client_handle;
CreateMessagePipe(&gles2_handle, &gles2_client_handle);
@@ -86,8 +83,7 @@ gfx::Rect WindowTreeHostMojo::GetBounds() const {
}
void WindowTreeHostMojo::SetBounds(const gfx::Rect& bounds) {
- AllocationScope scope;
- native_viewport_->SetBounds(bounds);
+ native_viewport_->SetBounds(Rect::From(bounds));
}
gfx::Point WindowTreeHostMojo::GetLocationOnNativeScreen() const {
@@ -138,9 +134,9 @@ void WindowTreeHostMojo::OnCreated() {
compositor_created_callback_.Run();
}
-void WindowTreeHostMojo::OnBoundsChanged(const Rect& bounds) {
- bounds_ = gfx::Rect(bounds.position().x(), bounds.position().y(),
- bounds.size().width(), bounds.size().height());
+void WindowTreeHostMojo::OnBoundsChanged(RectPtr bounds) {
+ bounds_ = gfx::Rect(bounds->position->x, bounds->position->y,
+ bounds->size->width, bounds->size->height);
window()->SetBounds(gfx::Rect(bounds_.size()));
OnHostResized(bounds_.size());
}
@@ -149,27 +145,27 @@ void WindowTreeHostMojo::OnDestroyed() {
base::MessageLoop::current()->Quit();
}
-void WindowTreeHostMojo::OnEvent(const Event& event,
+void WindowTreeHostMojo::OnEvent(EventPtr event,
const mojo::Callback<void()>& callback) {
- switch (event.action()) {
+ switch (event->action) {
case ui::ET_MOUSE_PRESSED:
case ui::ET_MOUSE_DRAGGED:
case ui::ET_MOUSE_RELEASED:
case ui::ET_MOUSE_MOVED:
case ui::ET_MOUSE_ENTERED:
case ui::ET_MOUSE_EXITED: {
- gfx::Point location(event.location().x(), event.location().y());
- ui::MouseEvent ev(static_cast<ui::EventType>(event.action()), location,
- location, event.flags(), 0);
+ gfx::Point location(event->location->x, event->location->y);
+ ui::MouseEvent ev(static_cast<ui::EventType>(event->action), location,
+ location, event->flags, 0);
SendEventToProcessor(&ev);
break;
}
case ui::ET_KEY_PRESSED:
case ui::ET_KEY_RELEASED: {
ui::KeyEvent ev(
- static_cast<ui::EventType>(event.action()),
- static_cast<ui::KeyboardCode>(event.key_data().key_code()),
- event.flags(), event.key_data().is_char());
+ static_cast<ui::EventType>(event->action),
+ static_cast<ui::KeyboardCode>(event->key_data->key_code),
+ event->flags, event->key_data->is_char);
SendEventToProcessor(&ev);
break;
}

Powered by Google App Engine
This is Rietveld 408576698