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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2641313002: Bypass key event suppression for PrintScreen (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_unittest.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/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "gpu/command_buffer/service/gpu_switches.h" 76 #include "gpu/command_buffer/service/gpu_switches.h"
77 #include "gpu/ipc/common/gpu_messages.h" 77 #include "gpu/ipc/common/gpu_messages.h"
78 #include "net/base/filename_util.h" 78 #include "net/base/filename_util.h"
79 #include "skia/ext/image_operations.h" 79 #include "skia/ext/image_operations.h"
80 #include "skia/ext/platform_canvas.h" 80 #include "skia/ext/platform_canvas.h"
81 #include "storage/browser/fileapi/isolated_context.h" 81 #include "storage/browser/fileapi/isolated_context.h"
82 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 82 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
83 #include "ui/base/clipboard/clipboard.h" 83 #include "ui/base/clipboard/clipboard.h"
84 #include "ui/events/blink/web_input_event_traits.h" 84 #include "ui/events/blink/web_input_event_traits.h"
85 #include "ui/events/event.h" 85 #include "ui/events/event.h"
86 #include "ui/events/keycodes/dom/dom_code.h"
86 #include "ui/events/keycodes/keyboard_codes.h" 87 #include "ui/events/keycodes/keyboard_codes.h"
87 #include "ui/gfx/color_space.h" 88 #include "ui/gfx/color_space.h"
88 #include "ui/gfx/geometry/size_conversions.h" 89 #include "ui/gfx/geometry/size_conversions.h"
89 #include "ui/gfx/geometry/vector2d_conversions.h" 90 #include "ui/gfx/geometry/vector2d_conversions.h"
90 #include "ui/gfx/image/image_skia.h" 91 #include "ui/gfx/image/image_skia.h"
91 #include "ui/gfx/skbitmap_operations.h" 92 #include "ui/gfx/skbitmap_operations.h"
92 #include "ui/snapshot/snapshot.h" 93 #include "ui/snapshot/snapshot.h"
93 94
94 #if defined(OS_ANDROID) 95 #if defined(OS_ANDROID)
95 #include "ui/android/view_android.h" 96 #include "ui/android/view_android.h"
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 if (key_event.type() == WebKeyboardEvent::RawKeyDown) 1202 if (key_event.type() == WebKeyboardEvent::RawKeyDown)
1202 suppress_events_until_keydown_ = true; 1203 suppress_events_until_keydown_ = true;
1203 return; 1204 return;
1204 } 1205 }
1205 1206
1206 // Double check the type to make sure caller hasn't sent us nonsense that 1207 // Double check the type to make sure caller hasn't sent us nonsense that
1207 // will mess up our key queue. 1208 // will mess up our key queue.
1208 if (!WebInputEvent::isKeyboardEventType(key_event.type())) 1209 if (!WebInputEvent::isKeyboardEventType(key_event.type()))
1209 return; 1210 return;
1210 1211
1211 if (suppress_events_until_keydown_) { 1212 // For PrintScreen, a lone KeyUp event arrives. Bypass the suppression in this
sadrul 2017/01/23 18:18:35 Is this the case on all platforms?
foolip 2017/01/24 04:38:12 I tested Windows and Linux then, on Mac there isn'
1213 // case, as a |SuppressEventsUntilKeyDown()| call otherwise causes the keyup
1214 // events to go missing.
1215 // TODO(foolip): Remove this special case by instead removing the
1216 // |SuppressEventsUntilKeyDown()| call. https://crbug.com/668969
1217 bool is_print_screen =
1218 static_cast<ui::DomCode>(key_event.domCode) == ui::DomCode::PRINT_SCREEN;
1219 if (suppress_events_until_keydown_ && !is_print_screen) {
1212 // If the preceding RawKeyDown event was handled by the browser, then we 1220 // If the preceding RawKeyDown event was handled by the browser, then we
1213 // need to suppress all events generated by it until the next RawKeyDown or 1221 // need to suppress all events generated by it until the next RawKeyDown or
1214 // KeyDown event. 1222 // KeyDown event.
1215 if (key_event.type() == WebKeyboardEvent::KeyUp || 1223 if (key_event.type() == WebKeyboardEvent::KeyUp ||
1216 key_event.type() == WebKeyboardEvent::Char) 1224 key_event.type() == WebKeyboardEvent::Char)
1217 return; 1225 return;
1218 DCHECK(key_event.type() == WebKeyboardEvent::RawKeyDown || 1226 DCHECK(key_event.type() == WebKeyboardEvent::RawKeyDown ||
1219 key_event.type() == WebKeyboardEvent::KeyDown); 1227 key_event.type() == WebKeyboardEvent::KeyDown);
1220 suppress_events_until_keydown_ = false; 1228 suppress_events_until_keydown_ = false;
1221 } 1229 }
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 // different from the receiver's. 2534 // different from the receiver's.
2527 file_system_file.url = 2535 file_system_file.url =
2528 GURL(storage::GetIsolatedFileSystemRootURIString( 2536 GURL(storage::GetIsolatedFileSystemRootURIString(
2529 file_system_url.origin(), filesystem_id, std::string()) 2537 file_system_url.origin(), filesystem_id, std::string())
2530 .append(register_name)); 2538 .append(register_name));
2531 file_system_file.filesystem_id = filesystem_id; 2539 file_system_file.filesystem_id = filesystem_id;
2532 } 2540 }
2533 } 2541 }
2534 2542
2535 } // namespace content 2543 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698