| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 string16 PluginInstance::GetSelectedText(bool html) { | 603 string16 PluginInstance::GetSelectedText(bool html) { |
| 604 // Keep a reference on the stack. See NOTE above. | 604 // Keep a reference on the stack. See NOTE above. |
| 605 scoped_refptr<PluginInstance> ref(this); | 605 scoped_refptr<PluginInstance> ref(this); |
| 606 if (!LoadSelectionInterface()) | 606 if (!LoadSelectionInterface()) |
| 607 return string16(); | 607 return string16(); |
| 608 | 608 |
| 609 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), | 609 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), |
| 610 PP_FromBool(html)); | 610 PP_FromBool(html)); |
| 611 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); | 611 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); |
| 612 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. | 612 // Release the ref the plugin transfered to us. |
| 613 ResourceTracker::Get()->GetVarTracker()->ReleaseVar(rv); |
| 613 if (!string) | 614 if (!string) |
| 614 return string16(); | 615 return string16(); |
| 615 return UTF8ToUTF16(string->value()); | 616 return UTF8ToUTF16(string->value()); |
| 616 } | 617 } |
| 617 | 618 |
| 618 string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) { | 619 string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) { |
| 619 // Keep a reference on the stack. See NOTE above. | 620 // Keep a reference on the stack. See NOTE above. |
| 620 scoped_refptr<PluginInstance> ref(this); | 621 scoped_refptr<PluginInstance> ref(this); |
| 621 if (!LoadPdfInterface()) | 622 if (!LoadPdfInterface()) |
| 622 return string16(); | 623 return string16(); |
| 623 | 624 |
| 624 PP_Point p; | 625 PP_Point p; |
| 625 p.x = point.x(); | 626 p.x = point.x(); |
| 626 p.y = point.y(); | 627 p.y = point.y(); |
| 627 PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p); | 628 PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p); |
| 628 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); | 629 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); |
| 629 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. | 630 // Release the ref the plugin transfered to us. |
| 631 ResourceTracker::Get()->GetVarTracker()->ReleaseVar(rv); |
| 630 if (!string) | 632 if (!string) |
| 631 return string16(); | 633 return string16(); |
| 632 return UTF8ToUTF16(string->value()); | 634 return UTF8ToUTF16(string->value()); |
| 633 } | 635 } |
| 634 | 636 |
| 635 void PluginInstance::Zoom(double factor, bool text_only) { | 637 void PluginInstance::Zoom(double factor, bool text_only) { |
| 636 // Keep a reference on the stack. See NOTE above. | 638 // Keep a reference on the stack. See NOTE above. |
| 637 scoped_refptr<PluginInstance> ref(this); | 639 scoped_refptr<PluginInstance> ref(this); |
| 638 if (!LoadZoomInterface()) | 640 if (!LoadZoomInterface()) |
| 639 return; | 641 return; |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { | 1540 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { |
| 1539 message_channel_->PostMessageToJavaScript(message); | 1541 message_channel_->PostMessageToJavaScript(message); |
| 1540 } | 1542 } |
| 1541 | 1543 |
| 1542 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { | 1544 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { |
| 1543 delegate()->SubscribeToPolicyUpdates(this); | 1545 delegate()->SubscribeToPolicyUpdates(this); |
| 1544 } | 1546 } |
| 1545 | 1547 |
| 1546 } // namespace ppapi | 1548 } // namespace ppapi |
| 1547 } // namespace webkit | 1549 } // namespace webkit |
| OLD | NEW |