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

Unified Diff: chrome/renderer/webplugin_delegate_pepper.cc

Issue 1075011: Chrome side of adding search support to Pepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | « chrome/renderer/webplugin_delegate_pepper.h ('k') | third_party/npapi/bindings/npapi_extensions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/webplugin_delegate_pepper.cc
===================================================================
--- chrome/renderer/webplugin_delegate_pepper.cc (revision 42528)
+++ chrome/renderer/webplugin_delegate_pepper.cc (working copy)
@@ -321,6 +321,40 @@
return instance()->GetRangeRequest(range_request_id);
}
+void WebPluginDelegatePepper::StartFind(const std::string& search_text,
+ bool case_sensitive,
+ int identifier) {
+ find_identifier_ = identifier;
+ GetFindExtensions()->startFind(
+ instance()->npp(), search_text.c_str(), case_sensitive);
+}
+
+void WebPluginDelegatePepper::SelectFindResult(bool forward) {
+ GetFindExtensions()->selectFindResult(instance()->npp(), forward);
+}
+
+void WebPluginDelegatePepper::StopFind() {
+ find_identifier_ = -1;
+ GetFindExtensions()->stopFind(instance()->npp());
+}
+
+void WebPluginDelegatePepper::NumberOfFindResultsChanged(int total,
+ bool final_result) {
+ DCHECK(find_identifier_ != -1);
+
+ if (total == 0) {
+ render_view_->ReportNoFindInPageResults(find_identifier_);
+ } else {
+ render_view_->reportFindInPageMatchCount(
+ find_identifier_, total, final_result);
+ }
+}
+
+void WebPluginDelegatePepper::SelectedFindResultChanged(int index) {
+ render_view_->reportFindInPageSelection(
+ find_identifier_, index + 1, WebKit::WebRect());
+}
+
NPError WebPluginDelegatePepper::Device2DQueryCapability(int32 capability,
int32* value) {
return NPERR_GENERIC_ERROR;
@@ -982,7 +1016,11 @@
current_printable_area_ = gfx::Rect();
}
+bool WebPluginDelegatePepper::SupportsFind() {
+ return GetFindExtensions() != NULL;
+}
+
WebPluginDelegatePepper::WebPluginDelegatePepper(
const base::WeakPtr<RenderView>& render_view,
NPAPI::PluginInstance *instance)
@@ -993,6 +1031,7 @@
#if defined(ENABLE_GPU)
command_buffer_(NULL),
#endif
+ find_identifier_(-1),
method_factory3d_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
// For now we keep a window struct, although it isn't used.
memset(&window_, 0, sizeof(window_));
@@ -1263,6 +1302,15 @@
return ret;
}
+NPPFindExtensions* WebPluginDelegatePepper::GetFindExtensions() {
+ NPPFindExtensions* ret = NULL;
+ NPPExtensions* extensions = NULL;
+ instance()->NPP_GetValue(NPPVPepperExtensions, &extensions);
+ if (extensions && extensions->getFindExtensions)
+ ret = extensions->getFindExtensions(instance()->npp());
+ return ret;
+}
+
#if defined(OS_WIN)
bool WebPluginDelegatePepper::DrawJPEGToPlatformDC(
const SkBitmap& bitmap,
« no previous file with comments | « chrome/renderer/webplugin_delegate_pepper.h ('k') | third_party/npapi/bindings/npapi_extensions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698