diff options
author | raymes <raymes@chromium.org> | 2015-01-08 17:56:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-09 01:57:44 +0000 |
commit | 7b1df224a957da8376e0ae71ab2d53dabf658b0a (patch) | |
tree | 84ecf9b7d07d2785a79bfd606bd645bdc468b7c6 /pdf | |
parent | 03c38d9dc88a9b1b040218fbdd56ed4e2eb82653 (diff) | |
download | chromium_src-7b1df224a957da8376e0ae71ab2d53dabf658b0a.zip chromium_src-7b1df224a957da8376e0ae71ab2d53dabf658b0a.tar.gz chromium_src-7b1df224a957da8376e0ae71ab2d53dabf658b0a.tar.bz2 |
Add print and getSelectedText functions to the OOP PDF scripting API
These are needed by some internal users (see the bug for more details).
A test is added for selectAll/getSelectedText.
BUG=415858
Review URL: https://codereview.chromium.org/843463002
Cr-Commit-Position: refs/heads/master@{#310663}
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/out_of_process_instance.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index 59b0439..e0ab99a 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -127,6 +127,11 @@ const char kJSRotateClockwiseType[] = "rotateClockwise"; const char kJSRotateCounterclockwiseType[] = "rotateCounterclockwise"; // Select all text in the document (Page -> Plugin) const char kJSSelectAllType[] = "selectAll"; +// Get the selected text in the document (Page -> Plugin) +const char kJSGetSelectedTextType[] = "getSelectedText"; +// Reply with selected text (Plugin -> Page) +const char kJSGetSelectedTextReplyType[] = "getSelectedTextReply"; +const char kJSSelectedText[] = "selectedText"; const int kFindResultCooldownMs = 100; @@ -444,6 +449,11 @@ void OutOfProcessInstance::HandleMessage(const pp::Var& message) { PostMessage(reply); } else if (type == kJSStopScrollingType) { stop_scrolling_ = true; + } else if (type == kJSGetSelectedTextType) { + pp::VarDictionary reply; + reply.Set(pp::Var(kType), pp::Var(kJSGetSelectedTextReplyType)); + reply.Set(pp::Var(kJSSelectedText), engine_->GetSelectedText()); + PostMessage(reply); } else { NOTREACHED(); } |