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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 11592011: events: Update mouse-event handlers to not return EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_delegate.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/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/activation_client.h" 10 #include "ui/aura/client/activation_client.h"
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 return; 778 return;
779 } 779 }
780 // Renderer may send a key event back to us if the key event wasn't handled, 780 // Renderer may send a key event back to us if the key event wasn't handled,
781 // and the window may be invisible by that time. 781 // and the window may be invisible by that time.
782 if (!window_->IsVisible()) 782 if (!window_->IsVisible())
783 return; 783 return;
784 GetWidget()->GetInputMethod()->DispatchKeyEvent(*event); 784 GetWidget()->GetInputMethod()->DispatchKeyEvent(*event);
785 event->SetHandled(); 785 event->SetHandled();
786 } 786 }
787 787
788 ui::EventResult NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) { 788 void NativeWidgetAura::OnMouseEvent(ui::MouseEvent* event) {
789 DCHECK(window_->IsVisible()); 789 DCHECK(window_->IsVisible());
790 if (event->type() == ui::ET_MOUSEWHEEL) 790 if (event->type() == ui::ET_MOUSEWHEEL) {
791 return delegate_->OnMouseEvent(*event) ? ui::ER_HANDLED : ui::ER_UNHANDLED; 791 delegate_->OnMouseEvent(event);
792 if (event->handled())
793 return;
794 }
792 795
793 if (tooltip_manager_.get()) 796 if (tooltip_manager_.get())
794 tooltip_manager_->UpdateTooltip(); 797 tooltip_manager_->UpdateTooltip();
795 return delegate_->OnMouseEvent(*event) ? ui::ER_HANDLED : ui::ER_UNHANDLED; 798 delegate_->OnMouseEvent(event);
796 } 799 }
797 800
798 void NativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) { 801 void NativeWidgetAura::OnScrollEvent(ui::ScrollEvent* event) {
799 if (event->type() == ui::ET_SCROLL) { 802 if (event->type() == ui::ET_SCROLL) {
800 delegate_->OnScrollEvent(event); 803 delegate_->OnScrollEvent(event);
801 if (event->handled()) 804 if (event->handled())
802 return; 805 return;
803 806
804 // Convert unprocessed scroll events into wheel events. 807 // Convert unprocessed scroll events into wheel events.
805 ui::MouseWheelEvent mwe(*static_cast<ui::ScrollEvent*>(event)); 808 ui::MouseWheelEvent mwe(*static_cast<ui::ScrollEvent*>(event));
806 if (delegate_->OnMouseEvent(mwe)) 809 delegate_->OnMouseEvent(&mwe);
807 event->SetHandled(); 810 if (mwe.handled())
811 event->SetHandled();
808 return; 812 return;
809 } 813 }
810 delegate_->OnScrollEvent(event); 814 delegate_->OnScrollEvent(event);
811 } 815 }
812 816
813 void NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) { 817 void NativeWidgetAura::OnTouchEvent(ui::TouchEvent* event) {
814 DCHECK(window_->IsVisible()); 818 DCHECK(window_->IsVisible());
815 delegate_->OnTouchEvent(event); 819 delegate_->OnTouchEvent(event);
816 } 820 }
817 821
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 return aura::Env::GetInstance()->is_mouse_button_down(); 1069 return aura::Env::GetInstance()->is_mouse_button_down();
1066 } 1070 }
1067 1071
1068 // static 1072 // static
1069 bool NativeWidgetPrivate::IsTouchDown() { 1073 bool NativeWidgetPrivate::IsTouchDown() {
1070 return aura::Env::GetInstance()->is_touch_down(); 1074 return aura::Env::GetInstance()->is_touch_down();
1071 } 1075 }
1072 1076
1073 } // namespace internal 1077 } // namespace internal
1074 } // namespace views 1078 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura.h ('k') | ui/views/widget/native_widget_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698