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

Side by Side Diff: content/browser/devtools/protocol/input_handler.cc

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/devtools/protocol/input_handler.h" 5 #include "content/browser/devtools/protocol/input_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 to[i] = text16[i]; 90 to[i] = text16[i];
91 return true; 91 return true;
92 } 92 }
93 93
94 bool SetMouseEventButton(blink::WebMouseEvent* event, 94 bool SetMouseEventButton(blink::WebMouseEvent* event,
95 const std::string* button) { 95 const std::string* button) {
96 if (!button) 96 if (!button)
97 return true; 97 return true;
98 98
99 if (*button == dispatch_mouse_event::kButtonNone) { 99 if (*button == dispatch_mouse_event::kButtonNone) {
100 event->button = blink::WebMouseEvent::ButtonNone; 100 event->button = blink::WebMouseEvent::Button::NoButton;
101 } else if (*button == dispatch_mouse_event::kButtonLeft) { 101 } else if (*button == dispatch_mouse_event::kButtonLeft) {
102 event->button = blink::WebMouseEvent::ButtonLeft; 102 event->button = blink::WebMouseEvent::Button::Left;
103 event->modifiers |= blink::WebInputEvent::LeftButtonDown; 103 event->modifiers |= blink::WebInputEvent::LeftButtonDown;
104 } else if (*button == dispatch_mouse_event::kButtonMiddle) { 104 } else if (*button == dispatch_mouse_event::kButtonMiddle) {
105 event->button = blink::WebMouseEvent::ButtonMiddle; 105 event->button = blink::WebMouseEvent::Button::Middle;
106 event->modifiers |= blink::WebInputEvent::MiddleButtonDown; 106 event->modifiers |= blink::WebInputEvent::MiddleButtonDown;
107 } else if (*button == dispatch_mouse_event::kButtonRight) { 107 } else if (*button == dispatch_mouse_event::kButtonRight) {
108 event->button = blink::WebMouseEvent::ButtonRight; 108 event->button = blink::WebMouseEvent::Button::Right;
109 event->modifiers |= blink::WebInputEvent::RightButtonDown; 109 event->modifiers |= blink::WebInputEvent::RightButtonDown;
110 } else { 110 } else {
111 return false; 111 return false;
112 } 112 }
113 return true; 113 return true;
114 } 114 }
115 115
116 bool SetMouseEventType(blink::WebMouseEvent* event, const std::string& type) { 116 bool SetMouseEventType(blink::WebMouseEvent* event, const std::string& type) {
117 if (type == dispatch_mouse_event::kTypeMousePressed) { 117 if (type == dispatch_mouse_event::kTypeMousePressed) {
118 event->type = blink::WebInputEvent::MouseDown; 118 event->type = blink::WebInputEvent::MouseDown;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } else { 509 } else {
510 client_->SendError(command_id, 510 client_->SendError(command_id,
511 Response::InternalError(base::StringPrintf( 511 Response::InternalError(base::StringPrintf(
512 "Synthetic tap failed, result was %d", result))); 512 "Synthetic tap failed, result was %d", result)));
513 } 513 }
514 } 514 }
515 515
516 } // namespace input 516 } // namespace input
517 } // namespace devtools 517 } // namespace devtools
518 } // namespace content 518 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/color_picker.cc ('k') | content/browser/frame_host/render_widget_host_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698