summaryrefslogtreecommitdiffstats
path: root/chrome/default_plugin/plugin_installer_base.cc
blob: e86356427a27c7492b86e7af6d628574c30caef8 (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
// Copyright (c) 2011 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/default_plugin/plugin_installer_base.h"

#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "content/common/content_constants.h"

PluginInstallerBase::PluginInstallerBase()
    : renderer_process_id_(0),
      render_view_id_(0) {
}

PluginInstallerBase::~PluginInstallerBase() {
}

bool PluginInstallerBase::Initialize(void* module_handle, NPP instance,
                                     NPMIMEType mime_type, int16 argc,
                                     char* argn[], char* argv[]) {
  for (int16_t index = 0; index < argc; ++index) {
    if (!base::strncasecmp(argn[index],
                           content::kDefaultPluginRenderProcessId,
                           strlen(argn[index]))) {
      base::StringToInt(argv[index], &renderer_process_id_);
    } else if (!base::strncasecmp(argn[index],
                                  content::kDefaultPluginRenderViewId,
                                  strlen(argn[index]))) {
      base::StringToInt(argv[index], &render_view_id_);
    }
  }
  return true;
}