| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 // Get the current frame to pass to the evaluate function. | 657 // Get the current frame to pass to the evaluate function. |
| 658 WebFrame* frame = container_->element().document().frame(); | 658 WebFrame* frame = container_->element().document().frame(); |
| 659 if (!frame) { | 659 if (!frame) { |
| 660 try_catch.SetException("No frame to execute script in."); | 660 try_catch.SetException("No frame to execute script in."); |
| 661 return PP_MakeUndefined(); | 661 return PP_MakeUndefined(); |
| 662 } | 662 } |
| 663 | 663 |
| 664 NPVariant result; | 664 NPVariant result; |
| 665 bool ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script, | 665 bool ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script, |
| 666 &result); | 666 &result); |
| 667 // DANGER! |this| could be deleted at this point if the script removed the |
| 668 // plugin from the DOM. |
| 667 if (!ok) { | 669 if (!ok) { |
| 668 // TODO(brettw) bug 54011: The TryCatch isn't working properly and | 670 // TODO(brettw) bug 54011: The TryCatch isn't working properly and |
| 669 // doesn't actually catch this exception. | 671 // doesn't actually catch this exception. |
| 670 try_catch.SetException("Exception caught"); | 672 try_catch.SetException("Exception caught"); |
| 671 WebBindings::releaseVariantValue(&result); | 673 WebBindings::releaseVariantValue(&result); |
| 672 return PP_MakeUndefined(); | 674 return PP_MakeUndefined(); |
| 673 } | 675 } |
| 674 | 676 |
| 675 PP_Var ret = Var::NPVariantToPPVar(this, &result); | 677 PP_Var ret = Var::NPVariantToPPVar(this, &result); |
| 676 WebBindings::releaseVariantValue(&result); | 678 WebBindings::releaseVariantValue(&result); |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 return found->second; | 1467 return found->second; |
| 1466 } | 1468 } |
| 1467 | 1469 |
| 1468 bool PluginInstance::IsFullPagePlugin() const { | 1470 bool PluginInstance::IsFullPagePlugin() const { |
| 1469 WebFrame* frame = container()->element().document().frame(); | 1471 WebFrame* frame = container()->element().document().frame(); |
| 1470 return frame->view()->mainFrame()->document().isPluginDocument(); | 1472 return frame->view()->mainFrame()->document().isPluginDocument(); |
| 1471 } | 1473 } |
| 1472 | 1474 |
| 1473 } // namespace ppapi | 1475 } // namespace ppapi |
| 1474 } // namespace webkit | 1476 } // namespace webkit |
| OLD | NEW |