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

Side by Side Diff: ui/aura/remote_root_window_host_win.cc

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/remote_root_window_host_win.h ('k') | ui/aura/root_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/remote_root_window_host_win.h" 5 #include "ui/aura/remote_root_window_host_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 void RemoteWindowTreeHostWin::OnDeviceScaleFactorChanged( 480 void RemoteWindowTreeHostWin::OnDeviceScaleFactorChanged(
481 float device_scale_factor) { 481 float device_scale_factor) {
482 NOTIMPLEMENTED(); 482 NOTIMPLEMENTED();
483 } 483 }
484 484
485 void RemoteWindowTreeHostWin::PrepareForShutdown() { 485 void RemoteWindowTreeHostWin::PrepareForShutdown() {
486 } 486 }
487 487
488 ui::EventProcessor* RemoteWindowTreeHostWin::GetEventProcessor() {
489 return delegate_->GetEventProcessor();
490 }
491
488 void RemoteWindowTreeHostWin::CancelComposition() { 492 void RemoteWindowTreeHostWin::CancelComposition() {
489 if (!host_) 493 if (!host_)
490 return; 494 return;
491 host_->Send(new MetroViewerHostMsg_ImeCancelComposition); 495 host_->Send(new MetroViewerHostMsg_ImeCancelComposition);
492 } 496 }
493 497
494 void RemoteWindowTreeHostWin::OnTextInputClientUpdated( 498 void RemoteWindowTreeHostWin::OnTextInputClientUpdated(
495 const std::vector<int32>& input_scopes, 499 const std::vector<int32>& input_scopes,
496 const std::vector<gfx::Rect>& composition_character_bounds) { 500 const std::vector<gfx::Rect>& composition_character_bounds) {
497 if (!host_) 501 if (!host_)
(...skipping 17 matching lines...) Expand all
515 gfx::Point result( x * scale_factor, y * scale_factor); 519 gfx::Point result( x * scale_factor, y * scale_factor);
516 return result; 520 return result;
517 } 521 }
518 522
519 void RemoteWindowTreeHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) { 523 void RemoteWindowTreeHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) {
520 if (ignore_mouse_moves_until_set_cursor_ack_) 524 if (ignore_mouse_moves_until_set_cursor_ack_)
521 return; 525 return;
522 526
523 gfx::Point location = PointFromNativeEvent(x, y); 527 gfx::Point location = PointFromNativeEvent(x, y);
524 ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, flags, 0); 528 ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, flags, 0);
525 delegate_->OnHostMouseEvent(&event); 529 SendEventToProcessor(&event);
526 } 530 }
527 531
528 void RemoteWindowTreeHostWin::OnMouseButton( 532 void RemoteWindowTreeHostWin::OnMouseButton(
529 const MetroViewerHostMsg_MouseButtonParams& params) { 533 const MetroViewerHostMsg_MouseButtonParams& params) {
530 gfx::Point location = PointFromNativeEvent(params.x, params.y); 534 gfx::Point location = PointFromNativeEvent(params.x, params.y);
531 ui::MouseEvent mouse_event(params.event_type, location, location, 535 ui::MouseEvent mouse_event(params.event_type, location, location,
532 static_cast<int>(params.flags), 536 static_cast<int>(params.flags),
533 static_cast<int>(params.changed_button)); 537 static_cast<int>(params.changed_button));
534 538
535 SetEventFlags(params.flags | key_event_flags()); 539 SetEventFlags(params.flags | key_event_flags());
536 if (params.event_type == ui::ET_MOUSEWHEEL) { 540 if (params.event_type == ui::ET_MOUSEWHEEL) {
537 int x_offset = params.is_horizontal_wheel ? params.extra : 0; 541 int x_offset = params.is_horizontal_wheel ? params.extra : 0;
538 int y_offset = !params.is_horizontal_wheel ? params.extra : 0; 542 int y_offset = !params.is_horizontal_wheel ? params.extra : 0;
539 ui::MouseWheelEvent wheel_event(mouse_event, x_offset, y_offset); 543 ui::MouseWheelEvent wheel_event(mouse_event, x_offset, y_offset);
540 delegate_->OnHostMouseEvent(&wheel_event); 544 SendEventToProcessor(&wheel_event);
541 } else if (params.event_type == ui::ET_MOUSE_PRESSED) { 545 } else if (params.event_type == ui::ET_MOUSE_PRESSED) {
542 // TODO(shrikant): Ideally modify code in event.cc by adding automatic 546 // TODO(shrikant): Ideally modify code in event.cc by adding automatic
543 // tracking of double clicks in synthetic MouseEvent constructor code. 547 // tracking of double clicks in synthetic MouseEvent constructor code.
544 // Non-synthetic MouseEvent constructor code does automatically track 548 // Non-synthetic MouseEvent constructor code does automatically track
545 // this. Need to use some caution while modifying synthetic constructor 549 // this. Need to use some caution while modifying synthetic constructor
546 // as many tests and other code paths depend on it and apparently 550 // as many tests and other code paths depend on it and apparently
547 // specifically depend on non implicit tracking of previous mouse event. 551 // specifically depend on non implicit tracking of previous mouse event.
548 if (last_mouse_click_event_ && 552 if (last_mouse_click_event_ &&
549 ui::MouseEvent::IsRepeatedClickEvent(mouse_event, 553 ui::MouseEvent::IsRepeatedClickEvent(mouse_event,
550 *last_mouse_click_event_)) { 554 *last_mouse_click_event_)) {
551 mouse_event.SetClickCount(2); 555 mouse_event.SetClickCount(2);
552 } else { 556 } else {
553 mouse_event.SetClickCount(1); 557 mouse_event.SetClickCount(1);
554 } 558 }
555 last_mouse_click_event_ .reset(new ui::MouseEvent(mouse_event)); 559 last_mouse_click_event_ .reset(new ui::MouseEvent(mouse_event));
556 delegate_->OnHostMouseEvent(&mouse_event); 560 SendEventToProcessor(&mouse_event);
557 } else { 561 } else {
558 delegate_->OnHostMouseEvent(&mouse_event); 562 SendEventToProcessor(&mouse_event);
559 } 563 }
560 } 564 }
561 565
562 void RemoteWindowTreeHostWin::OnKeyDown(uint32 vkey, 566 void RemoteWindowTreeHostWin::OnKeyDown(uint32 vkey,
563 uint32 repeat_count, 567 uint32 repeat_count,
564 uint32 scan_code, 568 uint32 scan_code,
565 uint32 flags) { 569 uint32 flags) {
566 DispatchKeyboardMessage(ui::ET_KEY_PRESSED, vkey, repeat_count, scan_code, 570 DispatchKeyboardMessage(ui::ET_KEY_PRESSED, vkey, repeat_count, scan_code,
567 flags, false); 571 flags, false);
568 } 572 }
(...skipping 20 matching lines...) Expand all
589 593
590 void RemoteWindowTreeHostWin::OnTouchDown(int32 x, 594 void RemoteWindowTreeHostWin::OnTouchDown(int32 x,
591 int32 y, 595 int32 y,
592 uint64 timestamp, 596 uint64 timestamp,
593 uint32 pointer_id) { 597 uint32 pointer_id) {
594 gfx::Point location = PointFromNativeEvent(x, y); 598 gfx::Point location = PointFromNativeEvent(x, y);
595 ui::TouchEvent event(ui::ET_TOUCH_PRESSED, 599 ui::TouchEvent event(ui::ET_TOUCH_PRESSED,
596 location, 600 location,
597 pointer_id, 601 pointer_id,
598 base::TimeDelta::FromMicroseconds(timestamp)); 602 base::TimeDelta::FromMicroseconds(timestamp));
599 delegate_->OnHostTouchEvent(&event); 603 SendEventToProcessor(&event);
600 } 604 }
601 605
602 void RemoteWindowTreeHostWin::OnTouchUp(int32 x, 606 void RemoteWindowTreeHostWin::OnTouchUp(int32 x,
603 int32 y, 607 int32 y,
604 uint64 timestamp, 608 uint64 timestamp,
605 uint32 pointer_id) { 609 uint32 pointer_id) {
606 gfx::Point location = PointFromNativeEvent(x, y); 610 gfx::Point location = PointFromNativeEvent(x, y);
607 ui::TouchEvent event(ui::ET_TOUCH_RELEASED, 611 ui::TouchEvent event(ui::ET_TOUCH_RELEASED,
608 location, 612 location,
609 pointer_id, 613 pointer_id,
610 base::TimeDelta::FromMicroseconds(timestamp)); 614 base::TimeDelta::FromMicroseconds(timestamp));
611 delegate_->OnHostTouchEvent(&event); 615 SendEventToProcessor(&event);
612 } 616 }
613 617
614 void RemoteWindowTreeHostWin::OnTouchMoved(int32 x, 618 void RemoteWindowTreeHostWin::OnTouchMoved(int32 x,
615 int32 y, 619 int32 y,
616 uint64 timestamp, 620 uint64 timestamp,
617 uint32 pointer_id) { 621 uint32 pointer_id) {
618 gfx::Point location = PointFromNativeEvent(x, y); 622 gfx::Point location = PointFromNativeEvent(x, y);
619 ui::TouchEvent event(ui::ET_TOUCH_MOVED, 623 ui::TouchEvent event(ui::ET_TOUCH_MOVED,
620 location, 624 location,
621 pointer_id, 625 pointer_id,
622 base::TimeDelta::FromMicroseconds(timestamp)); 626 base::TimeDelta::FromMicroseconds(timestamp));
623 delegate_->OnHostTouchEvent(&event); 627 SendEventToProcessor(&event);
624 } 628 }
625 629
626 void RemoteWindowTreeHostWin::OnFileSaveAsDone(bool success, 630 void RemoteWindowTreeHostWin::OnFileSaveAsDone(bool success,
627 const base::FilePath& filename, 631 const base::FilePath& filename,
628 int filter_index) { 632 int filter_index) {
629 if (success) 633 if (success)
630 file_saveas_completion_callback_.Run(filename, filter_index, NULL); 634 file_saveas_completion_callback_.Run(filename, filter_index, NULL);
631 else 635 else
632 failure_callback_.Run(NULL); 636 failure_callback_.Run(NULL);
633 file_saveas_completion_callback_.Reset(); 637 file_saveas_completion_callback_.Reset();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 : keyup_message[index]); 741 : keyup_message[index]);
738 ::PostThreadMessage(::GetCurrentThreadId(), 742 ::PostThreadMessage(::GetCurrentThreadId(),
739 message, 743 message,
740 vkey, 744 vkey,
741 repeat_count | scan_code >> 15); 745 repeat_count | scan_code >> 15);
742 } else { 746 } else {
743 ui::KeyEvent event(type, 747 ui::KeyEvent event(type,
744 ui::KeyboardCodeForWindowsKeyCode(vkey), 748 ui::KeyboardCodeForWindowsKeyCode(vkey),
745 flags, 749 flags,
746 is_character); 750 is_character);
747 delegate_->OnHostKeyEvent(&event); 751 SendEventToProcessor(&event);
748 } 752 }
749 } 753 }
750 754
751 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { 755 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) {
752 if (flags == event_flags_) 756 if (flags == event_flags_)
753 return; 757 return;
754 event_flags_ = flags; 758 event_flags_ = flags;
755 SetVirtualKeyStates(event_flags_); 759 SetVirtualKeyStates(event_flags_);
756 } 760 }
757 761
758 } // namespace aura 762 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/remote_root_window_host_win.h ('k') | ui/aura/root_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698