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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
// Copyright (c) 2012 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 "content/browser/pepper_flash_settings_helper_impl.h"
#include "base/files/file_path.h"
#include "content/browser/plugin_service_impl.h"
#include "content/public/browser/browser_thread.h"
#include "ipc/ipc_channel_handle.h"
namespace content {
// static
scoped_refptr<PepperFlashSettingsHelper> PepperFlashSettingsHelper::Create() {
return new PepperFlashSettingsHelperImpl();
}
PepperFlashSettingsHelperImpl::PepperFlashSettingsHelperImpl() {
}
PepperFlashSettingsHelperImpl::~PepperFlashSettingsHelperImpl() {
}
void PepperFlashSettingsHelperImpl::OpenChannelToBroker(
const base::FilePath& path,
const OpenChannelCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (callback.is_null())
return;
if (!callback_.is_null())
callback.Run(false, IPC::ChannelHandle());
// Balanced in OnPpapiChannelOpened(). We need to keep this object around
// until then.
AddRef();
callback_ = callback;
PluginServiceImpl* plugin_service = PluginServiceImpl::GetInstance();
plugin_service->OpenChannelToPpapiBroker(0, path, this);
}
void PepperFlashSettingsHelperImpl::GetPpapiChannelInfo(
base::ProcessHandle* renderer_handle,
int* renderer_id) {
*renderer_handle = base::kNullProcessHandle;
*renderer_id = 0;
}
void PepperFlashSettingsHelperImpl::OnPpapiChannelOpened(
const IPC::ChannelHandle& channel_handle,
base::ProcessId /* plugin_pid */,
int /* plugin_child_id */) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(!callback_.is_null());
if (!channel_handle.name.empty())
callback_.Run(true, channel_handle);
else
callback_.Run(false, IPC::ChannelHandle());
callback_.Reset();
// Balance the AddRef() call in Initialize().
Release();
}
bool PepperFlashSettingsHelperImpl::OffTheRecord() {
return false;
}
} // namespace content
|