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

Unified Diff: webkit/glue/plugins/pepper_plugin_instance.cc

Issue 2948009: Fix pepper v2 find implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/plugins/pepper_plugin_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/pepper_plugin_instance.cc
===================================================================
--- webkit/glue/plugins/pepper_plugin_instance.cc (revision 52166)
+++ webkit/glue/plugins/pepper_plugin_instance.cc (working copy)
@@ -199,7 +199,8 @@
instance_interface_(instance_interface),
container_(NULL),
full_frame_(false),
- find_identifier_(-1) {
+ find_identifier_(-1),
+ plugin_find_interface_(NULL) {
DCHECK(delegate);
module_->InstanceCreated(this);
delegate_->InstanceCreated(this);
@@ -386,33 +387,35 @@
bool PluginInstance::StartFind(const string16& search_text,
bool case_sensitive,
int identifier) {
- if (!plugin_find_interface_) {
- plugin_find_interface_ =
- reinterpret_cast<const PPP_Find*>(module_->GetPluginInterface(
- PPP_FIND_INTERFACE));
- }
-
- if (plugin_find_interface_)
+ if (!LoadFindInterface())
return false;
-
find_identifier_ = identifier;
return plugin_find_interface_->StartFind(
GetPPInstance(),
- reinterpret_cast<const char*>(search_text.c_str()),
+ UTF16ToUTF8(search_text.c_str()).c_str(),
case_sensitive);
}
void PluginInstance::SelectFindResult(bool forward) {
- DCHECK(plugin_find_interface_);
-
- plugin_find_interface_->SelectFindResult(GetPPInstance(), forward);
+ if (LoadFindInterface())
+ plugin_find_interface_->SelectFindResult(GetPPInstance(), forward);
}
void PluginInstance::StopFind() {
- DCHECK(plugin_find_interface_);
-
+ if (!LoadFindInterface())
+ return;
find_identifier_ = -1;
plugin_find_interface_->StopFind(GetPPInstance());
}
+bool PluginInstance::LoadFindInterface() {
+ if (!plugin_find_interface_) {
+ plugin_find_interface_ =
+ reinterpret_cast<const PPP_Find*>(module_->GetPluginInterface(
+ PPP_FIND_INTERFACE));
+ }
+
+ return !!plugin_find_interface_;
+}
+
} // namespace pepper
« no previous file with comments | « webkit/glue/plugins/pepper_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698