Skip to content

Commit

Permalink
Revert of Add print and getSelectedText functions to the OOP PDF scri…
Browse files Browse the repository at this point in the history
…pting API (patchset chromium#3 id:40001 of https://codereview.chromium.org/843463002/)

Reason for revert:
Win7 Tests fail the test PDFExtensionTest.BasicPlugin.

API Test Error in testGetSelectedText

http://build.chromium.org/p/chromium.webkit/builders/Win7%20Tests/builds/7823/steps/browser_tests/logs/BasicPlugin

Original issue's description:
> 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
>
> Committed: https://crrev.com/7b1df224a957da8376e0ae71ab2d53dabf658b0a
> Cr-Commit-Position: refs/heads/master@{#310663}

TBR=sammc@chromium.org,raymes@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=415858

Review URL: https://codereview.chromium.org/843923002

Cr-Commit-Position: refs/heads/master@{#310716}
  • Loading branch information
keishi authored and Commit bot committed Jan 9, 2015
1 parent 4c80f15 commit 39de3f0
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 69 deletions.
6 changes: 0 additions & 6 deletions chrome/browser/resources/pdf/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,6 @@ PDFViewer.prototype = {
else
this.passwordScreen_.deny();
break;
case 'getSelectedTextReply':
this.sendScriptingMessage_(message.data);
break;
case 'goToPage':
this.viewport_.goToPage(message.data.page);
break;
Expand Down Expand Up @@ -528,10 +525,7 @@ PDFViewer.prototype = {
handleScriptingMessage: function(message) {
switch (message.data.type.toString()) {
case 'getAccessibilityJSON':
case 'getSelectedText':
case 'loadPreviewPage':
case 'print':
case 'selectAll':
this.plugin_.postMessage(message.data);
break;
case 'resetPrintPreviewMode':
Expand Down
45 changes: 1 addition & 44 deletions chrome/browser/resources/pdf/pdf_scripting_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ function PDFScriptingAPI(window, plugin) {
this.accessibilityCallback_ = null;
}
break;
case 'getSelectedTextReply':
if (this.selectedTextCallback_) {
this.selectedTextCallback_(event.data.selectedText);
this.selectedTextCallback_ = null;
}
break;
}
}.bind(this), false);
}
Expand Down Expand Up @@ -135,8 +129,7 @@ PDFScriptingAPI.prototype = {
},

/**
* Get accessibility JSON for the document. May only be called after document
* load.
* Get accessibility JSON for the document.
* @param {Function} callback a callback to be called with the accessibility
* json that has been retrieved.
* @param {number} [page] the 0-indexed page number to get accessibility data
Expand All @@ -158,42 +151,6 @@ PDFScriptingAPI.prototype = {
return true;
},

/**
* Select all the text in the document. May only be called after document
* load.
*/
selectAll: function() {
this.sendMessage_({
type: 'selectAll'
});
},

/**
* Get the selected text in the document. The callback will be called with the
* text that is selected. May only be called after document load.
* @param {Function} callback a callback to be called with the selected text.
* @return {boolean} true if the function is successful, false if there is an
* outstanding request for selected text that has not been answered.
*/
getSelectedText: function(callback) {
if (this.selectedTextCallback_)
return false;
this.selectedTextCallback_ = callback;
this.sendMessage_({
type: 'getSelectedText'
});
return true;
},

/**
* Print the document. May only be called after document load.
*/
print: function() {
this.sendMessage_({
type: 'print'
});
},

/**
* Send a key event to the extension.
* @param {number} keyCode the key code to send to the extension.
Expand Down
10 changes: 1 addition & 9 deletions chrome/test/data/pdf/basic_plugin_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@ var tests = [
chrome.test.assertEq('some more text',
dict.textBox[1].textNodes[0].text);
}), 0);
},

function testGetSelectedText() {
var client = new PDFScriptingAPI(window, window);
client.selectAll();
client.getSelectedText(chrome.test.callbackPass(function(selectedText) {
chrome.test.assertEq('this is some text\nsome more text', selectedText);
}));
},
}
];

var scriptingAPI = new PDFScriptingAPI(window, window);
Expand Down
10 changes: 0 additions & 10 deletions pdf/out_of_process_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ 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;

Expand Down Expand Up @@ -449,11 +444,6 @@ 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();
}
Expand Down

0 comments on commit 39de3f0

Please sign in to comment.