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

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 2013503002: Keep non-key event handling in-house for NativeWidgetMus Base URL: https://chromium.googlesource.com/chromium/src.git@native_widget_mus9
Patch Set: Add test for mouse input info agreement between widget and view Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 } 1314 }
1315 1315
1316 void NativeWidgetMus::OnWindowInputEvent( 1316 void NativeWidgetMus::OnWindowInputEvent(
1317 mus::Window* view, 1317 mus::Window* view,
1318 const ui::Event& event_in, 1318 const ui::Event& event_in,
1319 std::unique_ptr<base::Callback<void(EventResult)>>* ack_callback) { 1319 std::unique_ptr<base::Callback<void(EventResult)>>* ack_callback) {
1320 // Take ownership of the callback, indicating that we will handle it. 1320 // Take ownership of the callback, indicating that we will handle it.
1321 EventAckHandler ack_handler(std::move(*ack_callback)); 1321 EventAckHandler ack_handler(std::move(*ack_callback));
1322 1322
1323 std::unique_ptr<ui::Event> event = ui::Event::Clone(event_in); 1323 std::unique_ptr<ui::Event> event = ui::Event::Clone(event_in);
1324 // TODO(markdittmer): This should be this->OnEvent(event.get()), but that 1324
1325 // can't happen until IME is refactored out of in WindowTreeHostMus. 1325 if (!event->IsKeyEvent()) {
1326 platform_window_delegate()->DispatchEvent(event.get()); 1326 OnEvent(event.get());
1327 } else {
1328 // TODO(markdittmer): This should be this->OnEvent(event.get()), but that
1329 // can't happen until IME is refactored out of in WindowTreeHostMus.
1330 platform_window_delegate()->DispatchEvent(event.get());
1331 }
1327 // NOTE: |this| may be deleted. 1332 // NOTE: |this| may be deleted.
1328 1333
1329 ack_handler.set_handled(event->handled()); 1334 ack_handler.set_handled(event->handled());
1330 // |ack_handler| acks the event on destruction if necessary. 1335 // |ack_handler| acks the event on destruction if necessary.
1331 } 1336 }
1332 1337
1333 void NativeWidgetMus::OnMusWindowVisibilityChanging(mus::Window* window) { 1338 void NativeWidgetMus::OnMusWindowVisibilityChanging(mus::Window* window) {
1334 if (window == window_) { 1339 if (window == window_) {
1335 native_widget_delegate_->OnNativeWidgetVisibilityChanging( 1340 native_widget_delegate_->OnNativeWidgetVisibilityChanging(
1336 !window->visible()); 1341 !window->visible());
(...skipping 27 matching lines...) Expand all
1364 1369
1365 gfx::Path mask_path; 1370 gfx::Path mask_path;
1366 native_widget_delegate_->GetHitTestMask(&mask_path); 1371 native_widget_delegate_->GetHitTestMask(&mask_path);
1367 // TODO(jamescook): Use the full path for the mask. 1372 // TODO(jamescook): Use the full path for the mask.
1368 gfx::Rect mask_rect = 1373 gfx::Rect mask_rect =
1369 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1374 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1370 window_->SetHitTestMask(mask_rect); 1375 window_->SetHitTestMask(mask_rect);
1371 } 1376 }
1372 1377
1373 } // namespace views 1378 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698