summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authorkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-15 04:26:11 +0000
committerkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-15 04:26:11 +0000
commit72b1a224e01382b33c27500525b782c0469d5de0 (patch)
tree631f1649d337adcdaf7f13823f4d0647748c92ea /content/renderer
parentd77c96371c477920358f39734ae8eadfd1c38e39 (diff)
downloadchromium_src-72b1a224e01382b33c27500525b782c0469d5de0.zip
chromium_src-72b1a224e01382b33c27500525b782c0469d5de0.tar.gz
chromium_src-72b1a224e01382b33c27500525b782c0469d5de0.tar.bz2
Implement GetSelectedText() for the OOP PDF plugin.
This change exposes a SetSelectedText() function to the plugin so it can eagerly notify the plugin host what the currently selected text is. This allows the call to GetSelectedText() to return synchronously with the last selected text, rather than the empty string. R=joi@chromium.org, piman@chromium.org, raymes@chromium.org Review URL: https://codereview.chromium.org/127343003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/pepper/fake_pepper_plugin_instance.cc3
-rw-r--r--content/renderer/pepper/fake_pepper_plugin_instance.h1
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.cc7
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.h4
4 files changed, 14 insertions, 1 deletions
diff --git a/content/renderer/pepper/fake_pepper_plugin_instance.cc b/content/renderer/pepper/fake_pepper_plugin_instance.cc
index af0ba49..af1a900 100644
--- a/content/renderer/pepper/fake_pepper_plugin_instance.cc
+++ b/content/renderer/pepper/fake_pepper_plugin_instance.cc
@@ -78,4 +78,7 @@ int FakePepperPluginInstance::MakePendingFileRefRendererHost(
void FakePepperPluginInstance::SetEmbedProperty(PP_Var key, PP_Var value) {}
+void FakePepperPluginInstance::SetSelectedText(
+ const base::string16& selected_text) {}
+
} // namespace content
diff --git a/content/renderer/pepper/fake_pepper_plugin_instance.h b/content/renderer/pepper/fake_pepper_plugin_instance.h
index f492b33..d97d020 100644
--- a/content/renderer/pepper/fake_pepper_plugin_instance.h
+++ b/content/renderer/pepper/fake_pepper_plugin_instance.h
@@ -39,6 +39,7 @@ class FakePepperPluginInstance : public PepperPluginInstance {
virtual int MakePendingFileRefRendererHost(
const base::FilePath& path) OVERRIDE;
virtual void SetEmbedProperty(PP_Var key, PP_Var value) OVERRIDE;
+ virtual void SetSelectedText(const base::string16& selected_text) OVERRIDE;
private:
GURL gurl_;
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index c8b09de..3ef54aa 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -1243,11 +1243,16 @@ bool PepperPluginInstanceImpl::GetBitmapForOptimizedPluginPaint(
return true;
}
+void PepperPluginInstanceImpl::SetSelectedText(
+ const base::string16& selected_text) {
+ selected_text_ = selected_text;
+}
+
base::string16 PepperPluginInstanceImpl::GetSelectedText(bool html) {
// Keep a reference on the stack. See NOTE above.
scoped_refptr<PepperPluginInstanceImpl> ref(this);
if (!LoadSelectionInterface())
- return base::string16();
+ return selected_text_;
PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(),
PP_FromBool(html));
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index f000bce..85a6094 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -370,6 +370,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
virtual int MakePendingFileRefRendererHost(
const base::FilePath& path) OVERRIDE;
virtual void SetEmbedProperty(PP_Var key, PP_Var value) OVERRIDE;
+ virtual void SetSelectedText(const base::string16& selected_text) OVERRIDE;
// PPB_Instance_API implementation.
virtual PP_Bool BindGraphics(PP_Instance instance,
@@ -858,6 +859,9 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
bool is_deleted_;
+ // The text that is currently selected in the plugin.
+ base::string16 selected_text_;
+
// We use a weak ptr factory for scheduling DidChangeView events so that we
// can tell whether updates are pending and consolidate them. When there's
// already a weak ptr pending (HasWeakPtrs is true), code should update the