| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Pepper API support should be enabled for this file. | |
| 6 #define PEPPER_APIS_ENABLED | |
| 7 | |
| 8 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 9 | 6 |
| 10 #include "webkit/glue/plugins/plugin_instance.h" | 7 #include "webkit/glue/plugins/plugin_instance.h" |
| 11 | 8 |
| 12 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 13 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 14 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 15 #include "webkit/glue/glue_util.h" | 12 #include "webkit/glue/glue_util.h" |
| 16 #include "webkit/glue/webplugin.h" | 13 #include "webkit/glue/webplugin.h" |
| 14 #include "webkit/glue/webplugin_delegate.h" |
| 17 #include "webkit/glue/webkit_glue.h" | 15 #include "webkit/glue/webkit_glue.h" |
| 18 #include "webkit/glue/plugins/plugin_host.h" | 16 #include "webkit/glue/plugins/plugin_host.h" |
| 19 #include "webkit/glue/plugins/plugin_lib.h" | 17 #include "webkit/glue/plugins/plugin_lib.h" |
| 20 #include "webkit/glue/plugins/plugin_stream_url.h" | 18 #include "webkit/glue/plugins/plugin_stream_url.h" |
| 21 #include "webkit/glue/plugins/plugin_string_stream.h" | 19 #include "webkit/glue/plugins/plugin_string_stream.h" |
| 22 #include "net/base/escape.h" | 20 #include "net/base/escape.h" |
| 23 | 21 |
| 24 namespace NPAPI { | 22 namespace NPAPI { |
| 25 | 23 |
| 26 PluginInstance::PluginInstance(PluginLib *plugin, const std::string &mime_type) | 24 PluginInstance::PluginInstance(PluginLib *plugin, const std::string &mime_type) |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 346 } |
| 349 | 347 |
| 350 void PluginInstance::DidManualLoadFail() { | 348 void PluginInstance::DidManualLoadFail() { |
| 351 DCHECK(load_manually_); | 349 DCHECK(load_manually_); |
| 352 if (plugin_data_stream_.get() != NULL) { | 350 if (plugin_data_stream_.get() != NULL) { |
| 353 plugin_data_stream_->DidFail(); | 351 plugin_data_stream_->DidFail(); |
| 354 plugin_data_stream_ = NULL; | 352 plugin_data_stream_ = NULL; |
| 355 } | 353 } |
| 356 } | 354 } |
| 357 | 355 |
| 358 #ifndef PEPPER_APIS_DISABLED | |
| 359 NPError PluginInstance::InitializeRenderContext(NPRenderType type, | |
| 360 NPRenderContext* context) { | |
| 361 // Set up the renderer for the specified type. | |
| 362 // Return no errors. | |
| 363 return NPERR_NO_ERROR; | |
| 364 } | |
| 365 | |
| 366 NPError PluginInstance::FlushRenderContext(NPRenderContext* context, | |
| 367 NPFlushRenderContextCallbackPtr callback, void* user_data) { | |
| 368 // Do the flush. | |
| 369 NPError err = NPERR_NO_ERROR; | |
| 370 // Invoke the callback to inform the caller the work was done. | |
| 371 if (callback != NULL) { | |
| 372 (*callback)(context, err, user_data); | |
| 373 } | |
| 374 // Return no errors. | |
| 375 return NPERR_NO_ERROR; | |
| 376 } | |
| 377 #endif // PEPPER_APIS_DISABLED | |
| 378 | |
| 379 void PluginInstance::PluginThreadAsyncCall(void (*func)(void *), | 356 void PluginInstance::PluginThreadAsyncCall(void (*func)(void *), |
| 380 void *user_data) { | 357 void *user_data) { |
| 381 message_loop_->PostTask(FROM_HERE, NewRunnableMethod( | 358 message_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
| 382 this, &PluginInstance::OnPluginThreadAsyncCall, func, user_data)); | 359 this, &PluginInstance::OnPluginThreadAsyncCall, func, user_data)); |
| 383 } | 360 } |
| 384 | 361 |
| 385 void PluginInstance::OnPluginThreadAsyncCall(void (*func)(void *), | 362 void PluginInstance::OnPluginThreadAsyncCall(void (*func)(void *), |
| 386 void *user_data) { | 363 void *user_data) { |
| 387 #if defined(OS_WIN) | 364 #if defined(OS_WIN) |
| 388 // We are invoking an arbitrary callback provided by a third | 365 // We are invoking an arbitrary callback provided by a third |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 stream->url, range_info.c_str(), | 423 stream->url, range_info.c_str(), |
| 447 reinterpret_cast<intptr_t>(plugin_stream), | 424 reinterpret_cast<intptr_t>(plugin_stream), |
| 448 plugin_stream->notify_needed(), | 425 plugin_stream->notify_needed(), |
| 449 reinterpret_cast<intptr_t>(plugin_stream->notify_data())); | 426 reinterpret_cast<intptr_t>(plugin_stream->notify_data())); |
| 450 break; | 427 break; |
| 451 } | 428 } |
| 452 } | 429 } |
| 453 } | 430 } |
| 454 | 431 |
| 455 } // namespace NPAPI | 432 } // namespace NPAPI |
| OLD | NEW |