mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 190564.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1168 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -1598,6 +1598,7 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
|
||||
void CefBrowserHostImpl::WebContentsCreated(
|
||||
content::WebContents* source_contents,
|
||||
int64 source_frame_id,
|
||||
const string16& frame_name,
|
||||
const GURL& target_url,
|
||||
content::WebContents* new_contents) {
|
||||
scoped_ptr<PendingPopupInfo> pending_popup_info;
|
||||
|
@@ -298,6 +298,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const GURL& target_url) OVERRIDE;
|
||||
virtual void WebContentsCreated(content::WebContents* source_contents,
|
||||
int64 source_frame_id,
|
||||
const string16& frame_name,
|
||||
const GURL& target_url,
|
||||
content::WebContents* new_contents) OVERRIDE;
|
||||
virtual void DidNavigateMainFramePostCommit(
|
||||
|
@@ -448,7 +448,7 @@ void OnChromeTracingProcessMessage(CefRefPtr<CefBrowser> browser,
|
||||
if (action == "tracingControllerInitialized") {
|
||||
// Send the client info to the tracingController.
|
||||
} else if (action == "beginTracing") {
|
||||
if (!arguments || arguments->GetSize() != 2) {
|
||||
if (!arguments || arguments->GetSize() != 3) {
|
||||
NOTREACHED() << "Invalid arguments to " << action.c_str();
|
||||
return;
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ content::DevToolsAgentHost* CefDevToolsBindingHandler::ForIdentifier(
|
||||
if (GetIdentifier(host) == identifier) {
|
||||
// May create a new agent host.
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host(
|
||||
content::DevToolsAgentHost::GetFor(host));
|
||||
content::DevToolsAgentHost::GetOrCreateFor(host));
|
||||
agents_map_[identifier] = agent_host;
|
||||
return agent_host;
|
||||
}
|
||||
@@ -163,6 +163,10 @@ content::DevToolsHttpHandlerDelegate::TargetType
|
||||
return kTargetTypeTab;
|
||||
}
|
||||
|
||||
std::string CefDevToolsDelegate::GetViewDescription(content::RenderViewHost*) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string CefDevToolsDelegate::GetDevToolsURL(content::RenderViewHost* rvh,
|
||||
bool http_scheme) {
|
||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||
|
@@ -62,6 +62,7 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
|
||||
virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE;
|
||||
virtual content::RenderViewHost* CreateNewTarget() OVERRIDE;
|
||||
virtual TargetType GetTargetType(content::RenderViewHost*) OVERRIDE;
|
||||
virtual std::string GetViewDescription(content::RenderViewHost*) OVERRIDE;
|
||||
|
||||
// Returns the DevTools URL for the specified RenderViewHost.
|
||||
std::string GetDevToolsURL(content::RenderViewHost* rvh, bool http_scheme);
|
||||
|
@@ -1,216 +1,217 @@
|
||||
// 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 "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
|
||||
// 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 "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
|
||||
#include "base/prefs/pref_registry_simple.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/media_devices_monitor.h"
|
||||
#include "content/public/common/media_stream_request.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
using content::MediaStreamDevices;
|
||||
|
||||
namespace {
|
||||
|
||||
const content::MediaStreamDevice* FindDefaultDeviceWithId(
|
||||
const content::MediaStreamDevices& devices,
|
||||
const std::string& device_id) {
|
||||
if (devices.empty())
|
||||
return NULL;
|
||||
|
||||
content::MediaStreamDevices::const_iterator iter = devices.begin();
|
||||
for (; iter != devices.end(); ++iter) {
|
||||
if (iter->id == device_id) {
|
||||
return &(*iter);
|
||||
}
|
||||
}
|
||||
|
||||
return &(*devices.begin());
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
CefMediaCaptureDevicesDispatcher*
|
||||
CefMediaCaptureDevicesDispatcher::GetInstance() {
|
||||
return Singleton<CefMediaCaptureDevicesDispatcher>::get();
|
||||
}
|
||||
|
||||
CefMediaCaptureDevicesDispatcher::CefMediaCaptureDevicesDispatcher()
|
||||
: devices_enumerated_(false) {}
|
||||
|
||||
CefMediaCaptureDevicesDispatcher::~CefMediaCaptureDevicesDispatcher() {}
|
||||
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/media_devices_monitor.h"
|
||||
#include "content/public/common/media_stream_request.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
using content::MediaStreamDevices;
|
||||
|
||||
namespace {
|
||||
|
||||
const content::MediaStreamDevice* FindDefaultDeviceWithId(
|
||||
const content::MediaStreamDevices& devices,
|
||||
const std::string& device_id) {
|
||||
if (devices.empty())
|
||||
return NULL;
|
||||
|
||||
content::MediaStreamDevices::const_iterator iter = devices.begin();
|
||||
for (; iter != devices.end(); ++iter) {
|
||||
if (iter->id == device_id) {
|
||||
return &(*iter);
|
||||
}
|
||||
}
|
||||
|
||||
return &(*devices.begin());
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
CefMediaCaptureDevicesDispatcher*
|
||||
CefMediaCaptureDevicesDispatcher::GetInstance() {
|
||||
return Singleton<CefMediaCaptureDevicesDispatcher>::get();
|
||||
}
|
||||
|
||||
CefMediaCaptureDevicesDispatcher::CefMediaCaptureDevicesDispatcher()
|
||||
: devices_enumerated_(false) {}
|
||||
|
||||
CefMediaCaptureDevicesDispatcher::~CefMediaCaptureDevicesDispatcher() {}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::RegisterPrefs(
|
||||
PrefRegistrySimple* registry) {
|
||||
registry->RegisterStringPref(prefs::kDefaultAudioCaptureDevice,
|
||||
std::string());
|
||||
registry->RegisterStringPref(prefs::kDefaultVideoCaptureDevice,
|
||||
std::string());
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::AddObserver(Observer* observer) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
if (!observers_.HasObserver(observer))
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::RemoveObserver(Observer* observer) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
const MediaStreamDevices&
|
||||
CefMediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
if (!devices_enumerated_) {
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(&content::EnsureMonitorCaptureDevices));
|
||||
devices_enumerated_ = true;
|
||||
}
|
||||
return audio_devices_;
|
||||
}
|
||||
|
||||
const MediaStreamDevices&
|
||||
CefMediaCaptureDevicesDispatcher::GetVideoCaptureDevices() {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
if (!devices_enumerated_) {
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(&content::EnsureMonitorCaptureDevices));
|
||||
devices_enumerated_ = true;
|
||||
}
|
||||
return video_devices_;
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::GetDefaultDevices(
|
||||
PrefService* prefs,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
DCHECK(audio || video);
|
||||
|
||||
std::string default_device;
|
||||
if (audio) {
|
||||
default_device = prefs->GetString(prefs::kDefaultAudioCaptureDevice);
|
||||
GetRequestedDevice(default_device, true, false, devices);
|
||||
}
|
||||
|
||||
if (video) {
|
||||
default_device = prefs->GetString(prefs::kDefaultVideoCaptureDevice);
|
||||
GetRequestedDevice(default_device, false, true, devices);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::GetRequestedDevice(
|
||||
const std::string& requested_device_id,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
DCHECK(audio || video);
|
||||
|
||||
if (audio) {
|
||||
const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices();
|
||||
const content::MediaStreamDevice* const device =
|
||||
FindDefaultDeviceWithId(audio_devices, requested_device_id);
|
||||
if (device)
|
||||
devices->push_back(*device);
|
||||
}
|
||||
if (video) {
|
||||
const content::MediaStreamDevices& video_devices = GetVideoCaptureDevices();
|
||||
const content::MediaStreamDevice* const device =
|
||||
FindDefaultDeviceWithId(video_devices, requested_device_id);
|
||||
if (device)
|
||||
devices->push_back(*device);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnCaptureDevicesOpened(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnCaptureDevicesClosed(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(
|
||||
&CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread,
|
||||
base::Unretained(this), devices));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(
|
||||
&CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread,
|
||||
base::Unretained(this), devices));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(
|
||||
&CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread,
|
||||
base::Unretained(this), render_process_id, render_view_id, device,
|
||||
state));
|
||||
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnAudioStreamPlayingChanged(
|
||||
int render_process_id, int render_view_id, int stream_id, bool playing) {
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread(
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
devices_enumerated_ = true;
|
||||
audio_devices_ = devices;
|
||||
FOR_EACH_OBSERVER(Observer, observers_,
|
||||
OnUpdateAudioDevices(audio_devices_));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread(
|
||||
const content::MediaStreamDevices& devices){
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
devices_enumerated_ = true;
|
||||
video_devices_ = devices;
|
||||
FOR_EACH_OBSERVER(Observer, observers_,
|
||||
OnUpdateVideoDevices(video_devices_));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) {
|
||||
FOR_EACH_OBSERVER(Observer, observers_,
|
||||
OnRequestUpdate(render_process_id,
|
||||
render_view_id,
|
||||
device,
|
||||
state));
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::AddObserver(Observer* observer) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
if (!observers_.HasObserver(observer))
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::RemoveObserver(Observer* observer) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
const MediaStreamDevices&
|
||||
CefMediaCaptureDevicesDispatcher::GetAudioCaptureDevices() {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
if (!devices_enumerated_) {
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(&content::EnsureMonitorCaptureDevices));
|
||||
devices_enumerated_ = true;
|
||||
}
|
||||
return audio_devices_;
|
||||
}
|
||||
|
||||
const MediaStreamDevices&
|
||||
CefMediaCaptureDevicesDispatcher::GetVideoCaptureDevices() {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
if (!devices_enumerated_) {
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::IO, FROM_HERE,
|
||||
base::Bind(&content::EnsureMonitorCaptureDevices));
|
||||
devices_enumerated_ = true;
|
||||
}
|
||||
return video_devices_;
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::GetDefaultDevices(
|
||||
PrefService* prefs,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
DCHECK(audio || video);
|
||||
|
||||
std::string default_device;
|
||||
if (audio) {
|
||||
default_device = prefs->GetString(prefs::kDefaultAudioCaptureDevice);
|
||||
GetRequestedDevice(default_device, true, false, devices);
|
||||
}
|
||||
|
||||
if (video) {
|
||||
default_device = prefs->GetString(prefs::kDefaultVideoCaptureDevice);
|
||||
GetRequestedDevice(default_device, false, true, devices);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::GetRequestedDevice(
|
||||
const std::string& requested_device_id,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
DCHECK(audio || video);
|
||||
|
||||
if (audio) {
|
||||
const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices();
|
||||
const content::MediaStreamDevice* const device =
|
||||
FindDefaultDeviceWithId(audio_devices, requested_device_id);
|
||||
if (device)
|
||||
devices->push_back(*device);
|
||||
}
|
||||
if (video) {
|
||||
const content::MediaStreamDevices& video_devices = GetVideoCaptureDevices();
|
||||
const content::MediaStreamDevice* const device =
|
||||
FindDefaultDeviceWithId(video_devices, requested_device_id);
|
||||
if (device)
|
||||
devices->push_back(*device);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnCaptureDevicesOpened(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices,
|
||||
const base::Closure& close_callback) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnCaptureDevicesClosed(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnAudioCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(
|
||||
&CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread,
|
||||
base::Unretained(this), devices));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(
|
||||
&CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread,
|
||||
base::Unretained(this), devices));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
BrowserThread::PostTask(
|
||||
BrowserThread::UI, FROM_HERE,
|
||||
base::Bind(
|
||||
&CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread,
|
||||
base::Unretained(this), render_process_id, render_view_id, device,
|
||||
state));
|
||||
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnAudioStreamPlayingChanged(
|
||||
int render_process_id, int render_view_id, int stream_id, bool playing) {
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread(
|
||||
const content::MediaStreamDevices& devices) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
devices_enumerated_ = true;
|
||||
audio_devices_ = devices;
|
||||
FOR_EACH_OBSERVER(Observer, observers_,
|
||||
OnUpdateAudioDevices(audio_devices_));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread(
|
||||
const content::MediaStreamDevices& devices){
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
devices_enumerated_ = true;
|
||||
video_devices_ = devices;
|
||||
FOR_EACH_OBSERVER(Observer, observers_,
|
||||
OnUpdateVideoDevices(video_devices_));
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) {
|
||||
FOR_EACH_OBSERVER(Observer, observers_,
|
||||
OnRequestUpdate(render_process_id,
|
||||
render_view_id,
|
||||
device,
|
||||
state));
|
||||
}
|
||||
|
@@ -1,128 +1,129 @@
|
||||
// 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/memory/singleton.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "content/public/browser/media_observer.h"
|
||||
#include "content/public/common/media_stream_request.h"
|
||||
|
||||
class PrefRegistrySimple;
|
||||
class PrefService;
|
||||
|
||||
// This singleton is used to receive updates about media events from the content
|
||||
// layer. Based on chrome/browser/media/media_capture_devices_dispatcher.[h|cc].
|
||||
class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||
public:
|
||||
class Observer {
|
||||
public:
|
||||
// Handle an information update consisting of a up-to-date audio capture
|
||||
// device lists. This happens when a microphone is plugged in or unplugged.
|
||||
virtual void OnUpdateAudioDevices(
|
||||
const content::MediaStreamDevices& devices) {}
|
||||
|
||||
// Handle an information update consisting of a up-to-date video capture
|
||||
// device lists. This happens when a camera is plugged in or unplugged.
|
||||
virtual void OnUpdateVideoDevices(
|
||||
const content::MediaStreamDevices& devices) {}
|
||||
|
||||
// Handle an information update related to a media stream request.
|
||||
virtual void OnRequestUpdate(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
const content::MediaRequestState state) {}
|
||||
|
||||
virtual ~Observer() {}
|
||||
};
|
||||
|
||||
static CefMediaCaptureDevicesDispatcher* GetInstance();
|
||||
|
||||
// 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/memory/singleton.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "content/public/browser/media_observer.h"
|
||||
#include "content/public/common/media_stream_request.h"
|
||||
|
||||
class PrefRegistrySimple;
|
||||
class PrefService;
|
||||
|
||||
// This singleton is used to receive updates about media events from the content
|
||||
// layer. Based on chrome/browser/media/media_capture_devices_dispatcher.[h|cc].
|
||||
class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||
public:
|
||||
class Observer {
|
||||
public:
|
||||
// Handle an information update consisting of a up-to-date audio capture
|
||||
// device lists. This happens when a microphone is plugged in or unplugged.
|
||||
virtual void OnUpdateAudioDevices(
|
||||
const content::MediaStreamDevices& devices) {}
|
||||
|
||||
// Handle an information update consisting of a up-to-date video capture
|
||||
// device lists. This happens when a camera is plugged in or unplugged.
|
||||
virtual void OnUpdateVideoDevices(
|
||||
const content::MediaStreamDevices& devices) {}
|
||||
|
||||
// Handle an information update related to a media stream request.
|
||||
virtual void OnRequestUpdate(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
const content::MediaRequestState state) {}
|
||||
|
||||
virtual ~Observer() {}
|
||||
};
|
||||
|
||||
static CefMediaCaptureDevicesDispatcher* GetInstance();
|
||||
|
||||
// Registers the preferences related to Media Stream default devices.
|
||||
static void RegisterPrefs(PrefRegistrySimple* registry);
|
||||
|
||||
// Methods for observers. Called on UI thread.
|
||||
// Observers should add themselves on construction and remove themselves
|
||||
// on destruction.
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
const content::MediaStreamDevices& GetAudioCaptureDevices();
|
||||
const content::MediaStreamDevices& GetVideoCaptureDevices();
|
||||
|
||||
// Helper to get the default devices which can be used by the media request,
|
||||
// if the return list is empty, it means there is no available device on the
|
||||
// OS.
|
||||
// Called on the UI thread.
|
||||
void GetDefaultDevices(PrefService* prefs,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices);
|
||||
|
||||
// Helper for picking the device that was requested for an OpenDevice request.
|
||||
// If the device requested is not available it will revert to using the first
|
||||
// available one instead or will return an empty list if no devices of the
|
||||
// requested kind are present.
|
||||
void GetRequestedDevice(const std::string& requested_device_id,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices);
|
||||
|
||||
// Overridden from content::MediaObserver:
|
||||
virtual void OnCaptureDevicesOpened(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnCaptureDevicesClosed(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnAudioCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnVideoCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) OVERRIDE;
|
||||
virtual void OnAudioStreamPlayingChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int stream_id,
|
||||
bool playing) OVERRIDE;
|
||||
|
||||
private:
|
||||
friend struct DefaultSingletonTraits<CefMediaCaptureDevicesDispatcher>;
|
||||
|
||||
CefMediaCaptureDevicesDispatcher();
|
||||
virtual ~CefMediaCaptureDevicesDispatcher();
|
||||
|
||||
// Called by the MediaObserver() functions, executed on UI thread.
|
||||
void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices);
|
||||
void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices);
|
||||
void UpdateMediaRequestStateOnUIThread(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state);
|
||||
|
||||
// A list of cached audio capture devices.
|
||||
content::MediaStreamDevices audio_devices_;
|
||||
|
||||
// A list of cached video capture devices.
|
||||
content::MediaStreamDevices video_devices_;
|
||||
|
||||
// A list of observers for the device update notifications.
|
||||
ObserverList<Observer> observers_;
|
||||
|
||||
// Flag to indicate if device enumeration has been done/doing.
|
||||
// Only accessed on UI thread.
|
||||
bool devices_enumerated_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
static void RegisterPrefs(PrefRegistrySimple* registry);
|
||||
|
||||
// Methods for observers. Called on UI thread.
|
||||
// Observers should add themselves on construction and remove themselves
|
||||
// on destruction.
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
const content::MediaStreamDevices& GetAudioCaptureDevices();
|
||||
const content::MediaStreamDevices& GetVideoCaptureDevices();
|
||||
|
||||
// Helper to get the default devices which can be used by the media request,
|
||||
// if the return list is empty, it means there is no available device on the
|
||||
// OS.
|
||||
// Called on the UI thread.
|
||||
void GetDefaultDevices(PrefService* prefs,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices);
|
||||
|
||||
// Helper for picking the device that was requested for an OpenDevice request.
|
||||
// If the device requested is not available it will revert to using the first
|
||||
// available one instead or will return an empty list if no devices of the
|
||||
// requested kind are present.
|
||||
void GetRequestedDevice(const std::string& requested_device_id,
|
||||
bool audio,
|
||||
bool video,
|
||||
content::MediaStreamDevices* devices);
|
||||
|
||||
// Overridden from content::MediaObserver:
|
||||
virtual void OnCaptureDevicesOpened(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices,
|
||||
const base::Closure& close_callback) OVERRIDE;
|
||||
virtual void OnCaptureDevicesClosed(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnAudioCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnVideoCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) OVERRIDE;
|
||||
virtual void OnAudioStreamPlayingChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int stream_id,
|
||||
bool playing) OVERRIDE;
|
||||
|
||||
private:
|
||||
friend struct DefaultSingletonTraits<CefMediaCaptureDevicesDispatcher>;
|
||||
|
||||
CefMediaCaptureDevicesDispatcher();
|
||||
virtual ~CefMediaCaptureDevicesDispatcher();
|
||||
|
||||
// Called by the MediaObserver() functions, executed on UI thread.
|
||||
void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices);
|
||||
void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices);
|
||||
void UpdateMediaRequestStateOnUIThread(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state);
|
||||
|
||||
// A list of cached audio capture devices.
|
||||
content::MediaStreamDevices audio_devices_;
|
||||
|
||||
// A list of cached video capture devices.
|
||||
content::MediaStreamDevices video_devices_;
|
||||
|
||||
// A list of observers for the device update notifications.
|
||||
ObserverList<Observer> observers_;
|
||||
|
||||
// Flag to indicate if device enumeration has been done/doing.
|
||||
// Only accessed on UI thread.
|
||||
bool devices_enumerated_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
|
||||
|
@@ -181,12 +181,6 @@ void CefResourceRequestJob::Start() {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (SetHeaderIfMissing(headerMap,
|
||||
net::HttpRequestHeaders::kAcceptCharset,
|
||||
ua_settings->GetAcceptCharset())) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (SetHeaderIfMissing(headerMap,
|
||||
net::HttpRequestHeaders::kUserAgent,
|
||||
ua_settings->GetUserAgent(request_->url()))) {
|
||||
|
@@ -31,16 +31,16 @@
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "net/base/cert_verifier.h"
|
||||
#include "net/base/default_server_bound_cert_store.h"
|
||||
#include "net/base/host_resolver.h"
|
||||
#include "net/base/server_bound_cert_service.h"
|
||||
#include "net/base/ssl_config_service_defaults.h"
|
||||
#include "net/cookies/cookie_monster.h"
|
||||
#include "net/dns/host_resolver.h"
|
||||
#include "net/ftp/ftp_network_layer.h"
|
||||
#include "net/http/http_auth_handler_factory.h"
|
||||
#include "net/http/http_cache.h"
|
||||
#include "net/http/http_server_properties_impl.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
#include "net/ssl/default_server_bound_cert_store.h"
|
||||
#include "net/ssl/server_bound_cert_service.h"
|
||||
#include "net/ssl/ssl_config_service_defaults.h"
|
||||
#include "net/url_request/static_http_user_agent_settings.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
@@ -94,8 +94,7 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
|
||||
new net::DefaultServerBoundCertStore(NULL),
|
||||
base::WorkerPool::GetTaskRunner(true)));
|
||||
storage_->set_http_user_agent_settings(
|
||||
new net::StaticHttpUserAgentSettings(
|
||||
"en-us,en", "iso-8859-1,*,utf-8", EmptyString()));
|
||||
new net::StaticHttpUserAgentSettings("en-us,en", EmptyString()));
|
||||
|
||||
storage_->set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL));
|
||||
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
||||
@@ -105,6 +104,7 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
|
||||
ProxyServiceFactory::CreateProxyService(
|
||||
NULL,
|
||||
url_request_context_.get(),
|
||||
url_request_context_->network_delegate(),
|
||||
_Context->proxy_config_service().release(),
|
||||
command_line));
|
||||
storage_->set_proxy_service(system_proxy_service.release());
|
||||
|
@@ -80,6 +80,9 @@ void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
||||
void CefWebContentsViewOSR::RenderViewSwappedIn(content::RenderViewHost* host) {
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::Focus() {
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,7 @@ class CefWebContentsViewOSR : public content::WebContentsViewPort,
|
||||
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
|
||||
virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE;
|
||||
virtual void RenderViewSwappedIn(content::RenderViewHost* host) OVERRIDE;
|
||||
virtual void SetOverscrollControllerEnabled(bool enabled) OVERRIDE;
|
||||
virtual void Focus() OVERRIDE;
|
||||
virtual void SetInitialFocus() OVERRIDE;
|
||||
virtual void StoreFocus() OVERRIDE;
|
||||
|
Reference in New Issue
Block a user