OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/glue/plugins/npapi_extension_thunk.h" | 5 #include "webkit/glue/plugins/npapi_extension_thunk.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/npapi/bindings/npapi_extensions.h" | 9 #include "third_party/npapi/bindings/npapi_extensions.h" |
10 #include "webkit/glue/plugins/plugin_instance.h" | 10 #include "webkit/glue/plugins/plugin_instance.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 default: | 407 default: |
408 return NULL; | 408 return NULL; |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 static void CopyTextToClipboard(NPP id, const char* content) { | 412 static void CopyTextToClipboard(NPP id, const char* content) { |
413 ScopedClipboardWriterGlue scw(webkit_glue::ClipboardGetClipboard()); | 413 ScopedClipboardWriterGlue scw(webkit_glue::ClipboardGetClipboard()); |
414 scw.WriteText(UTF8ToUTF16(content)); | 414 scw.WriteText(UTF8ToUTF16(content)); |
415 } | 415 } |
416 | 416 |
| 417 static void NumberOfFindResultsChanged(NPP id, int total, bool final_result) { |
| 418 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 419 if (plugin) { |
| 420 plugin->webplugin()->delegate()->NumberOfFindResultsChanged( |
| 421 total, final_result); |
| 422 } |
| 423 } |
| 424 |
| 425 static void SelectedFindResultChanged(NPP id, int index) { |
| 426 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 427 if (plugin) |
| 428 plugin->webplugin()->delegate()->SelectedFindResultChanged(index); |
| 429 } |
| 430 |
417 namespace NPAPI { | 431 namespace NPAPI { |
418 | 432 |
419 NPError GetPepperExtensionsFunctions(void* value) { | 433 NPError GetPepperExtensionsFunctions(void* value) { |
420 static const NPExtensions kExtensions = { | 434 static const NPNExtensions kExtensions = { |
421 &AcquireDevice, | 435 &AcquireDevice, |
422 &CopyTextToClipboard, | 436 &CopyTextToClipboard, |
| 437 &NumberOfFindResultsChanged, |
| 438 &SelectedFindResultChanged, |
423 }; | 439 }; |
424 | 440 |
425 // Return a pointer to the canonical function table. | 441 // Return a pointer to the canonical function table. |
426 NPExtensions* extensions = const_cast<NPExtensions*>(&kExtensions); | 442 NPNExtensions* extensions = const_cast<NPNExtensions*>(&kExtensions); |
427 NPExtensions** exts = reinterpret_cast<NPExtensions**>(value); | 443 NPNExtensions** exts = reinterpret_cast<NPNExtensions**>(value); |
428 *exts = extensions; | 444 *exts = extensions; |
429 return NPERR_NO_ERROR; | 445 return NPERR_NO_ERROR; |
430 } | 446 } |
431 | 447 |
432 } // namespace NPAPI | 448 } // namespace NPAPI |
OLD | NEW |