OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 instance_interface_(instance_interface), | 316 instance_interface_(instance_interface), |
317 pp_instance_(0), | 317 pp_instance_(0), |
318 container_(NULL), | 318 container_(NULL), |
319 full_frame_(false), | 319 full_frame_(false), |
320 sent_initial_did_change_view_(false), | 320 sent_initial_did_change_view_(false), |
321 suppress_did_change_view_(false), | 321 suppress_did_change_view_(false), |
322 has_webkit_focus_(false), | 322 has_webkit_focus_(false), |
323 has_content_area_focus_(false), | 323 has_content_area_focus_(false), |
324 find_identifier_(-1), | 324 find_identifier_(-1), |
325 resource_creation_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 325 resource_creation_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 326 plugin_decryption_interface_(NULL), |
326 plugin_find_interface_(NULL), | 327 plugin_find_interface_(NULL), |
327 plugin_messaging_interface_(NULL), | 328 plugin_messaging_interface_(NULL), |
328 plugin_mouse_lock_interface_(NULL), | 329 plugin_mouse_lock_interface_(NULL), |
329 plugin_input_event_interface_(NULL), | 330 plugin_input_event_interface_(NULL), |
330 plugin_private_interface_(NULL), | 331 plugin_private_interface_(NULL), |
331 plugin_pdf_interface_(NULL), | 332 plugin_pdf_interface_(NULL), |
332 plugin_selection_interface_(NULL), | 333 plugin_selection_interface_(NULL), |
333 plugin_textinput_interface_(NULL), | 334 plugin_textinput_interface_(NULL), |
334 plugin_zoom_interface_(NULL), | 335 plugin_zoom_interface_(NULL), |
335 checked_for_plugin_input_event_interface_(false), | 336 checked_for_plugin_input_event_interface_(false), |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 | 948 |
948 void PluginInstance::StopFind() { | 949 void PluginInstance::StopFind() { |
949 // Keep a reference on the stack. See NOTE above. | 950 // Keep a reference on the stack. See NOTE above. |
950 scoped_refptr<PluginInstance> ref(this); | 951 scoped_refptr<PluginInstance> ref(this); |
951 if (!LoadFindInterface()) | 952 if (!LoadFindInterface()) |
952 return; | 953 return; |
953 find_identifier_ = -1; | 954 find_identifier_ = -1; |
954 plugin_find_interface_->StopFind(pp_instance()); | 955 plugin_find_interface_->StopFind(pp_instance()); |
955 } | 956 } |
956 | 957 |
| 958 bool PluginInstance::LoadContentDecryptionModuleInterface() { |
| 959 if (!plugin_decryption_interface_) { |
| 960 plugin_decryption_interface_ = |
| 961 static_cast<const PPP_ContentDecryptionModule_Dev*>( |
| 962 module_->GetPluginInterface( |
| 963 PPP_CONTENTDECRYPTIONMODULE_DEV_INTERFACE)); |
| 964 } |
| 965 return !!plugin_decryption_interface_; |
| 966 } |
| 967 |
957 bool PluginInstance::LoadFindInterface() { | 968 bool PluginInstance::LoadFindInterface() { |
958 if (!plugin_find_interface_) { | 969 if (!plugin_find_interface_) { |
959 plugin_find_interface_ = | 970 plugin_find_interface_ = |
960 static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( | 971 static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( |
961 PPP_FIND_DEV_INTERFACE)); | 972 PPP_FIND_DEV_INTERFACE)); |
962 } | 973 } |
963 | 974 |
964 return !!plugin_find_interface_; | 975 return !!plugin_find_interface_; |
965 } | 976 } |
966 | 977 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 if (!LoadPdfInterface()) | 1256 if (!LoadPdfInterface()) |
1246 return; | 1257 return; |
1247 PP_PrivatePageTransformType transform_type = | 1258 PP_PrivatePageTransformType transform_type = |
1248 type == WebPlugin::RotationType90Clockwise ? | 1259 type == WebPlugin::RotationType90Clockwise ? |
1249 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW : | 1260 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW : |
1250 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW; | 1261 PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW; |
1251 plugin_pdf_interface_->Transform(pp_instance(), transform_type); | 1262 plugin_pdf_interface_->Transform(pp_instance(), transform_type); |
1252 // NOTE: plugin instance may have been deleted. | 1263 // NOTE: plugin instance may have been deleted. |
1253 } | 1264 } |
1254 | 1265 |
| 1266 bool PluginInstance::AddKey(PP_Resource key) { |
| 1267 if (!LoadContentDecryptionModuleInterface()) |
| 1268 return false; |
| 1269 return (plugin_decryption_interface_->AddKey(pp_instance(), key) == PP_TRUE); |
| 1270 } |
| 1271 |
| 1272 bool PluginInstance::Decrypt(PP_Resource encrypted_block, |
| 1273 PP_Resource decrypted_block, |
| 1274 PP_CompletionCallback callback) { |
| 1275 if (!LoadContentDecryptionModuleInterface()) |
| 1276 return false; |
| 1277 return (plugin_decryption_interface_->Decrypt(pp_instance(), |
| 1278 encrypted_block, |
| 1279 decrypted_block, |
| 1280 callback) == PP_TRUE); |
| 1281 } |
| 1282 |
| 1283 bool PluginInstance::DecryptAndDecode(PP_Resource encrypted_block, |
| 1284 PP_Resource decoded_frame, |
| 1285 PP_CompletionCallback callback) { |
| 1286 if (!LoadContentDecryptionModuleInterface()) |
| 1287 return false; |
| 1288 return (plugin_decryption_interface_->DecryptAndDecode(pp_instance(), |
| 1289 encrypted_block, |
| 1290 decoded_frame, |
| 1291 callback) == PP_TRUE); |
| 1292 } |
| 1293 |
1255 bool PluginInstance::FlashIsFullscreenOrPending() { | 1294 bool PluginInstance::FlashIsFullscreenOrPending() { |
1256 return fullscreen_container_ != NULL; | 1295 return fullscreen_container_ != NULL; |
1257 } | 1296 } |
1258 | 1297 |
1259 bool PluginInstance::IsFullscreenOrPending() { | 1298 bool PluginInstance::IsFullscreenOrPending() { |
1260 return desired_fullscreen_state_; | 1299 return desired_fullscreen_state_; |
1261 } | 1300 } |
1262 | 1301 |
1263 bool PluginInstance::SetFullscreen(bool fullscreen) { | 1302 bool PluginInstance::SetFullscreen(bool fullscreen) { |
1264 // Keep a reference on the stack. See NOTE above. | 1303 // Keep a reference on the stack. See NOTE above. |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 screen_size_for_fullscreen_ = gfx::Size(); | 2176 screen_size_for_fullscreen_ = gfx::Size(); |
2138 WebElement element = container_->element(); | 2177 WebElement element = container_->element(); |
2139 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2178 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2140 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2179 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2141 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2180 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2142 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2181 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2143 } | 2182 } |
2144 | 2183 |
2145 } // namespace ppapi | 2184 } // namespace ppapi |
2146 } // namespace webkit | 2185 } // namespace webkit |
OLD | NEW |