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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 VLOG(2) << "NP_Initialize"; | 414 VLOG(2) << "NP_Initialize"; |
415 if (g_at_exit_manager) | 415 if (g_at_exit_manager) |
416 return NPERR_MODULE_LOAD_FAILED_ERROR; | 416 return NPERR_MODULE_LOAD_FAILED_ERROR; |
417 | 417 |
418 if(npnetscape_funcs == NULL) | 418 if(npnetscape_funcs == NULL) |
419 return NPERR_INVALID_FUNCTABLE_ERROR; | 419 return NPERR_INVALID_FUNCTABLE_ERROR; |
420 | 420 |
421 if(((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR) | 421 if(((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR) |
422 return NPERR_INCOMPATIBLE_VERSION_ERROR; | 422 return NPERR_INCOMPATIBLE_VERSION_ERROR; |
423 | 423 |
| 424 // Register a global log handler. |
| 425 HostNPScriptObject::RegisterLogger(); |
| 426 |
424 g_at_exit_manager = new base::AtExitManager; | 427 g_at_exit_manager = new base::AtExitManager; |
425 g_npnetscape_funcs = npnetscape_funcs; | 428 g_npnetscape_funcs = npnetscape_funcs; |
426 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 429 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
427 NP_GetEntryPoints(nppfuncs); | 430 NP_GetEntryPoints(nppfuncs); |
428 #endif | 431 #endif |
429 return NPERR_NO_ERROR; | 432 return NPERR_NO_ERROR; |
430 } | 433 } |
431 | 434 |
432 EXPORT NPError API_CALL NP_Shutdown() { | 435 EXPORT NPError API_CALL NP_Shutdown() { |
433 VLOG(2) << "NP_Shutdown"; | 436 VLOG(2) << "NP_Shutdown"; |
434 delete g_at_exit_manager; | 437 delete g_at_exit_manager; |
435 g_at_exit_manager = NULL; | 438 g_at_exit_manager = NULL; |
| 439 |
| 440 // Remove the global log handler. |
| 441 HostNPScriptObject::UnregisterLogger(); |
| 442 |
436 return NPERR_NO_ERROR; | 443 return NPERR_NO_ERROR; |
437 } | 444 } |
438 | 445 |
439 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 446 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
440 EXPORT const char* API_CALL NP_GetMIMEDescription(void) { | 447 EXPORT const char* API_CALL NP_GetMIMEDescription(void) { |
441 VLOG(2) << "NP_GetMIMEDescription"; | 448 VLOG(2) << "NP_GetMIMEDescription"; |
442 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" | 449 return STRINGIZE(HOST_PLUGIN_MIME_TYPE) ":" |
443 HOST_PLUGIN_NAME ":" | 450 HOST_PLUGIN_NAME ":" |
444 HOST_PLUGIN_DESCRIPTION; | 451 HOST_PLUGIN_DESCRIPTION; |
445 } | 452 } |
446 | 453 |
447 EXPORT NPError API_CALL NP_GetValue(void* npp, | 454 EXPORT NPError API_CALL NP_GetValue(void* npp, |
448 NPPVariable variable, | 455 NPPVariable variable, |
449 void* value) { | 456 void* value) { |
450 return GetValue((NPP)npp, variable, value); | 457 return GetValue((NPP)npp, variable, value); |
451 } | 458 } |
452 #endif | 459 #endif |
453 | 460 |
454 } // extern "C" | 461 } // extern "C" |
OLD | NEW |