| 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/npapi/plugin_host.h" | 5 #include "webkit/plugins/npapi/plugin_host.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 NPBool* private_mode = reinterpret_cast<NPBool*>(value); | 774 NPBool* private_mode = reinterpret_cast<NPBool*>(value); |
| 775 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 775 scoped_refptr<PluginInstance> plugin(FindInstance(id)); |
| 776 if (!plugin.get()) { | 776 if (!plugin.get()) { |
| 777 NOTREACHED(); | 777 NOTREACHED(); |
| 778 return NPERR_INVALID_INSTANCE_ERROR; | 778 return NPERR_INVALID_INSTANCE_ERROR; |
| 779 } | 779 } |
| 780 *private_mode = plugin->webplugin()->IsOffTheRecord(); | 780 *private_mode = plugin->webplugin()->IsOffTheRecord(); |
| 781 rv = NPERR_NO_ERROR; | 781 rv = NPERR_NO_ERROR; |
| 782 break; | 782 break; |
| 783 } | 783 } |
| 784 case webkit::npapi::default_plugin::kMissingPluginStatusStart + | |
| 785 webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE: | |
| 786 // fall through | |
| 787 case webkit::npapi::default_plugin::kMissingPluginStatusStart + | |
| 788 webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: { | |
| 789 // This is a hack for the default plugin to send notification to | |
| 790 // renderer. Even though we check if the plugin is the default plugin, | |
| 791 // we still need to worry about future standard change that may conflict | |
| 792 // with the variable definition, in order to avoid duplicate case clauses | |
| 793 // in this big switch statement. | |
| 794 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | |
| 795 if (!plugin.get()) { | |
| 796 NOTREACHED(); | |
| 797 return NPERR_INVALID_INSTANCE_ERROR; | |
| 798 } | |
| 799 if (plugin->plugin_lib()->plugin_info().path.value() == | |
| 800 webkit::npapi::kDefaultPluginLibraryName) { | |
| 801 plugin->webplugin()->OnMissingPluginStatus(variable - | |
| 802 webkit::npapi::default_plugin::kMissingPluginStatusStart); | |
| 803 } | |
| 804 break; | |
| 805 } | |
| 806 #if defined(OS_MACOSX) | 784 #if defined(OS_MACOSX) |
| 807 case NPNVpluginDrawingModel: { | 785 case NPNVpluginDrawingModel: { |
| 808 // return the drawing model that was negotiated when we initialized. | 786 // return the drawing model that was negotiated when we initialized. |
| 809 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 787 scoped_refptr<PluginInstance> plugin(FindInstance(id)); |
| 810 if (!plugin.get()) { | 788 if (!plugin.get()) { |
| 811 NOTREACHED(); | 789 NOTREACHED(); |
| 812 return NPERR_INVALID_INSTANCE_ERROR; | 790 return NPERR_INVALID_INSTANCE_ERROR; |
| 813 } | 791 } |
| 814 *reinterpret_cast<int*>(value) = plugin->drawing_model(); | 792 *reinterpret_cast<int*>(value) = plugin->drawing_model(); |
| 815 rv = NPERR_NO_ERROR; | 793 rv = NPERR_NO_ERROR; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 } | 1127 } |
| 1150 | 1128 |
| 1151 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1129 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
| 1152 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1130 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
| 1153 if (plugin.get()) { | 1131 if (plugin.get()) { |
| 1154 plugin->URLRedirectResponse(!!allow, notify_data); | 1132 plugin->URLRedirectResponse(!!allow, notify_data); |
| 1155 } | 1133 } |
| 1156 } | 1134 } |
| 1157 | 1135 |
| 1158 } // extern "C" | 1136 } // extern "C" |
| OLD | NEW |