| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/plugin/plugin_thread.h" | 5 #include "chrome/plugin/plugin_thread.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(USE_X11) | 9 #if defined(USE_X11) |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
| 32 #include "webkit/glue/plugins/plugin_lib.h" | 32 #include "webkit/glue/plugins/plugin_lib.h" |
| 33 #include "webkit/glue/webkit_glue.h" | 33 #include "webkit/glue/webkit_glue.h" |
| 34 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 34 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 35 | 35 |
| 36 #if defined(USE_X11) | 36 #if defined(USE_X11) |
| 37 #include "app/x11_util.h" | 37 #include "app/x11_util.h" |
| 38 #elif defined(OS_MACOSX) | 38 #elif defined(OS_MACOSX) |
| 39 #include "app/l10n_util.h" | 39 #include "app/l10n_util.h" |
| 40 #include "base/mac_util.h" | 40 #include "base/mac_util.h" |
| 41 #include "base/scoped_cftyperef.h" | 41 #include "base/mac/scoped_cftyperef.h" |
| 42 #include "base/sys_string_conversions.h" | 42 #include "base/sys_string_conversions.h" |
| 43 #include "grit/chromium_strings.h" | 43 #include "grit/chromium_strings.h" |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls( | 46 static base::LazyInstance<base::ThreadLocalPointer<PluginThread> > lazy_tls( |
| 47 base::LINKER_INITIALIZED); | 47 base::LINKER_INITIALIZED); |
| 48 | 48 |
| 49 PluginThread::PluginThread() | 49 PluginThread::PluginThread() |
| 50 : preloaded_plugin_module_(NULL) { | 50 : preloaded_plugin_module_(NULL) { |
| 51 plugin_path_ = | 51 plugin_path_ = |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); | 96 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); |
| 97 | 97 |
| 98 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); | 98 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); |
| 99 | 99 |
| 100 scoped_refptr<NPAPI::PluginLib> plugin = | 100 scoped_refptr<NPAPI::PluginLib> plugin = |
| 101 NPAPI::PluginLib::CreatePluginLib(plugin_path_); | 101 NPAPI::PluginLib::CreatePluginLib(plugin_path_); |
| 102 if (plugin.get()) { | 102 if (plugin.get()) { |
| 103 plugin->NP_Initialize(); | 103 plugin->NP_Initialize(); |
| 104 | 104 |
| 105 #if defined(OS_MACOSX) | 105 #if defined(OS_MACOSX) |
| 106 scoped_cftyperef<CFStringRef> plugin_name(base::SysUTF16ToCFStringRef( | 106 base::mac::ScopedCFTypeRef<CFStringRef> plugin_name( |
| 107 plugin->plugin_info().name)); | 107 base::SysUTF16ToCFStringRef(plugin->plugin_info().name)); |
| 108 scoped_cftyperef<CFStringRef> app_name(base::SysUTF16ToCFStringRef( | 108 base::mac::ScopedCFTypeRef<CFStringRef> app_name( |
| 109 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); | 109 base::SysUTF16ToCFStringRef( |
| 110 scoped_cftyperef<CFStringRef> process_name(CFStringCreateWithFormat( | 110 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); |
| 111 kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"), | 111 base::mac::ScopedCFTypeRef<CFStringRef> process_name( |
| 112 plugin_name.get(), app_name.get())); | 112 CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"), |
| 113 plugin_name.get(), app_name.get())); |
| 113 mac_util::SetProcessName(process_name); | 114 mac_util::SetProcessName(process_name); |
| 114 #endif | 115 #endif |
| 115 } | 116 } |
| 116 | 117 |
| 117 // Certain plugins, such as flash, steal the unhandled exception filter | 118 // Certain plugins, such as flash, steal the unhandled exception filter |
| 118 // thus we never get crash reports when they fault. This call fixes it. | 119 // thus we never get crash reports when they fault. This call fixes it. |
| 119 message_loop()->set_exception_restoration(true); | 120 message_loop()->set_exception_restoration(true); |
| 120 } | 121 } |
| 121 | 122 |
| 122 PluginThread::~PluginThread() { | 123 PluginThread::~PluginThread() { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 236 } |
| 236 | 237 |
| 237 if (!result || net_error != net::OK) | 238 if (!result || net_error != net::OK) |
| 238 return false; | 239 return false; |
| 239 | 240 |
| 240 *proxy_list = proxy_result; | 241 *proxy_list = proxy_result; |
| 241 return true; | 242 return true; |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace webkit_glue | 245 } // namespace webkit_glue |
| OLD | NEW |