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
3// found in the LICENSE file.
4
5#include "chrome/common/chrome_content_plugin_client.h"
6
7#include "chrome/common/default_plugin.h"
8
9#if defined(OS_MACOSX)
10#include "base/mac/mac_util.h"
11#include "base/mac/scoped_cftyperef.h"
12#include "base/sys_string_conversions.h"
13#include "grit/chromium_strings.h"
14#include "ui/base/l10n/l10n_util.h"
15#endif
16
17namespace chrome {
18
19void ChromeContentPluginClient::PluginProcessStarted(
20    const string16& plugin_name) {
21#if defined(OS_MACOSX)
22  base::mac::ScopedCFTypeRef<CFStringRef> cf_plugin_name(
23      base::SysUTF16ToCFStringRef(plugin_name));
24  base::mac::ScopedCFTypeRef<CFStringRef> app_name(
25      base::SysUTF16ToCFStringRef(
26          l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME)));
27  base::mac::ScopedCFTypeRef<CFStringRef> process_name(
28      CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"),
29                               cf_plugin_name.get(), app_name.get()));
30  base::mac::SetProcessName(process_name);
31#endif
32
33#if !defined(NACL_WIN64)  // We don't link this in the NaCl 64 bit binary.
34  chrome::RegisterInternalDefaultPlugin();
35#endif
36}
37
38}  // namespace chrome
39