diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 08:26:49 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 08:26:49 +0000 |
commit | 24a7f3c1308fd32d8620f5bd412ede8f84da9794 (patch) | |
tree | 6102a956d92d49466394a9cac1960bef2af87fca /chrome/renderer/webplugin_delegate_pepper.cc | |
parent | 64c8ec0d7073939d6be8e5a23bc926078d23193c (diff) | |
download | chromium_src-24a7f3c1308fd32d8620f5bd412ede8f84da9794.zip chromium_src-24a7f3c1308fd32d8620f5bd412ede8f84da9794.tar.gz chromium_src-24a7f3c1308fd32d8620f5bd412ede8f84da9794.tar.bz2 |
Chrome side of adding search support to Pepper.
Review URL: http://codereview.chromium.org/1075011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_pepper.cc')
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 33ad51a..70ce34e 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -321,6 +321,40 @@ WebPluginResourceClient* WebPluginDelegatePepper::CreateSeekableResourceClient( 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,6 +1016,10 @@ void WebPluginDelegatePepper::PrintEnd() { current_printable_area_ = gfx::Rect(); } +bool WebPluginDelegatePepper::SupportsFind() { + return GetFindExtensions() != NULL; +} + WebPluginDelegatePepper::WebPluginDelegatePepper( const base::WeakPtr<RenderView>& render_view, @@ -993,6 +1031,7 @@ WebPluginDelegatePepper::WebPluginDelegatePepper( #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 @@ NPPPrintExtensions* WebPluginDelegatePepper::GetPrintExtensions() { 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, |