summaryrefslogtreecommitdiffstats
path: root/chrome/common/gpu_plugin.cc
blob: 84ab33999ed02e97b095cfa342fa9bd05166786e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/gpu_plugin.h"

#include "base/command_line.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_switches.h"
#include "gpu/gpu_plugin/gpu_plugin.h"
#include "webkit/glue/plugins/plugin_list.h"

#if defined(ENABLE_GPU)
#include "webkit/glue/plugins/plugin_constants_win.h"
#endif

namespace chrome {

void RegisterInternalGPUPlugin() {
#if defined(ENABLE_GPU)
  static const std::wstring kWideMimeType = ASCIIToWide(kGPUPluginMimeType);
  static const NPAPI::PluginVersionInfo kGPUPluginInfo = {
    FilePath(FILE_PATH_LITERAL("gpu-plugin")),
    L"GPU Plug-in",
    L"GPU Rendering Plug-in",
    L"1",
    kWideMimeType.c_str(),
    L"",
    L"",
    {
#if !defined(OS_POSIX) || defined(OS_MACOSX)
      gpu_plugin::NP_GetEntryPoints,
#endif
      gpu_plugin::NP_Initialize,
      gpu_plugin::NP_Shutdown
    }
  };

  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableGPUPlugin))
    NPAPI::PluginList::Singleton()->RegisterInternalPlugin(kGPUPluginInfo);
#endif  // ENABLE_GPU
}

}  // namespace chrome