Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: remoting/host/plugin/host_plugin.cc

Issue 290173011: Cleanup: Use base::CommandLine in remoting/ (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 }; 364 };
365 365
366 void InitializePlugin() { 366 void InitializePlugin() {
367 if (g_initialized) 367 if (g_initialized)
368 return; 368 return;
369 369
370 g_initialized = true; 370 g_initialized = true;
371 g_at_exit_manager = new base::AtExitManager; 371 g_at_exit_manager = new base::AtExitManager;
372 372
373 // Init an empty command line for common objects that use it. 373 // Init an empty command line for common objects that use it.
374 CommandLine::Init(0, NULL); 374 base::CommandLine::Init(0, NULL);
375 375
376 if (remoting::LoadResources("")) { 376 if (remoting::LoadResources("")) {
377 g_ui_name = new std::string( 377 g_ui_name = new std::string(
378 l10n_util::GetStringUTF8(IDS_REMOTING_HOST_PLUGIN_NAME)); 378 l10n_util::GetStringUTF8(IDS_REMOTING_HOST_PLUGIN_NAME));
379 g_ui_description = new std::string( 379 g_ui_description = new std::string(
380 l10n_util::GetStringUTF8(IDS_REMOTING_HOST_PLUGIN_DESCRIPTION)); 380 l10n_util::GetStringUTF8(IDS_REMOTING_HOST_PLUGIN_DESCRIPTION));
381 } else { 381 } else {
382 g_ui_name = new std::string(); 382 g_ui_name = new std::string();
383 g_ui_description = new std::string(); 383 g_ui_description = new std::string();
384 } 384 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 return NPERR_NO_ERROR; 442 return NPERR_NO_ERROR;
443 } else { 443 } else {
444 return NPERR_INVALID_PLUGIN_ERROR; 444 return NPERR_INVALID_PLUGIN_ERROR;
445 } 445 }
446 } 446 }
447 447
448 NPError GetValue(NPP instance, NPPVariable variable, void* value) { 448 NPError GetValue(NPP instance, NPPVariable variable, void* value) {
449 // NP_GetValue() can be called before NP_Initialize(). 449 // NP_GetValue() can be called before NP_Initialize().
450 InitializePlugin(); 450 InitializePlugin();
451 451
452 switch(variable) { 452 switch (variable) {
453 default: 453 default:
454 VLOG(2) << "GetValue - default " << variable; 454 VLOG(2) << "GetValue - default " << variable;
455 return NPERR_GENERIC_ERROR; 455 return NPERR_GENERIC_ERROR;
456 case NPPVpluginNameString: 456 case NPPVpluginNameString:
457 VLOG(2) << "GetValue - name string"; 457 VLOG(2) << "GetValue - name string";
458 *reinterpret_cast<const char**>(value) = g_ui_name->c_str(); 458 *reinterpret_cast<const char**>(value) = g_ui_name->c_str();
459 break; 459 break;
460 case NPPVpluginDescriptionString: 460 case NPPVpluginDescriptionString:
461 VLOG(2) << "GetValue - description string"; 461 VLOG(2) << "GetValue - description string";
462 *reinterpret_cast<const char**>(value) = g_ui_description->c_str(); 462 *reinterpret_cast<const char**>(value) = g_ui_description->c_str();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 } 526 }
527 527
528 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs 528 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs
529 #if defined(OS_POSIX) && !defined(OS_MACOSX) 529 #if defined(OS_POSIX) && !defined(OS_MACOSX)
530 , NPPluginFuncs* nppfuncs 530 , NPPluginFuncs* nppfuncs
531 #endif 531 #endif
532 ) { 532 ) {
533 VLOG(2) << "NP_Initialize"; 533 VLOG(2) << "NP_Initialize";
534 InitializePlugin(); 534 InitializePlugin();
535 535
536 if(npnetscape_funcs == NULL) 536 if (npnetscape_funcs == NULL)
537 return NPERR_INVALID_FUNCTABLE_ERROR; 537 return NPERR_INVALID_FUNCTABLE_ERROR;
538 538
539 if(((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR) 539 if (((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR)
540 return NPERR_INCOMPATIBLE_VERSION_ERROR; 540 return NPERR_INCOMPATIBLE_VERSION_ERROR;
541 541
542 g_npnetscape_funcs = npnetscape_funcs; 542 g_npnetscape_funcs = npnetscape_funcs;
543 #if defined(OS_POSIX) && !defined(OS_MACOSX) 543 #if defined(OS_POSIX) && !defined(OS_MACOSX)
544 NP_GetEntryPoints(nppfuncs); 544 NP_GetEntryPoints(nppfuncs);
545 #endif 545 #endif
546 546
547 #if defined(OS_WIN) 547 #if defined(OS_WIN)
548 gfx::EnableHighDPISupport(); 548 gfx::EnableHighDPISupport();
549 #endif 549 #endif
(...skipping 15 matching lines...) Expand all
565 } 565 }
566 566
567 EXPORT NPError API_CALL NP_GetValue(void* npp, 567 EXPORT NPError API_CALL NP_GetValue(void* npp,
568 NPPVariable variable, 568 NPPVariable variable,
569 void* value) { 569 void* value) {
570 return GetValue((NPP)npp, variable, value); 570 return GetValue((NPP)npp, variable, value);
571 } 571 }
572 #endif 572 #endif
573 573
574 } // extern "C" 574 } // extern "C"
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host_main.cc ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698