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

Unified Diff: chrome/browser/ui/views/desktop_media_picker_views.cc

Issue 317783007: Handle tap gestures in desktop media picker's source list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/desktop_media_picker_views.cc
diff --git a/chrome/browser/ui/views/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_media_picker_views.cc
index f8badc4fbdd33f0c8fc4d7da493cac9fa67cf9fa..4614f480a8261a3360404a534a618a5f84e40661 100644
--- a/chrome/browser/ui/views/desktop_media_picker_views.cc
+++ b/chrome/browser/ui/views/desktop_media_picker_views.cc
@@ -15,6 +15,7 @@
#include "grit/generated_resources.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/events/event_constants.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h"
#include "ui/native_theme/native_theme.h"
@@ -97,6 +98,7 @@ class DesktopMediaSourceView : public views::View {
virtual void OnFocus() OVERRIDE;
virtual void OnBlur() OVERRIDE;
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
+ virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
private:
DesktopMediaListView* parent_;
@@ -336,6 +338,23 @@ bool DesktopMediaSourceView::OnMousePressed(const ui::MouseEvent& event) {
return true;
}
+void DesktopMediaSourceView::OnGestureEvent(ui::GestureEvent* event) {
+ if (event->type() == ui::ET_GESTURE_TAP &&
+ event->details().tap_count() == 2) {
+ RequestFocus();
+ parent_->OnDoubleClick();
+ event->SetHandled();
+ return;
+ }
+
+ // Detect tap gesture using ET_GESTURE_TAP_DOWN so the view also gets focused
+ // on the long tap (when the tap gesture starts).
+ if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
+ RequestFocus();
+ event->SetHandled();
+ }
+}
+
DesktopMediaListView::DesktopMediaListView(
DesktopMediaPickerDialogView* parent,
scoped_ptr<DesktopMediaList> media_list)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698