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

Side by Side Diff: ui/base/test/ui_controls_internal_win.cc

Issue 1255073002: clang/win: Fix most -Wunused-function warnings in Chromium code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac Created 5 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/base/test/ui_controls_internal_win.h" 5 #include "ui/base/test/ui_controls_internal_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bool FillKeyboardInput(ui::KeyboardCode key, INPUT* input, bool key_up) { 141 bool FillKeyboardInput(ui::KeyboardCode key, INPUT* input, bool key_up) {
142 memset(input, 0, sizeof(INPUT)); 142 memset(input, 0, sizeof(INPUT));
143 input->type = INPUT_KEYBOARD; 143 input->type = INPUT_KEYBOARD;
144 input->ki.wVk = ui::WindowsKeyCodeForKeyboardCode(key); 144 input->ki.wVk = ui::WindowsKeyCodeForKeyboardCode(key);
145 input->ki.dwFlags = key_up ? KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP : 145 input->ki.dwFlags = key_up ? KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP :
146 KEYEVENTF_EXTENDEDKEY; 146 KEYEVENTF_EXTENDEDKEY;
147 147
148 return true; 148 return true;
149 } 149 }
150 150
151 // Send a key event (up/down)
152 bool SendKeyEvent(ui::KeyboardCode key, bool up) {
153 INPUT input = { 0 };
154
155 if (!FillKeyboardInput(key, &input, up))
156 return false;
157
158 if (!::SendInput(1, &input, sizeof(INPUT)))
159 return false;
160
161 return true;
162 }
163
164 } // namespace 151 } // namespace
165 152
166 namespace ui_controls { 153 namespace ui_controls {
167 namespace internal { 154 namespace internal {
168 155
169 bool SendKeyPressImpl(HWND window, 156 bool SendKeyPressImpl(HWND window,
170 ui::KeyboardCode key, 157 ui::KeyboardCode key,
171 bool control, 158 bool control,
172 bool shift, 159 bool shift,
173 bool alt, 160 bool alt,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 return false; 322 return false;
336 323
337 if (dispatcher.get()) 324 if (dispatcher.get())
338 dispatcher->AddRef(); 325 dispatcher->AddRef();
339 326
340 return true; 327 return true;
341 } 328 }
342 329
343 } // namespace internal 330 } // namespace internal
344 } // namespace ui_controls 331 } // namespace ui_controls
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698