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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 10908127: events: Move EventTarget into Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 | « content/browser/web_contents/web_contents_view_aura.h ('k') | ui/aura/demo/demo_main.cc » ('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 "content/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/renderer_host/dip_util.h" 8 #include "content/browser/renderer_host/dip_util.h"
9 #include "content/browser/renderer_host/render_view_host_factory.h" 9 #include "content/browser/renderer_host/render_view_host_factory.h"
10 #include "content/browser/web_contents/interstitial_page_impl.h" 10 #include "content/browser/web_contents/interstitial_page_impl.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 if (delegate_.get()) 489 if (delegate_.get())
490 delegate_->SizeChanged(new_bounds.size()); 490 delegate_->SizeChanged(new_bounds.size());
491 } 491 }
492 492
493 void WebContentsViewAura::OnFocus(aura::Window* old_focused_window) { 493 void WebContentsViewAura::OnFocus(aura::Window* old_focused_window) {
494 } 494 }
495 495
496 void WebContentsViewAura::OnBlur() { 496 void WebContentsViewAura::OnBlur() {
497 } 497 }
498 498
499 bool WebContentsViewAura::OnKeyEvent(ui::KeyEvent* event) {
500 return false;
501 }
502
503 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) { 499 gfx::NativeCursor WebContentsViewAura::GetCursor(const gfx::Point& point) {
504 return gfx::kNullCursor; 500 return gfx::kNullCursor;
505 } 501 }
506 502
507 int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const { 503 int WebContentsViewAura::GetNonClientComponent(const gfx::Point& point) const {
508 return HTCLIENT; 504 return HTCLIENT;
509 } 505 }
510 506
511 bool WebContentsViewAura::ShouldDescendIntoChildForEventHandling( 507 bool WebContentsViewAura::ShouldDescendIntoChildForEventHandling(
512 aura::Window* child, 508 aura::Window* child,
513 const gfx::Point& location) { 509 const gfx::Point& location) {
514 return true; 510 return true;
515 } 511 }
516 512
517 bool WebContentsViewAura::OnMouseEvent(ui::MouseEvent* event) {
518 if (!web_contents_->GetDelegate())
519 return false;
520
521 switch (event->type()) {
522 case ui::ET_MOUSE_PRESSED:
523 web_contents_->GetDelegate()->ActivateContents(web_contents_);
524 break;
525 case ui::ET_MOUSE_MOVED:
526 web_contents_->GetDelegate()->ContentsMouseEvent(
527 web_contents_, gfx::Screen::GetCursorScreenPoint(), true);
528 break;
529 default:
530 break;
531 }
532 return false;
533 }
534
535 ui::TouchStatus WebContentsViewAura::OnTouchEvent(ui::TouchEvent* event) {
536 return ui::TOUCH_STATUS_UNKNOWN;
537 }
538
539 ui::EventResult WebContentsViewAura::OnGestureEvent(
540 ui::GestureEvent* event) {
541 return ui::ER_UNHANDLED;
542 }
543
544 bool WebContentsViewAura::CanFocus() { 513 bool WebContentsViewAura::CanFocus() {
545 // Do not take the focus if |view_| is gone because neither the view window 514 // Do not take the focus if |view_| is gone because neither the view window
546 // nor this window can handle key events. 515 // nor this window can handle key events.
547 return view_ != NULL; 516 return view_ != NULL;
548 } 517 }
549 518
550 void WebContentsViewAura::OnCaptureLost() { 519 void WebContentsViewAura::OnCaptureLost() {
551 } 520 }
552 521
553 void WebContentsViewAura::OnPaint(gfx::Canvas* canvas) { 522 void WebContentsViewAura::OnPaint(gfx::Canvas* canvas) {
(...skipping 17 matching lines...) Expand all
571 } 540 }
572 541
573 bool WebContentsViewAura::HasHitTestMask() const { 542 bool WebContentsViewAura::HasHitTestMask() const {
574 return false; 543 return false;
575 } 544 }
576 545
577 void WebContentsViewAura::GetHitTestMask(gfx::Path* mask) const { 546 void WebContentsViewAura::GetHitTestMask(gfx::Path* mask) const {
578 } 547 }
579 548
580 //////////////////////////////////////////////////////////////////////////////// 549 ////////////////////////////////////////////////////////////////////////////////
550 // WebContentsViewAura, ui::EventHandler implementation:
551
552 ui::EventResult WebContentsViewAura::OnKeyEvent(ui::KeyEvent* event) {
553 return ui::ER_UNHANDLED;
554 }
555
556 ui::EventResult WebContentsViewAura::OnMouseEvent(ui::MouseEvent* event) {
557 if (!web_contents_->GetDelegate())
558 return ui::ER_UNHANDLED;
559
560 switch (event->type()) {
561 case ui::ET_MOUSE_PRESSED:
562 web_contents_->GetDelegate()->ActivateContents(web_contents_);
563 break;
564 case ui::ET_MOUSE_MOVED:
565 web_contents_->GetDelegate()->ContentsMouseEvent(
566 web_contents_, gfx::Screen::GetCursorScreenPoint(), true);
567 break;
568 default:
569 break;
570 }
571 return ui::ER_UNHANDLED;
572 }
573
574 ui::TouchStatus WebContentsViewAura::OnTouchEvent(ui::TouchEvent* event) {
575 return ui::TOUCH_STATUS_UNKNOWN;
576 }
577
578 ui::EventResult WebContentsViewAura::OnGestureEvent(
579 ui::GestureEvent* event) {
580 return ui::ER_UNHANDLED;
581 }
582
583 ////////////////////////////////////////////////////////////////////////////////
581 // WebContentsViewAura, aura::client::DragDropDelegate implementation: 584 // WebContentsViewAura, aura::client::DragDropDelegate implementation:
582 585
583 void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) { 586 void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) {
584 if (drag_dest_delegate_) 587 if (drag_dest_delegate_)
585 drag_dest_delegate_->DragInitialize(web_contents_); 588 drag_dest_delegate_->DragInitialize(web_contents_);
586 589
587 WebDropData drop_data; 590 WebDropData drop_data;
588 PrepareWebDropData(&drop_data, event.data()); 591 PrepareWebDropData(&drop_data, event.data());
589 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); 592 WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
590 593
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 OnDragEntered(event); 636 OnDragEntered(event);
634 637
635 web_contents_->GetRenderViewHost()->DragTargetDrop( 638 web_contents_->GetRenderViewHost()->DragTargetDrop(
636 event.location(), 639 event.location(),
637 gfx::Screen::GetCursorScreenPoint(), 640 gfx::Screen::GetCursorScreenPoint(),
638 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); 641 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
639 if (drag_dest_delegate_) 642 if (drag_dest_delegate_)
640 drag_dest_delegate_->OnDrop(); 643 drag_dest_delegate_->OnDrop();
641 return current_drag_op_; 644 return current_drag_op_;
642 } 645 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_aura.h ('k') | ui/aura/demo/demo_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698