diff options
author | deepak.m1 <deepak.m1@samsung.com> | 2014-10-02 23:13:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-03 06:14:35 +0000 |
commit | 2faaced431869fd80ba281d230d0bc4bcfec32fb (patch) | |
tree | 21d068409b14396df116880171f90a24dca8ed0d /pdf/out_of_process_instance.cc | |
parent | 737f39b697dd822d1d117df19b7a0270a1707e69 (diff) | |
download | chromium_src-2faaced431869fd80ba281d230d0bc4bcfec32fb.zip chromium_src-2faaced431869fd80ba281d230d0bc4bcfec32fb.tar.gz chromium_src-2faaced431869fd80ba281d230d0bc4bcfec32fb.tar.bz2 |
Handle the keyboard event for ctrl+a inside pdf.js instead of out_of_process_pdf.cc
This moves the logic to handle the ctrl+a keyboard event into the pdf.js container page, sending a message to the plugin to select all the text. This ensures that the event is handled, even if the plugin element doesn't have focus in the document.
BUG=419986
Review URL: https://codereview.chromium.org/615853003
Cr-Commit-Position: refs/heads/master@{#297998}
Diffstat (limited to 'pdf/out_of_process_instance.cc')
-rw-r--r-- | pdf/out_of_process_instance.cc | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index a385bb3..d627dc2 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -127,6 +127,8 @@ const char kJSEmailBody[] = "body"; // Rotation (Page -> Plugin) const char kJSRotateClockwiseType[] = "rotateClockwise"; const char kJSRotateCounterclockwiseType[] = "rotateCounterclockwise"; +// Select all text in the document (Page -> Plugin) +const char kJSSelectAllType[] = "selectAll"; const int kFindResultCooldownMs = 100; @@ -381,6 +383,8 @@ void OutOfProcessInstance::HandleMessage(const pp::Var& message) { RotateClockwise(); } else if (type == kJSRotateCounterclockwiseType) { RotateCounterclockwise(); + } else if (type == kJSSelectAllType) { + engine_->SelectAll(); } else if (type == kJSResetPrintPreviewModeType && dict.Get(pp::Var(kJSPrintPreviewUrl)).is_string() && dict.Get(pp::Var(kJSPrintPreviewGrayscale)).is_bool() && @@ -488,16 +492,6 @@ bool OutOfProcessInstance::HandleInputEvent( // TODO(raymes): Implement this scroll behavior in JS: // When click+dragging, scroll the document correctly. - if (event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN && - event.GetModifiers() & kDefaultKeyModifier) { - pp::KeyboardInputEvent keyboard_event(event); - switch (keyboard_event.GetKeyCode()) { - case 'A': - engine_->SelectAll(); - return true; - } - } - // Return true for unhandled clicks so the plugin takes focus. return (event.GetType() == PP_INPUTEVENT_TYPE_MOUSEDOWN); } |