diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-27 07:18:46 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-27 07:18:46 +0000 |
commit | 1a559448088694cd4dc077c7a14436942fda5061 (patch) | |
tree | c539c7259f878cf6c43bbbbc2515eaa46b0f4f45 /content/browser/pepper_flash_settings_helper_impl.cc | |
parent | 3f84377fbfae99a755a20f8a9a5390526cec9ce1 (diff) | |
download | chromium_src-1a559448088694cd4dc077c7a14436942fda5061.zip chromium_src-1a559448088694cd4dc077c7a14436942fda5061.tar.gz chromium_src-1a559448088694cd4dc077c7a14436942fda5061.tar.bz2 |
Pepper Flash settings integration: implement "deauthorize content licenses".
A few notes about PepperFlashSettingsManager:
- It doesn't re-establish a channel for each request. It might seem unnecessary at this point. But that is needed for implementing content settings (camera/mic and peer networking), which requires more interactions with the broker process.
- Similarly, the support of multiple in-flight requests isn't very useful for deauthorizing content licenses, but that is useful for content settings, e.g., sending multiple GetPermissionSettings requests for different setting types.
BUG=112190
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10391173
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/pepper_flash_settings_helper_impl.cc')
-rw-r--r-- | content/browser/pepper_flash_settings_helper_impl.cc | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/content/browser/pepper_flash_settings_helper_impl.cc b/content/browser/pepper_flash_settings_helper_impl.cc new file mode 100644 index 0000000..2f9e698 --- /dev/null +++ b/content/browser/pepper_flash_settings_helper_impl.cc @@ -0,0 +1,71 @@ +// 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/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 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(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, + 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 |