mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 213078.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1338 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -11,17 +11,14 @@
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/url_request_context_getter.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/geolocation_permission_context.h"
|
||||
#include "content/public/browser/resource_context.h"
|
||||
#include "content/public/browser/speech_recognition_preferences.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
@ -158,26 +155,6 @@ class CefGeolocationPermissionContext
|
||||
DISALLOW_COPY_AND_ASSIGN(CefGeolocationPermissionContext);
|
||||
};
|
||||
|
||||
class CefSpeechRecognitionPreferences
|
||||
: public content::SpeechRecognitionPreferences {
|
||||
public:
|
||||
CefSpeechRecognitionPreferences() {
|
||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||
filter_profanities_ =
|
||||
command_line.HasSwitch(switches::kEnableProfanityFilter);
|
||||
}
|
||||
|
||||
// Overridden from SpeechRecognitionPreferences:
|
||||
virtual bool FilterProfanities() const OVERRIDE {
|
||||
return filter_profanities_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool filter_profanities_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefSpeechRecognitionPreferences);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefBrowserContext::CefResourceContext : public content::ResourceContext {
|
||||
@ -222,7 +199,7 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
}
|
||||
}
|
||||
|
||||
base::FilePath CefBrowserContext::GetPath() {
|
||||
base::FilePath CefBrowserContext::GetPath() const {
|
||||
return _Context->cache_path();
|
||||
}
|
||||
|
||||
@ -272,6 +249,15 @@ net::URLRequestContextGetter*
|
||||
return GetRequestContext();
|
||||
}
|
||||
|
||||
void CefBrowserContext::RequestMIDISysExPermission(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const GURL& requesting_frame,
|
||||
const MIDISysExPermissionCallback& callback) {
|
||||
// TODO(CEF): Implement Web MIDI API permission handling.
|
||||
callback.Run(false);
|
||||
}
|
||||
|
||||
content::ResourceContext* CefBrowserContext::GetResourceContext() {
|
||||
return resource_context_.get();
|
||||
}
|
||||
@ -285,13 +271,6 @@ content::GeolocationPermissionContext*
|
||||
return geolocation_permission_context_;
|
||||
}
|
||||
|
||||
content::SpeechRecognitionPreferences*
|
||||
CefBrowserContext::GetSpeechRecognitionPreferences() {
|
||||
if (!speech_recognition_preferences_.get())
|
||||
speech_recognition_preferences_ = new CefSpeechRecognitionPreferences();
|
||||
return speech_recognition_preferences_.get();
|
||||
}
|
||||
|
||||
quota::SpecialStoragePolicy* CefBrowserContext::GetSpecialStoragePolicy() {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class CefBrowserContext : public content::BrowserContext {
|
||||
virtual ~CefBrowserContext();
|
||||
|
||||
// BrowserContext methods.
|
||||
virtual base::FilePath GetPath() OVERRIDE;
|
||||
virtual base::FilePath GetPath() const OVERRIDE;
|
||||
virtual bool IsOffTheRecord() const OVERRIDE;
|
||||
virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE;
|
||||
virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
|
||||
@ -41,11 +41,14 @@ class CefBrowserContext : public content::BrowserContext {
|
||||
GetMediaRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory) OVERRIDE;
|
||||
virtual void RequestMIDISysExPermission(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const GURL& requesting_frame,
|
||||
const MIDISysExPermissionCallback& callback) OVERRIDE;
|
||||
virtual content::ResourceContext* GetResourceContext() OVERRIDE;
|
||||
virtual content::GeolocationPermissionContext*
|
||||
GetGeolocationPermissionContext() OVERRIDE;
|
||||
virtual content::SpeechRecognitionPreferences*
|
||||
GetSpeechRecognitionPreferences() OVERRIDE;
|
||||
virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
|
||||
|
||||
net::URLRequestContextGetter* CreateRequestContext(
|
||||
@ -70,8 +73,6 @@ class CefBrowserContext : public content::BrowserContext {
|
||||
scoped_refptr<CefURLRequestContextGetter> url_request_getter_;
|
||||
scoped_refptr<content::GeolocationPermissionContext>
|
||||
geolocation_permission_context_;
|
||||
scoped_refptr<content::SpeechRecognitionPreferences>
|
||||
speech_recognition_preferences_;
|
||||
|
||||
bool use_osr_next_contents_view_;
|
||||
|
||||
|
@ -1631,7 +1631,7 @@ void CefBrowserHostImpl::HandleKeyboardEvent(
|
||||
|
||||
bool CefBrowserHostImpl::CanDragEnter(
|
||||
content::WebContents* source,
|
||||
const WebDropData& data,
|
||||
const content::DropData& data,
|
||||
WebKit::WebDragOperationsMask mask) {
|
||||
CefRefPtr<CefDragHandler> handler = client_->GetDragHandler();
|
||||
if (handler.get()) {
|
||||
@ -1649,7 +1649,10 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
|
||||
int route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const string16& frame_name,
|
||||
const GURL& target_url) {
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const WebKit::WebWindowFeatures& features,
|
||||
bool user_gesture) {
|
||||
CefContentBrowserClient::Get()->GetOrCreateBrowserInfo(
|
||||
web_contents->GetRenderProcessHost()->GetID(), route_id);
|
||||
|
||||
@ -1714,7 +1717,7 @@ void CefBrowserHostImpl::RunFileChooser(
|
||||
|
||||
RunFileChooserOnUIThread(params,
|
||||
base::Bind(&CefBrowserHostImpl::OnRunFileChooserDelegateCallback, this,
|
||||
tab));
|
||||
tab, params.mode));
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::SetPendingPopupInfo(
|
||||
@ -1757,7 +1760,8 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
||||
// For open device request pick the desired device or fall back to the
|
||||
// first available of the given type.
|
||||
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
|
||||
request.requested_device_id,
|
||||
(microphone_requested ? request.requested_audio_device_id :
|
||||
request.requested_video_device_id),
|
||||
microphone_requested,
|
||||
webcam_requested,
|
||||
&devices);
|
||||
@ -1828,7 +1832,7 @@ void CefBrowserHostImpl::RenderViewReady() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderViewGone(base::TerminationStatus status) {
|
||||
void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
|
||||
queue_messages_ = true;
|
||||
|
||||
cef_termination_status_t ts = TS_ABNORMAL_TERMINATION;
|
||||
@ -2354,6 +2358,7 @@ void CefBrowserHostImpl::OnRunFileChooserCallback(
|
||||
|
||||
void CefBrowserHostImpl::OnRunFileChooserDelegateCallback(
|
||||
content::WebContents* tab,
|
||||
content::FileChooserParams::Mode mode,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
@ -2361,12 +2366,6 @@ void CefBrowserHostImpl::OnRunFileChooserDelegateCallback(
|
||||
if (!render_view_host)
|
||||
return;
|
||||
|
||||
const int kReadFilePermissions =
|
||||
base::PLATFORM_FILE_OPEN |
|
||||
base::PLATFORM_FILE_READ |
|
||||
base::PLATFORM_FILE_EXCLUSIVE_READ |
|
||||
base::PLATFORM_FILE_ASYNC;
|
||||
|
||||
// Convert FilePath list to SelectedFileInfo list.
|
||||
std::vector<ui::SelectedFileInfo> selected_files;
|
||||
for (size_t i = 0; i < file_paths.size(); ++i) {
|
||||
@ -2375,6 +2374,5 @@ void CefBrowserHostImpl::OnRunFileChooserDelegateCallback(
|
||||
}
|
||||
|
||||
// Notify our RenderViewHost in all cases.
|
||||
render_view_host->FilesSelectedInChooser(selected_files,
|
||||
kReadFilePermissions);
|
||||
render_view_host->FilesSelectedInChooser(selected_files, mode);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "content/public/common/file_chooser_params.h"
|
||||
#include "net/url_request/url_request_context_getter.h"
|
||||
|
||||
namespace content {
|
||||
@ -303,14 +304,17 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const content::NativeWebKeyboardEvent& event) OVERRIDE;
|
||||
virtual bool CanDragEnter(
|
||||
content::WebContents* source,
|
||||
const WebDropData& data,
|
||||
const content::DropData& data,
|
||||
WebKit::WebDragOperationsMask operations_allowed) OVERRIDE;
|
||||
virtual bool ShouldCreateWebContents(
|
||||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const string16& frame_name,
|
||||
const GURL& target_url) OVERRIDE;
|
||||
const GURL& target_url,
|
||||
WindowOpenDisposition disposition,
|
||||
const WebKit::WebWindowFeatures& features,
|
||||
bool user_gesture) OVERRIDE;
|
||||
virtual void WebContentsCreated(content::WebContents* source_contents,
|
||||
int64 source_frame_id,
|
||||
const string16& frame_name,
|
||||
@ -337,7 +341,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
virtual void RenderViewDeleted(
|
||||
content::RenderViewHost* render_view_host) OVERRIDE;
|
||||
virtual void RenderViewReady() OVERRIDE;
|
||||
virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
|
||||
virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
|
||||
virtual void DidCommitProvisionalLoadForFrame(
|
||||
int64 frame_id,
|
||||
bool is_main_frame,
|
||||
@ -471,6 +475,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Used with WebContentsDelegate::RunFileChooser to notify the WebContents.
|
||||
void OnRunFileChooserDelegateCallback(
|
||||
content::WebContents* tab,
|
||||
content::FileChooserParams::Mode mode,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
|
||||
CefWindowInfo window_info_;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "chrome/browser/net/proxy_service_factory.h"
|
||||
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
||||
@ -74,7 +74,7 @@ int CefBrowserMainParts::PreCreateThreads() {
|
||||
|
||||
// Initialize proxy configuration tracker.
|
||||
pref_proxy_config_tracker_.reset(
|
||||
ProxyServiceFactory::CreatePrefProxyConfigTracker(
|
||||
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
|
||||
pref_service_.get()));
|
||||
|
||||
return 0;
|
||||
@ -86,11 +86,9 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
// Initialize the proxy configuration service. This needs to occur before
|
||||
// CefURLRequestContextGetter::GetURLRequestContext() is called for the
|
||||
// first time.
|
||||
ChromeProxyConfigService* chrome_proxy_config_service =
|
||||
ProxyServiceFactory::CreateProxyConfigService();
|
||||
proxy_config_service_.reset(chrome_proxy_config_service);
|
||||
pref_proxy_config_tracker_->SetChromeProxyConfigService(
|
||||
chrome_proxy_config_service);
|
||||
proxy_config_service_.reset(
|
||||
ProxyServiceFactory::CreateProxyConfigService(
|
||||
pref_proxy_config_tracker_.get()));
|
||||
|
||||
// Initialize the request context getter. This indirectly triggers a call
|
||||
// to CefURLRequestContextGetter::GetURLRequestContext() on the IO thread.
|
||||
|
@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
|
||||
// Class used to process events on the current message loop.
|
||||
class CefBrowserMessageLoop : public base::MessageLoopForUI {
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "libcef/common/response_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "content/public/common/url_fetcher.h"
|
||||
#include "net/base/load_flags.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "content/browser/net/view_blob_internals_job_factory.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "grit/cef_resources.h"
|
||||
#include "grit/tracing_resources.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "v8/include/v8.h"
|
||||
@ -257,10 +258,10 @@ class Delegate : public InternalHandlerDelegate {
|
||||
|
||||
bool OnTracing(const std::string& path, Action* action) {
|
||||
if (path == "tracing.js") {
|
||||
action->resource_id = IDR_CEF_TRACING_JS;
|
||||
action->resource_id = IDR_TRACING_JS;
|
||||
} else {
|
||||
action->mime_type = "text/html";
|
||||
action->resource_id = IDR_CEF_TRACING_HTML;
|
||||
action->resource_id = IDR_TRACING_HTML;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "include/cef_process_message.h"
|
||||
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "net/url_request/url_request_job_factory.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace base {
|
||||
class ListValue;
|
||||
|
@ -38,8 +38,8 @@
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/resource_dispatcher_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -213,7 +213,7 @@ class CefPluginServiceFilter : public content::PluginServiceFilter {
|
||||
const void* context,
|
||||
const GURL& url,
|
||||
const GURL& policy_url,
|
||||
webkit::WebPluginInfo* plugin) OVERRIDE {
|
||||
content::WebPluginInfo* plugin) OVERRIDE {
|
||||
bool allowed = true;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
class CefBrowserInfo;
|
||||
|
@ -182,7 +182,7 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
|
||||
cache_path_ = base::FilePath(CefString(&settings.cache_path));
|
||||
if (!cache_path_.empty() &&
|
||||
!file_util::DirectoryExists(cache_path_) &&
|
||||
!base::DirectoryExists(cache_path_) &&
|
||||
!file_util::CreateDirectory(cache_path_)) {
|
||||
NOTREACHED() << "The cache_path directory could not be created";
|
||||
cache_path_ = base::FilePath();
|
||||
|
@ -20,10 +20,10 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "content/browser/net/sqlite_persistent_cookie_store.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "net/cookies/cookie_util.h"
|
||||
#include "net/cookies/parsed_cookie.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
@ -285,7 +285,7 @@ bool CefCookieManagerImpl::SetStoragePath(
|
||||
// TODO(cef): Move directory creation to the blocking pool instead of
|
||||
// allowing file IO on this thread.
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (file_util::DirectoryExists(new_path) ||
|
||||
if (base::DirectoryExists(new_path) ||
|
||||
file_util::CreateDirectory(new_path)) {
|
||||
const base::FilePath& cookie_path = new_path.AppendASCII("Cookies");
|
||||
persistent_store =
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "base/rand_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/time.h"
|
||||
#include "base/time/time.h"
|
||||
#include "content/public/browser/devtools_http_handler.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "libcef/common/time_util.h"
|
||||
|
||||
#include "content/public/browser/download_item.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
|
||||
CefDownloadItemImpl::CefDownloadItemImpl(content::DownloadItem* value)
|
||||
@ -76,7 +76,7 @@ CefString CefDownloadItemImpl::GetFullPath() {
|
||||
return const_value().GetFullPath().value();
|
||||
}
|
||||
|
||||
int32 CefDownloadItemImpl::GetId() {
|
||||
uint32 CefDownloadItemImpl::GetId() {
|
||||
CEF_VALUE_VERIFY_RETURN(false, 0);
|
||||
return const_value().GetId();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class CefDownloadItemImpl
|
||||
virtual CefTime GetStartTime() OVERRIDE;
|
||||
virtual CefTime GetEndTime() OVERRIDE;
|
||||
virtual CefString GetFullPath() OVERRIDE;
|
||||
virtual int32 GetId() OVERRIDE;
|
||||
virtual uint32 GetId() OVERRIDE;
|
||||
virtual CefString GetURL() OVERRIDE;
|
||||
virtual CefString GetSuggestedFileName() OVERRIDE;
|
||||
virtual CefString GetContentDisposition() OVERRIDE;
|
||||
|
@ -53,7 +53,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
public:
|
||||
CefBeforeDownloadCallbackImpl(
|
||||
const base::WeakPtr<DownloadManager>& manager,
|
||||
int32 download_id,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
const content::DownloadTargetCallback& callback)
|
||||
: manager_(manager),
|
||||
@ -88,7 +88,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
private:
|
||||
static void GenerateFilename(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
int32 download_id,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
const base::FilePath& download_path,
|
||||
bool show_dialog,
|
||||
@ -97,7 +97,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
if (!suggested_path.empty()) {
|
||||
// Create the directory if necessary.
|
||||
base::FilePath dir_path = suggested_path.DirName();
|
||||
if (!file_util::DirectoryExists(dir_path) &&
|
||||
if (!base::DirectoryExists(dir_path) &&
|
||||
!file_util::CreateDirectory(dir_path)) {
|
||||
NOTREACHED() << "failed to create the download directory";
|
||||
suggested_path.clear();
|
||||
@ -122,7 +122,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
|
||||
static void ChooseDownloadPath(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
int32 download_id,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
@ -184,7 +184,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
}
|
||||
|
||||
base::WeakPtr<DownloadManager> manager_;
|
||||
int32 download_id_;
|
||||
uint32 download_id_;
|
||||
base::FilePath suggested_name_;
|
||||
content::DownloadTargetCallback callback_;
|
||||
|
||||
@ -198,7 +198,7 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
||||
public:
|
||||
explicit CefDownloadItemCallbackImpl(
|
||||
const base::WeakPtr<DownloadManager>& manager,
|
||||
int32 download_id)
|
||||
uint32 download_id)
|
||||
: manager_(manager),
|
||||
download_id_(download_id) {
|
||||
}
|
||||
@ -223,7 +223,7 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
|
||||
}
|
||||
|
||||
base::WeakPtr<DownloadManager> manager_;
|
||||
int32 download_id_;
|
||||
uint32 download_id_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefDownloadItemCallbackImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDownloadItemCallbackImpl);
|
||||
@ -341,3 +341,9 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::GetNextId(
|
||||
const content::DownloadIdCallback& callback) {
|
||||
static uint32 next_id = DownloadItem::kInvalidId + 1;
|
||||
callback.Run(next_id++);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ class CefDownloadManagerDelegate
|
||||
virtual bool DetermineDownloadTarget(
|
||||
content::DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) OVERRIDE;
|
||||
virtual void GetNextId(const content::DownloadIdCallback& callback) OVERRIDE;
|
||||
|
||||
content::DownloadManager* manager_;
|
||||
base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <string>
|
||||
#include "include/cef_scheme.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace scheme {
|
||||
|
||||
|
@ -153,22 +153,33 @@ void CefMediaCaptureDevicesDispatcher::OnVideoCaptureDevicesChanged(
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int page_request_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));
|
||||
base::Unretained(this), render_process_id, render_view_id,
|
||||
page_request_id, device, state));
|
||||
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnAudioStreamPlayingChanged(
|
||||
int render_process_id, int render_view_id, int stream_id, bool playing) {
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int stream_id,
|
||||
bool is_playing,
|
||||
float power_dbfs,
|
||||
bool clipped) {
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::OnCreatingAudioStream(
|
||||
int render_process_id,
|
||||
int render_view_id) {
|
||||
}
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateAudioDevicesOnUIThread(
|
||||
@ -192,11 +203,13 @@ void CefMediaCaptureDevicesDispatcher::UpdateVideoDevicesOnUIThread(
|
||||
void CefMediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int page_request_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state) {
|
||||
FOR_EACH_OBSERVER(Observer, observers_,
|
||||
OnRequestUpdate(render_process_id,
|
||||
render_view_id,
|
||||
page_request_id,
|
||||
device,
|
||||
state));
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||
virtual void OnRequestUpdate(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int page_request_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
const content::MediaRequestState state) {}
|
||||
|
||||
@ -78,15 +79,20 @@ class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||
virtual void OnVideoCaptureDevicesChanged(
|
||||
const content::MediaStreamDevices& devices) OVERRIDE;
|
||||
virtual void OnMediaRequestStateChanged(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int page_request_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;
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int stream_id,
|
||||
bool is_playing,
|
||||
float power_dbfs,
|
||||
bool clipped) OVERRIDE;
|
||||
virtual void OnCreatingAudioStream(int render_process_id,
|
||||
int render_view_id) OVERRIDE;
|
||||
|
||||
private:
|
||||
friend struct DefaultSingletonTraits<CefMediaCaptureDevicesDispatcher>;
|
||||
@ -100,6 +106,7 @@ class CefMediaCaptureDevicesDispatcher : public content::MediaObserver {
|
||||
void UpdateMediaRequestStateOnUIThread(
|
||||
int render_process_id,
|
||||
int render_view_id,
|
||||
int page_request_id,
|
||||
const content::MediaStreamDevice& device,
|
||||
content::MediaRequestState state);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "libcef/browser/menu_creator_runner_mac.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#import "base/mac/scoped_sending_event.h"
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "libcef/browser/menu_creator_runner_win.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
#include "ui/gfx/point.h"
|
||||
#include "ui/views/controls/menu/menu_2.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "ui/base/accelerators/accelerator.h"
|
||||
|
||||
namespace {
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "content/public/browser/global_request_id.h"
|
||||
#include "content/public/common/page_transition_types.h"
|
||||
#include "content/public/common/referrer.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "net/base/upload_data.h"
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
// Parameters that tell CefBrowserHostImpl::Navigate() what to do.
|
||||
struct CefNavigateParams {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "libcef/browser/render_widget_host_view_osr.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
@ -165,7 +165,7 @@ void CefRenderWidgetHostViewOSR::WasHidden() {
|
||||
|
||||
void CefRenderWidgetHostViewOSR::MovePluginWindows(
|
||||
const gfx::Vector2d& scroll_offset,
|
||||
const std::vector<webkit::npapi::WebPluginGeometry>& moves) {
|
||||
const std::vector<content::WebPluginGeometry>& moves) {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::Focus() {
|
||||
@ -206,7 +206,8 @@ void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {
|
||||
#if !defined(OS_MACOSX)
|
||||
void CefRenderWidgetHostViewOSR::TextInputTypeChanged(
|
||||
ui::TextInputType type,
|
||||
bool can_compose_inline) {
|
||||
bool can_compose_inline,
|
||||
ui::TextInputMode mode) {
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
|
||||
@ -232,7 +233,7 @@ void CefRenderWidgetHostViewOSR::DidUpdateBackingStore(
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::RenderViewGone(
|
||||
void CefRenderWidgetHostViewOSR::RenderProcessGone(
|
||||
base::TerminationStatus status,
|
||||
int error_code) {
|
||||
render_widget_host_ = NULL;
|
||||
|
@ -113,13 +113,14 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase {
|
||||
virtual void WasHidden() OVERRIDE;
|
||||
virtual void MovePluginWindows(
|
||||
const gfx::Vector2d& scroll_offset,
|
||||
const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE;
|
||||
const std::vector<content::WebPluginGeometry>& moves) OVERRIDE;
|
||||
virtual void Focus() OVERRIDE;
|
||||
virtual void Blur() OVERRIDE;
|
||||
virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
|
||||
virtual void SetIsLoading(bool is_loading) OVERRIDE;
|
||||
virtual void TextInputTypeChanged(ui::TextInputType type,
|
||||
bool can_compose_inline) OVERRIDE;
|
||||
bool can_compose_inline,
|
||||
ui::TextInputMode mode) OVERRIDE;
|
||||
virtual void ImeCancelComposition() OVERRIDE;
|
||||
virtual void ImeCompositionRangeChanged(
|
||||
const ui::Range& range,
|
||||
@ -129,7 +130,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase {
|
||||
const gfx::Vector2d& scroll_delta,
|
||||
const std::vector<gfx::Rect>& copy_rects,
|
||||
const ui::LatencyInfo& latency_info) OVERRIDE;
|
||||
virtual void RenderViewGone(base::TerminationStatus status,
|
||||
virtual void RenderProcessGone(base::TerminationStatus status,
|
||||
int error_code) OVERRIDE;
|
||||
#if defined(OS_WIN) && !defined(USE_AURA)
|
||||
virtual void WillWmDestroy() OVERRIDE;
|
||||
|
@ -76,7 +76,8 @@ void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
|
||||
|
||||
void CefRenderWidgetHostViewOSR::TextInputTypeChanged(
|
||||
ui::TextInputType type,
|
||||
bool can_compose_inline) {
|
||||
bool can_compose_inline,
|
||||
ui::TextInputMode mode) {
|
||||
[NSApp updateWindows];
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "include/cef_frame.h"
|
||||
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace net {
|
||||
class FtpTransactionFactory;
|
||||
|
@ -21,10 +21,9 @@
|
||||
#include "base/bind.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "googleurl/src/url_util.h"
|
||||
#include "net/base/completion_callback.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
#include "net/base/upload_data.h"
|
||||
@ -36,6 +35,7 @@
|
||||
#include "net/url_request/url_request_http_job.h"
|
||||
#include "net/url_request/url_request_job.h"
|
||||
#include "net/url_request/url_request_job_factory_impl.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
using net::URLRequestStatus;
|
||||
|
||||
|
@ -1,217 +1,228 @@
|
||||
// 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/speech_recognition_manager_delegate.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
#include "content/public/browser/notification_source.h"
|
||||
#include "content/public/browser/notification_types.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/speech_recognition_manager.h"
|
||||
#include "content/public/browser/speech_recognition_session_context.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/speech_recognition_error.h"
|
||||
#include "content/public/common/speech_recognition_result.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
using content::SpeechRecognitionManager;
|
||||
using content::WebContents;
|
||||
|
||||
// Simple utility to get notified when a WebContents is closed or crashes.
|
||||
// Both the callback site and the callback thread are passed by the caller in
|
||||
// the constructor. There is no restriction on the constructor, however this
|
||||
// class must be destroyed on the UI thread, due to the NotificationRegistrar
|
||||
// dependency.
|
||||
class CefSpeechRecognitionManagerDelegate::WebContentsWatcher
|
||||
: public base::RefCountedThreadSafe<WebContentsWatcher>,
|
||||
public content::NotificationObserver {
|
||||
public:
|
||||
typedef base::Callback<void(int render_process_id, int render_view_id)>
|
||||
WebContentsClosedCallback;
|
||||
|
||||
WebContentsWatcher(WebContentsClosedCallback web_contents_closed_callback,
|
||||
BrowserThread::ID callback_thread)
|
||||
: web_contents_closed_callback_(web_contents_closed_callback),
|
||||
callback_thread_(callback_thread) {
|
||||
}
|
||||
|
||||
// Starts monitoring the WebContents corresponding to the given
|
||||
// |render_process_id|, |render_view_id| pair, invoking
|
||||
// |web_contents_closed_callback_| if closed/unloaded.
|
||||
void Watch(int render_process_id, int render_view_id) {
|
||||
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
|
||||
&WebContentsWatcher::Watch, this, render_process_id, render_view_id));
|
||||
return;
|
||||
}
|
||||
|
||||
WebContents* web_contents = NULL;
|
||||
// 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/speech_recognition_manager_delegate.h"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
#include "content/public/browser/notification_source.h"
|
||||
#include "content/public/browser/notification_types.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/speech_recognition_manager.h"
|
||||
#include "content/public/browser/speech_recognition_session_context.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/speech_recognition_error.h"
|
||||
#include "content/public/common/speech_recognition_result.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
using content::SpeechRecognitionManager;
|
||||
using content::WebContents;
|
||||
|
||||
// Simple utility to get notified when a WebContents is closed or crashes.
|
||||
// Both the callback site and the callback thread are passed by the caller in
|
||||
// the constructor. There is no restriction on the constructor, however this
|
||||
// class must be destroyed on the UI thread, due to the NotificationRegistrar
|
||||
// dependency.
|
||||
class CefSpeechRecognitionManagerDelegate::WebContentsWatcher
|
||||
: public base::RefCountedThreadSafe<WebContentsWatcher>,
|
||||
public content::NotificationObserver {
|
||||
public:
|
||||
typedef base::Callback<void(int render_process_id, int render_view_id)>
|
||||
WebContentsClosedCallback;
|
||||
|
||||
WebContentsWatcher(WebContentsClosedCallback web_contents_closed_callback,
|
||||
BrowserThread::ID callback_thread)
|
||||
: web_contents_closed_callback_(web_contents_closed_callback),
|
||||
callback_thread_(callback_thread) {
|
||||
}
|
||||
|
||||
// Starts monitoring the WebContents corresponding to the given
|
||||
// |render_process_id|, |render_view_id| pair, invoking
|
||||
// |web_contents_closed_callback_| if closed/unloaded.
|
||||
void Watch(int render_process_id, int render_view_id) {
|
||||
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
||||
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
|
||||
&WebContentsWatcher::Watch, this, render_process_id, render_view_id));
|
||||
return;
|
||||
}
|
||||
|
||||
WebContents* web_contents = NULL;
|
||||
content::RenderViewHost* render_view_host =
|
||||
content::RenderViewHost::FromID(render_process_id, render_view_id);
|
||||
if (render_view_host)
|
||||
web_contents = WebContents::FromRenderViewHost(render_view_host);
|
||||
DCHECK(web_contents);
|
||||
|
||||
// Avoid multiple registrations on |registrar_| for the same |web_contents|.
|
||||
if (registered_web_contents_.find(web_contents) !=
|
||||
registered_web_contents_.end()) {
|
||||
return;
|
||||
}
|
||||
registered_web_contents_.insert(web_contents);
|
||||
|
||||
// Lazy initialize the registrar.
|
||||
if (!registrar_.get())
|
||||
registrar_.reset(new content::NotificationRegistrar());
|
||||
|
||||
registrar_->Add(this,
|
||||
content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
|
||||
content::Source<WebContents>(web_contents));
|
||||
}
|
||||
|
||||
// content::NotificationObserver implementation.
|
||||
virtual void Observe(int type,
|
||||
const content::NotificationSource& source,
|
||||
const content::NotificationDetails& details) OVERRIDE {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, type);
|
||||
|
||||
WebContents* web_contents = content::Source<WebContents>(source).ptr();
|
||||
int render_process_id = web_contents->GetRenderProcessHost()->GetID();
|
||||
int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
|
||||
|
||||
registrar_->Remove(this,
|
||||
content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
|
||||
content::Source<WebContents>(web_contents));
|
||||
registered_web_contents_.erase(web_contents);
|
||||
|
||||
BrowserThread::PostTask(callback_thread_, FROM_HERE, base::Bind(
|
||||
web_contents_closed_callback_, render_process_id, render_view_id));
|
||||
}
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<WebContentsWatcher>;
|
||||
|
||||
virtual ~WebContentsWatcher() {
|
||||
// Must be destroyed on the UI thread due to |registrar_| non thread-safety.
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
}
|
||||
|
||||
// Lazy-initialized and used on the UI thread to handle web contents
|
||||
// notifications (tab closing).
|
||||
scoped_ptr<content::NotificationRegistrar> registrar_;
|
||||
|
||||
// Keeps track of which WebContent(s) have been registered, in order to avoid
|
||||
// double registrations on |registrar_|
|
||||
std::set<content::WebContents*> registered_web_contents_;
|
||||
|
||||
// Callback used to notify, on the thread specified by |callback_thread_| the
|
||||
// closure of a registered tab.
|
||||
WebContentsClosedCallback web_contents_closed_callback_;
|
||||
content::BrowserThread::ID callback_thread_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebContentsWatcher);
|
||||
};
|
||||
|
||||
CefSpeechRecognitionManagerDelegate
|
||||
::CefSpeechRecognitionManagerDelegate() {
|
||||
}
|
||||
|
||||
CefSpeechRecognitionManagerDelegate
|
||||
::~CefSpeechRecognitionManagerDelegate() {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::WebContentsClosedCallback(
|
||||
int render_process_id, int render_view_id) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
|
||||
SpeechRecognitionManager* manager = SpeechRecognitionManager::GetInstance();
|
||||
// |manager| becomes NULL if a browser shutdown happens between the post of
|
||||
// this task (from the UI thread) and this call (on the IO thread). In this
|
||||
// case we just return.
|
||||
if (!manager)
|
||||
return;
|
||||
|
||||
manager->AbortAllSessionsForRenderView(render_process_id, render_view_id);
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionStart(
|
||||
int session_id) {
|
||||
const content::SpeechRecognitionSessionContext& context =
|
||||
SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
|
||||
|
||||
// Register callback to auto abort session on tab closure.
|
||||
// |web_contents_watcher_| is lazyly istantiated on the first call.
|
||||
if (!web_contents_watcher_.get()) {
|
||||
web_contents_watcher_ = new WebContentsWatcher(
|
||||
base::Bind(
|
||||
&CefSpeechRecognitionManagerDelegate::WebContentsClosedCallback,
|
||||
base::Unretained(this)),
|
||||
BrowserThread::IO);
|
||||
}
|
||||
web_contents_watcher_->Watch(context.render_process_id,
|
||||
context.render_view_id);
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioStart(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnEnvironmentEstimationComplete(
|
||||
int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnSoundStart(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnSoundEnd(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioEnd(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionResults(
|
||||
int session_id, const content::SpeechRecognitionResults& result) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionError(
|
||||
int session_id, const content::SpeechRecognitionError& error) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
|
||||
int session_id, float volume, float noise_volume) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionEnd(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::GetDiagnosticInformation(
|
||||
bool* can_report_metrics,
|
||||
std::string* hardware_info) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
|
||||
int session_id,
|
||||
base::Callback<void(bool ask_user, bool is_allowed)> callback) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
|
||||
const content::SpeechRecognitionSessionContext& context =
|
||||
SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
|
||||
|
||||
// Make sure that initiators properly set the |render_process_id| field.
|
||||
DCHECK_NE(context.render_process_id, 0);
|
||||
|
||||
callback.Run(false, true);
|
||||
}
|
||||
|
||||
content::SpeechRecognitionEventListener*
|
||||
CefSpeechRecognitionManagerDelegate::GetEventListener() {
|
||||
return this;
|
||||
}
|
||||
web_contents = WebContents::FromRenderViewHost(render_view_host);
|
||||
DCHECK(web_contents);
|
||||
|
||||
// Avoid multiple registrations on |registrar_| for the same |web_contents|.
|
||||
if (registered_web_contents_.find(web_contents) !=
|
||||
registered_web_contents_.end()) {
|
||||
return;
|
||||
}
|
||||
registered_web_contents_.insert(web_contents);
|
||||
|
||||
// Lazy initialize the registrar.
|
||||
if (!registrar_.get())
|
||||
registrar_.reset(new content::NotificationRegistrar());
|
||||
|
||||
registrar_->Add(this,
|
||||
content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
|
||||
content::Source<WebContents>(web_contents));
|
||||
}
|
||||
|
||||
// content::NotificationObserver implementation.
|
||||
virtual void Observe(int type,
|
||||
const content::NotificationSource& source,
|
||||
const content::NotificationDetails& details) OVERRIDE {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, type);
|
||||
|
||||
WebContents* web_contents = content::Source<WebContents>(source).ptr();
|
||||
int render_process_id = web_contents->GetRenderProcessHost()->GetID();
|
||||
int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
|
||||
|
||||
registrar_->Remove(this,
|
||||
content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED,
|
||||
content::Source<WebContents>(web_contents));
|
||||
registered_web_contents_.erase(web_contents);
|
||||
|
||||
BrowserThread::PostTask(callback_thread_, FROM_HERE, base::Bind(
|
||||
web_contents_closed_callback_, render_process_id, render_view_id));
|
||||
}
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<WebContentsWatcher>;
|
||||
|
||||
virtual ~WebContentsWatcher() {
|
||||
// Must be destroyed on the UI thread due to |registrar_| non thread-safety.
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||
}
|
||||
|
||||
// Lazy-initialized and used on the UI thread to handle web contents
|
||||
// notifications (tab closing).
|
||||
scoped_ptr<content::NotificationRegistrar> registrar_;
|
||||
|
||||
// Keeps track of which WebContent(s) have been registered, in order to avoid
|
||||
// double registrations on |registrar_|
|
||||
std::set<content::WebContents*> registered_web_contents_;
|
||||
|
||||
// Callback used to notify, on the thread specified by |callback_thread_| the
|
||||
// closure of a registered tab.
|
||||
WebContentsClosedCallback web_contents_closed_callback_;
|
||||
content::BrowserThread::ID callback_thread_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebContentsWatcher);
|
||||
};
|
||||
|
||||
CefSpeechRecognitionManagerDelegate
|
||||
::CefSpeechRecognitionManagerDelegate() {
|
||||
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
||||
filter_profanities_ =
|
||||
command_line.HasSwitch(switches::kEnableProfanityFilter);
|
||||
}
|
||||
|
||||
CefSpeechRecognitionManagerDelegate
|
||||
::~CefSpeechRecognitionManagerDelegate() {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::WebContentsClosedCallback(
|
||||
int render_process_id, int render_view_id) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
|
||||
SpeechRecognitionManager* manager = SpeechRecognitionManager::GetInstance();
|
||||
// |manager| becomes NULL if a browser shutdown happens between the post of
|
||||
// this task (from the UI thread) and this call (on the IO thread). In this
|
||||
// case we just return.
|
||||
if (!manager)
|
||||
return;
|
||||
|
||||
manager->AbortAllSessionsForRenderView(render_process_id, render_view_id);
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionStart(
|
||||
int session_id) {
|
||||
const content::SpeechRecognitionSessionContext& context =
|
||||
SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
|
||||
|
||||
// Register callback to auto abort session on tab closure.
|
||||
// |web_contents_watcher_| is lazyly istantiated on the first call.
|
||||
if (!web_contents_watcher_.get()) {
|
||||
web_contents_watcher_ = new WebContentsWatcher(
|
||||
base::Bind(
|
||||
&CefSpeechRecognitionManagerDelegate::WebContentsClosedCallback,
|
||||
base::Unretained(this)),
|
||||
BrowserThread::IO);
|
||||
}
|
||||
web_contents_watcher_->Watch(context.render_process_id,
|
||||
context.render_view_id);
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioStart(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnEnvironmentEstimationComplete(
|
||||
int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnSoundStart(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnSoundEnd(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioEnd(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionResults(
|
||||
int session_id, const content::SpeechRecognitionResults& result) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionError(
|
||||
int session_id, const content::SpeechRecognitionError& error) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
|
||||
int session_id, float volume, float noise_volume) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::OnRecognitionEnd(int session_id) {
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::GetDiagnosticInformation(
|
||||
bool* can_report_metrics,
|
||||
std::string* hardware_info) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
}
|
||||
|
||||
void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
|
||||
int session_id,
|
||||
base::Callback<void(bool ask_user, bool is_allowed)> callback) {
|
||||
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
||||
|
||||
const content::SpeechRecognitionSessionContext& context =
|
||||
SpeechRecognitionManager::GetInstance()->GetSessionContext(session_id);
|
||||
|
||||
// Make sure that initiators properly set the |render_process_id| field.
|
||||
DCHECK_NE(context.render_process_id, 0);
|
||||
|
||||
callback.Run(false, true);
|
||||
}
|
||||
|
||||
content::SpeechRecognitionEventListener*
|
||||
CefSpeechRecognitionManagerDelegate::GetEventListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool CefSpeechRecognitionManagerDelegate::FilterProfanities(
|
||||
int render_process_id) {
|
||||
return filter_profanities_;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ class CefSpeechRecognitionManagerDelegate
|
||||
int session_id,
|
||||
base::Callback<void(bool ask_user, bool is_allowed)> callback) OVERRIDE;
|
||||
virtual content::SpeechRecognitionEventListener* GetEventListener() OVERRIDE;
|
||||
virtual bool FilterProfanities(int render_process_id) OVERRIDE;
|
||||
|
||||
private:
|
||||
class WebContentsWatcher;
|
||||
@ -54,6 +55,7 @@ class CefSpeechRecognitionManagerDelegate
|
||||
void WebContentsClosedCallback(int render_process_id, int render_view_id);
|
||||
|
||||
scoped_refptr<WebContentsWatcher> web_contents_watcher_;
|
||||
bool filter_profanities_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefSpeechRecognitionManagerDelegate);
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/debug/trace_event.h"
|
||||
#include "base/time.h"
|
||||
#include "base/time/time.h"
|
||||
|
||||
bool CefBeginTracing(CefRefPtr<CefTraceClient> client,
|
||||
const CefString& categories) {
|
||||
|
@ -130,7 +130,9 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() {
|
||||
std::string(),
|
||||
false,
|
||||
false));
|
||||
storage_->set_http_server_properties(new net::HttpServerPropertiesImpl);
|
||||
storage_->set_http_server_properties(
|
||||
make_scoped_ptr<net::HttpServerProperties>(
|
||||
new net::HttpServerPropertiesImpl));
|
||||
|
||||
net::HttpCache::DefaultBackend* main_backend =
|
||||
new net::HttpCache::DefaultBackend(
|
||||
@ -216,7 +218,7 @@ void CefURLRequestContextGetter::SetCookieStoragePath(
|
||||
// TODO(cef): Move directory creation to the blocking pool instead of
|
||||
// allowing file IO on this thread.
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (file_util::DirectoryExists(path) ||
|
||||
if (base::DirectoryExists(path) ||
|
||||
file_util::CreateDirectory(path)) {
|
||||
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
|
||||
persistent_store =
|
||||
|
@ -95,7 +95,7 @@ void CefWebContentsViewOSR::StoreFocus() {
|
||||
void CefWebContentsViewOSR::RestoreFocus() {
|
||||
}
|
||||
|
||||
WebDropData* CefWebContentsViewOSR::GetDropData() const {
|
||||
content::DropData* CefWebContentsViewOSR::GetDropData() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -121,7 +121,8 @@ bool CefWebContentsViewOSR::GetAllowOverlappingViews() const {
|
||||
|
||||
// RenderViewHostDelegateView methods.
|
||||
|
||||
void CefWebContentsViewOSR::StartDragging(const WebDropData& drop_data,
|
||||
void CefWebContentsViewOSR::StartDragging(
|
||||
const content::DropData& drop_data,
|
||||
WebKit::WebDragOperationsMask allowed_ops,
|
||||
const gfx::ImageSkia& image,
|
||||
const gfx::Vector2d& image_offset,
|
||||
@ -130,11 +131,12 @@ void CefWebContentsViewOSR::StartDragging(const WebDropData& drop_data,
|
||||
web_contents_->SystemDragEnded();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::ShowPopupMenu(const gfx::Rect& bounds,
|
||||
void CefWebContentsViewOSR::ShowPopupMenu(
|
||||
const gfx::Rect& bounds,
|
||||
int item_height,
|
||||
double item_font_size,
|
||||
int selected_item,
|
||||
const std::vector<WebMenuItem>& items,
|
||||
const std::vector<content::MenuItem>& items,
|
||||
bool right_aligned,
|
||||
bool allow_multiple_selection) {
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class CefWebContentsViewOSR : public content::WebContentsViewPort,
|
||||
virtual void SetInitialFocus() OVERRIDE;
|
||||
virtual void StoreFocus() OVERRIDE;
|
||||
virtual void RestoreFocus() OVERRIDE;
|
||||
virtual WebDropData* GetDropData() const OVERRIDE;
|
||||
virtual content::DropData* GetDropData() const OVERRIDE;
|
||||
virtual gfx::Rect GetViewBounds() const OVERRIDE;
|
||||
#if defined(OS_MACOSX)
|
||||
virtual bool IsEventTracking() const OVERRIDE;
|
||||
@ -58,16 +58,18 @@ class CefWebContentsViewOSR : public content::WebContentsViewPort,
|
||||
#endif
|
||||
|
||||
// RenderViewHostDelegateView methods.
|
||||
virtual void StartDragging(const WebDropData& drop_data,
|
||||
virtual void StartDragging(
|
||||
const content::DropData& drop_data,
|
||||
WebKit::WebDragOperationsMask allowed_ops,
|
||||
const gfx::ImageSkia& image,
|
||||
const gfx::Vector2d& image_offset,
|
||||
const content::DragEventSourceInfo& event_info) OVERRIDE;
|
||||
virtual void ShowPopupMenu(const gfx::Rect& bounds,
|
||||
virtual void ShowPopupMenu(
|
||||
const gfx::Rect& bounds,
|
||||
int item_height,
|
||||
double item_font_size,
|
||||
int selected_item,
|
||||
const std::vector<WebMenuItem>& items,
|
||||
const std::vector<content::MenuItem>& items,
|
||||
bool right_aligned,
|
||||
bool allow_multiple_selection) OVERRIDE;
|
||||
|
||||
|
@ -14,13 +14,13 @@ namespace {
|
||||
|
||||
void PluginsCallbackImpl(
|
||||
CefRefPtr<CefWebPluginInfoVisitor> visitor,
|
||||
const std::vector<webkit::WebPluginInfo>& all_plugins) {
|
||||
const std::vector<content::WebPluginInfo>& all_plugins) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
int count = 0;
|
||||
int total = static_cast<int>(all_plugins.size());
|
||||
|
||||
std::vector<webkit::WebPluginInfo>::const_iterator it = all_plugins.begin();
|
||||
std::vector<content::WebPluginInfo>::const_iterator it = all_plugins.begin();
|
||||
for (; it != all_plugins.end(); ++it, ++count) {
|
||||
CefRefPtr<CefWebPluginInfoImpl> info(new CefWebPluginInfoImpl(*it));
|
||||
if (!visitor->Visit(info.get(), count, total))
|
||||
@ -34,7 +34,7 @@ void PluginsCallbackImpl(
|
||||
// CefWebPluginInfoImpl
|
||||
|
||||
CefWebPluginInfoImpl::CefWebPluginInfoImpl(
|
||||
const webkit::WebPluginInfo& plugin_info)
|
||||
const content::WebPluginInfo& plugin_info)
|
||||
: plugin_info_(plugin_info) {
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_web_plugin.h"
|
||||
#include "webkit/plugins/webplugininfo.h"
|
||||
#include "content/public/common/webplugininfo.h"
|
||||
|
||||
class CefWebPluginInfoImpl : public CefWebPluginInfo {
|
||||
public:
|
||||
explicit CefWebPluginInfoImpl(const webkit::WebPluginInfo& plugin_info);
|
||||
explicit CefWebPluginInfoImpl(const content::WebPluginInfo& plugin_info);
|
||||
|
||||
virtual CefString GetName() OVERRIDE;
|
||||
virtual CefString GetPath() OVERRIDE;
|
||||
@ -19,7 +19,7 @@ class CefWebPluginInfoImpl : public CefWebPluginInfo {
|
||||
virtual CefString GetDescription() OVERRIDE;
|
||||
|
||||
private:
|
||||
webkit::WebPluginInfo plugin_info_;
|
||||
content::WebPluginInfo plugin_info_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefWebPluginInfoImpl);
|
||||
};
|
||||
|
Reference in New Issue
Block a user