Update to Chromium revision d7d5682a (#367535)
This commit is contained in:
parent
12f19e3a33
commit
d2372c3d11
|
@ -7,5 +7,5 @@
|
|||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'c78c0ad7cca1b37761b488e9499d619b21c8016d',
|
||||
'chromium_checkout': 'd7d5682a0953188e49a31505303665ff916c1080',
|
||||
}
|
||||
|
|
7
cef.gyp
7
cef.gyp
|
@ -1382,6 +1382,8 @@
|
|||
'<(DEPTH)/chrome/browser/plugins/plugin_finder.h',
|
||||
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.cc',
|
||||
'<(DEPTH)/chrome/browser/plugins/plugin_metadata.h',
|
||||
'<(DEPTH)/chrome/renderer/plugins/power_saver_info.cc',
|
||||
'<(DEPTH)/chrome/renderer/plugins/power_saver_info.h',
|
||||
'<(DEPTH)/components/nacl/common/nacl_constants.cc',
|
||||
'<(DEPTH)/components/nacl/common/nacl_constants.h',
|
||||
# Include sources for preferences support.
|
||||
|
@ -1425,8 +1427,13 @@
|
|||
'libcef/browser/native/file_dialog_runner_win.h',
|
||||
'libcef/browser/native/javascript_dialog_runner_win.cc',
|
||||
'libcef/browser/native/javascript_dialog_runner_win.h',
|
||||
'libcef/browser/native/menu_2.cc',
|
||||
'libcef/browser/native/menu_2.h',
|
||||
'libcef/browser/native/menu_runner_win.cc',
|
||||
'libcef/browser/native/menu_runner_win.h',
|
||||
'libcef/browser/native/menu_wrapper.h',
|
||||
'libcef/browser/native/native_menu_win.cc',
|
||||
'libcef/browser/native/native_menu_win.h',
|
||||
'libcef/browser/osr/browser_platform_delegate_osr_win.cc',
|
||||
'libcef/browser/osr/browser_platform_delegate_osr_win.h',
|
||||
'libcef/browser/osr/render_widget_host_view_osr_win.cc',
|
||||
|
|
|
@ -32,14 +32,6 @@
|
|||
#define CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(BUILDING_CEF_SHARED)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/basictypes.h"
|
||||
#else // !BUILDING_CEF_SHARED
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
|
||||
#include <limits.h> // For UINT_MAX
|
||||
#include <stddef.h> // For size_t
|
||||
|
||||
|
@ -72,8 +64,6 @@ typedef int int32;
|
|||
typedef unsigned int uint32;
|
||||
#endif
|
||||
|
||||
#endif // !BUILDING_CEF_SHARED
|
||||
|
||||
// UTF-16 character type.
|
||||
// This should be kept synchronized with base/strings/string16.h
|
||||
#ifndef char16
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
// Annotate a function indicating the caller must examine the return value.
|
||||
// Use like:
|
||||
// int foo() WARN_UNUSED_RESULT;
|
||||
// To explicitly ignore a result, see |ignore_result()| in <base/basictypes.h>.
|
||||
// To explicitly ignore a result, see |ignore_result()| in <base/macros.h>.
|
||||
#ifndef WARN_UNUSED_RESULT
|
||||
#if defined(COMPILER_GCC)
|
||||
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "libcef/browser/browser_context_impl.h"
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context_proxy.h"
|
||||
#include "libcef/browser/context.h"
|
||||
|
@ -368,8 +369,8 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
|
|||
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
|
||||
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
|
||||
protocol_handlers,
|
||||
proxy_config_service.Pass(),
|
||||
request_interceptors.Pass());
|
||||
std::move(proxy_config_service),
|
||||
std::move(request_interceptors));
|
||||
resource_context()->set_url_request_context_getter(url_request_getter_.get());
|
||||
return url_request_getter_.get();
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
|
|||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::CreateInternal(settings, client, NULL, info, opener,
|
||||
request_context,
|
||||
platform_delegate.Pass());
|
||||
std::move(platform_delegate));
|
||||
if (browser.get() && !url.empty()) {
|
||||
browser->LoadURL(CefFrameHostImpl::kMainFrameId, url, content::Referrer(),
|
||||
ui::PAGE_TRANSITION_TYPED, std::string());
|
||||
|
@ -343,7 +343,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
|
|||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
new CefBrowserHostImpl(settings, client, web_contents, browser_info,
|
||||
opener, request_context,
|
||||
platform_delegate.Pass());
|
||||
std::move(platform_delegate));
|
||||
if (!browser->CreateHostWindow())
|
||||
return nullptr;
|
||||
|
||||
|
@ -654,7 +654,7 @@ void CefBrowserHostImpl::StartDownload(const CefString& url) {
|
|||
|
||||
scoped_ptr<content::DownloadUrlParameters> params(
|
||||
content::DownloadUrlParameters::FromWebContents(web_contents(), gurl));
|
||||
manager->DownloadUrl(params.Pass());
|
||||
manager->DownloadUrl(std::move(params));
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::Print() {
|
||||
|
@ -1947,9 +1947,9 @@ void CefBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
|
|||
}
|
||||
|
||||
bool CefBrowserHostImpl::AddMessageToConsole(content::WebContents* source,
|
||||
int32 level,
|
||||
int32_t level,
|
||||
const base::string16& message,
|
||||
int32 line_no,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||
|
@ -2118,7 +2118,7 @@ void CefBrowserHostImpl::WebContentsCreated(
|
|||
|
||||
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
|
||||
settings, client, new_contents, info, opener, request_context,
|
||||
platform_delegate.Pass());
|
||||
std::move(platform_delegate));
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidNavigateMainFramePostCommit(
|
||||
|
@ -2133,7 +2133,7 @@ content::JavaScriptDialogManager*
|
|||
if (!javascript_dialog_manager_.get()) {
|
||||
javascript_dialog_manager_.reset(
|
||||
new CefJavaScriptDialogManager(this,
|
||||
platform_delegate_->CreateJavaScriptDialogRunner().Pass()));
|
||||
platform_delegate_->CreateJavaScriptDialogRunner()));
|
||||
}
|
||||
return javascript_dialog_manager_.get();
|
||||
}
|
||||
|
@ -2152,7 +2152,7 @@ bool CefBrowserHostImpl::HandleContextMenu(
|
|||
if (!menu_manager_.get()) {
|
||||
menu_manager_.reset(
|
||||
new CefMenuManager(this,
|
||||
platform_delegate_->CreateMenuRunner().Pass()));
|
||||
platform_delegate_->CreateMenuRunner()));
|
||||
}
|
||||
return menu_manager_->CreateContextMenu(params);
|
||||
}
|
||||
|
@ -2606,7 +2606,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
|||
browser_info_(browser_info),
|
||||
opener_(kNullWindowHandle),
|
||||
request_context_(request_context),
|
||||
platform_delegate_(platform_delegate.Pass()),
|
||||
platform_delegate_(std::move(platform_delegate)),
|
||||
is_loading_(false),
|
||||
can_go_back_(false),
|
||||
can_go_forward_(false),
|
||||
|
@ -2871,6 +2871,6 @@ void CefBrowserHostImpl::EnsureFileDialogManager() {
|
|||
if (!file_dialog_manager_.get()) {
|
||||
file_dialog_manager_.reset(
|
||||
new CefFileDialogManager(this,
|
||||
platform_delegate_->CreateFileDialogRunner().Pass()));
|
||||
platform_delegate_->CreateFileDialogRunner()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,9 +304,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
void UpdateTargetURL(content::WebContents* source,
|
||||
const GURL& url) override;
|
||||
bool AddMessageToConsole(content::WebContents* source,
|
||||
int32 level,
|
||||
int32_t level,
|
||||
const base::string16& message,
|
||||
int32 line_no,
|
||||
int32_t line_no,
|
||||
const base::string16& source_id) override;
|
||||
void BeforeUnloadFired(content::WebContents* source,
|
||||
bool proceed,
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
@ -148,7 +150,7 @@ void CefBrowserInfoManager::OnCreateWindow(
|
|||
pending_popup->opener_frame_id = params.opener_render_frame_id;
|
||||
pending_popup->target_url = params.target_url;
|
||||
pending_popup->target_frame_name = params.frame_name;
|
||||
PushPendingPopup(pending_popup.Pass());
|
||||
PushPendingPopup(std::move(pending_popup));
|
||||
}
|
||||
|
||||
bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
@ -282,7 +284,7 @@ void CefBrowserInfoManager::ShouldCreateWebContents(
|
|||
|
||||
pending_popup->step =
|
||||
CefBrowserInfoManager::PendingPopup::SHOULD_CREATE_WEB_CONTENTS;
|
||||
PushPendingPopup(pending_popup.Pass());
|
||||
PushPendingPopup(std::move(pending_popup));
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::WebContentsCreated(
|
||||
|
@ -306,7 +308,7 @@ void CefBrowserInfoManager::WebContentsCreated(
|
|||
|
||||
settings = pending_popup->settings;
|
||||
client = pending_popup->client;
|
||||
platform_delegate = pending_popup->platform_delegate.Pass();
|
||||
platform_delegate = std::move(pending_popup->platform_delegate);
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
|
@ -358,7 +360,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
|||
pending->render_view_routing_id = render_view_routing_id;
|
||||
pending->render_frame_routing_id = render_frame_routing_id;
|
||||
pending->reply_msg = reply_msg;
|
||||
pending_new_browser_info_list_.push_back(pending.Pass());
|
||||
pending_new_browser_info_list_.push_back(std::move(pending));
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::RemoveBrowserInfo(
|
||||
|
@ -448,12 +450,12 @@ void CefBrowserInfoManager::FilterPendingPopupURL(
|
|||
DCHECK(rph);
|
||||
rph->FilterURL(false, &pending_popup->target_url);
|
||||
|
||||
GetInstance()->PushPendingPopup(pending_popup.Pass());
|
||||
GetInstance()->PushPendingPopup(std::move(pending_popup));
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::PushPendingPopup(scoped_ptr<PendingPopup> popup) {
|
||||
base::AutoLock lock_scope(pending_popup_lock_);
|
||||
pending_popup_list_.push_back(popup.Pass());
|
||||
pending_popup_list_.push_back(std::move(popup));
|
||||
}
|
||||
|
||||
scoped_ptr<CefBrowserInfoManager::PendingPopup>
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libcef/browser/browser_main.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
|
@ -155,7 +157,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||
int port;
|
||||
if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) {
|
||||
devtools_delegate_ =
|
||||
new CefDevToolsDelegate(static_cast<uint16>(port));
|
||||
new CefDevToolsDelegate(static_cast<uint16_t>(port));
|
||||
} else {
|
||||
LOG(WARNING) << "Invalid http debugger port number " << port;
|
||||
}
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/memory/scoped_vector.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/browser_main_parts.h"
|
||||
#include "net/url_request/url_request_context_getter.h"
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ void CefBrowserMessageFilter::OnCreateWindow(
|
|||
delete reply_msg;
|
||||
}
|
||||
|
||||
void CefBrowserMessageFilter::OnFrameFocused(int32 render_frame_routing_id) {
|
||||
void CefBrowserMessageFilter::OnFrameFocused(int32_t render_frame_routing_id) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserMessageFilter::OnFrameFocused, this,
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ipc/ipc_channel_proxy.h"
|
||||
#include "ipc/message_filter.h"
|
||||
|
||||
|
@ -41,7 +44,7 @@ class CefBrowserMessageFilter : public IPC::MessageFilter {
|
|||
IPC::Message* reply_msg);
|
||||
void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params,
|
||||
IPC::Message* reply_msg);
|
||||
void OnFrameFocused(int32 render_frame_routing_id);
|
||||
void OnFrameFocused(int32_t render_frame_routing_id);
|
||||
|
||||
content::RenderProcessHost* host_;
|
||||
IPC::Sender* sender_;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_
|
||||
#pragma once
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
|
||||
// Class used to process events on the current message loop.
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "build/build_config.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "libcef/browser/native/browser_platform_delegate_native_win.h"
|
||||
#include "libcef/browser/osr/browser_platform_delegate_osr_win.h"
|
||||
|
@ -35,13 +39,13 @@ scoped_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
|
|||
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate) {
|
||||
#if defined(OS_WIN)
|
||||
return make_scoped_ptr(
|
||||
new CefBrowserPlatformDelegateOsrWin(native_delegate.Pass()));
|
||||
new CefBrowserPlatformDelegateOsrWin(std::move(native_delegate)));
|
||||
#elif defined(OS_MACOSX)
|
||||
return make_scoped_ptr(
|
||||
new CefBrowserPlatformDelegateOsrMac(native_delegate.Pass()));
|
||||
new CefBrowserPlatformDelegateOsrMac(std::move(native_delegate)));
|
||||
#elif defined(OS_LINUX)
|
||||
return make_scoped_ptr(
|
||||
new CefBrowserPlatformDelegateOsrLinux(native_delegate.Pass()));
|
||||
new CefBrowserPlatformDelegateOsrLinux(std::move(native_delegate)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -56,7 +60,7 @@ scoped_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
|
|||
CreateNativeDelegate(window_info);
|
||||
if (window_info.windowless_rendering_enabled &&
|
||||
client->GetRenderHandler().get()) {
|
||||
return CreateOSRDelegate(native_delegate.Pass());
|
||||
return CreateOSRDelegate(std::move(native_delegate));
|
||||
}
|
||||
return native_delegate.Pass();
|
||||
return std::move(native_delegate);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "libcef/browser/browser_urlrequest_impl.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
|
@ -228,7 +229,7 @@ class CefBrowserURLRequest::Context
|
|||
response_writer.reset(
|
||||
new CefURLFetcherResponseWriter(url_request_, task_runner_));
|
||||
}
|
||||
fetcher_->SaveResponseWithWriter(response_writer.Pass());
|
||||
fetcher_->SaveResponseWithWriter(std::move(response_writer));
|
||||
|
||||
fetcher_->Start();
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
|
|||
void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler(
|
||||
chrome::HostDesktopType host_desktop_type,
|
||||
const std::string& ip,
|
||||
uint16 port) {
|
||||
uint16_t port) {
|
||||
}
|
||||
|
||||
unsigned int ChromeBrowserProcessStub::AddRefModule() {
|
||||
|
|
|
@ -55,7 +55,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
|||
void CreateDevToolsHttpProtocolHandler(
|
||||
chrome::HostDesktopType host_desktop_type,
|
||||
const std::string& ip,
|
||||
uint16 port) override;
|
||||
uint16_t port) override;
|
||||
unsigned int AddRefModule() override;
|
||||
unsigned int ReleaseModule() override;
|
||||
bool IsShuttingDown() override;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "libcef/browser/content_browser_client.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
|
@ -515,7 +516,7 @@ net::URLRequestContextGetter* CefContentBrowserClient::CreateRequestContext(
|
|||
|
||||
return context->CreateRequestContext(
|
||||
protocol_handlers,
|
||||
request_interceptors.Pass());
|
||||
std::move(request_interceptors));
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter*
|
||||
|
@ -531,7 +532,7 @@ CefContentBrowserClient::CreateRequestContextForStoragePartition(
|
|||
partition_path,
|
||||
in_memory,
|
||||
protocol_handlers,
|
||||
request_interceptors.Pass());
|
||||
std::move(request_interceptors));
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::IsHandledURL(const GURL& url) {
|
||||
|
@ -847,7 +848,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
|||
true);
|
||||
throttles.push_back(throttle);
|
||||
|
||||
return throttles.Pass();
|
||||
return throttles;
|
||||
}
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
|
|
|
@ -13,9 +13,10 @@
|
|||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
// governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/devtools_delegate.h"
|
||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/md5.h"
|
||||
#include "base/rand_util.h"
|
||||
|
@ -41,7 +42,7 @@ const int kBackLog = 10;
|
|||
class TCPServerSocketFactory
|
||||
: public devtools_http_handler::DevToolsHttpHandler::ServerSocketFactory {
|
||||
public:
|
||||
TCPServerSocketFactory(const std::string& address, uint16 port)
|
||||
TCPServerSocketFactory(const std::string& address, uint16_t port)
|
||||
: address_(address), port_(port) {
|
||||
}
|
||||
|
||||
|
@ -57,13 +58,13 @@ class TCPServerSocketFactory
|
|||
}
|
||||
|
||||
std::string address_;
|
||||
uint16 port_;
|
||||
uint16_t port_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
|
||||
};
|
||||
|
||||
scoped_ptr<devtools_http_handler::DevToolsHttpHandler::ServerSocketFactory>
|
||||
CreateSocketFactory(uint16 port) {
|
||||
CreateSocketFactory(uint16_t port) {
|
||||
return scoped_ptr<
|
||||
devtools_http_handler::DevToolsHttpHandler::ServerSocketFactory>(
|
||||
new TCPServerSocketFactory("127.0.0.1", port));
|
||||
|
@ -73,7 +74,7 @@ scoped_ptr<devtools_http_handler::DevToolsHttpHandler::ServerSocketFactory>
|
|||
|
||||
// CefDevToolsDelegate
|
||||
|
||||
CefDevToolsDelegate::CefDevToolsDelegate(uint16 port) {
|
||||
CefDevToolsDelegate::CefDevToolsDelegate(uint16_t port) {
|
||||
devtools_http_handler_.reset(new devtools_http_handler::DevToolsHttpHandler(
|
||||
CreateSocketFactory(port),
|
||||
std::string(),
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "components/devtools_http_handler/devtools_http_handler.h"
|
||||
|
@ -24,7 +25,7 @@ class RenderViewHost;
|
|||
class CefDevToolsDelegate :
|
||||
public devtools_http_handler::DevToolsHttpHandlerDelegate {
|
||||
public:
|
||||
explicit CefDevToolsDelegate(uint16 port);
|
||||
explicit CefDevToolsDelegate(uint16_t port);
|
||||
~CefDevToolsDelegate() override;
|
||||
|
||||
// Stops http server.
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
#include "libcef/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <utility>
|
||||
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/values.h"
|
||||
#include "cef/libcef/common/extensions/api/streams_private.h"
|
||||
|
@ -64,7 +67,7 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler(
|
|||
int tab_id,
|
||||
scoped_ptr<content::StreamInfo> stream,
|
||||
const std::string& view_id,
|
||||
int64 expected_content_size,
|
||||
int64_t expected_content_size,
|
||||
bool embedded,
|
||||
int render_process_id,
|
||||
int render_frame_id) {
|
||||
|
@ -82,9 +85,9 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler(
|
|||
GURL handler_url(Extension::GetBaseURLFromExtensionId(extension_id).spec() +
|
||||
handler->handler_url());
|
||||
scoped_ptr<StreamContainer> stream_container(new StreamContainer(
|
||||
stream.Pass(), tab_id, embedded, handler_url, extension_id));
|
||||
std::move(stream), tab_id, embedded, handler_url, extension_id));
|
||||
MimeHandlerStreamManager::Get(browser_context_)
|
||||
->AddStream(view_id, stream_container.Pass(), render_process_id,
|
||||
->AddStream(view_id, std::move(stream_container), render_process_id,
|
||||
render_frame_id);
|
||||
return;
|
||||
}
|
||||
|
@ -114,7 +117,7 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler(
|
|||
streams_private::OnExecuteMimeTypeHandler::Create(info)));
|
||||
|
||||
EventRouter::Get(browser_context_)
|
||||
->DispatchEventToExtension(extension_id, event.Pass());
|
||||
->DispatchEventToExtension(extension_id, std::move(event));
|
||||
|
||||
GURL url = stream->handle->GetURL();
|
||||
streams_[extension_id][url] = make_linked_ptr(stream->handle.release());
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
@ -41,7 +43,7 @@ class StreamsPrivateAPI : public BrowserContextKeyedAPI,
|
|||
int tab_id,
|
||||
scoped_ptr<content::StreamInfo> stream,
|
||||
const std::string& view_id,
|
||||
int64 expected_content_size,
|
||||
int64_t expected_content_size,
|
||||
bool embedded,
|
||||
int render_process_id,
|
||||
int render_frame_id);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "extensions/browser/component_extension_resource_manager.h"
|
||||
|
||||
|
|
|
@ -4,10 +4,14 @@
|
|||
|
||||
#include "libcef/browser/extensions/event_router_forwarder.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/values.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "extensions/browser/event_router.h"
|
||||
#include "url/gurl.h"
|
||||
|
@ -27,8 +31,8 @@ void EventRouterForwarder::BroadcastEventToRenderers(
|
|||
const std::string& event_name,
|
||||
scoped_ptr<base::ListValue> event_args,
|
||||
const GURL& event_url) {
|
||||
HandleEvent(std::string(), histogram_value, event_name, event_args.Pass(), 0,
|
||||
true, event_url);
|
||||
HandleEvent(std::string(), histogram_value, event_name, std::move(event_args),
|
||||
0, true, event_url);
|
||||
}
|
||||
|
||||
void EventRouterForwarder::DispatchEventToRenderers(
|
||||
|
@ -40,7 +44,7 @@ void EventRouterForwarder::DispatchEventToRenderers(
|
|||
const GURL& event_url) {
|
||||
if (!profile)
|
||||
return;
|
||||
HandleEvent(std::string(), histogram_value, event_name, event_args.Pass(),
|
||||
HandleEvent(std::string(), histogram_value, event_name, std::move(event_args),
|
||||
profile, use_profile_to_restrict_events, event_url);
|
||||
}
|
||||
|
||||
|
@ -50,8 +54,8 @@ void EventRouterForwarder::BroadcastEventToExtension(
|
|||
const std::string& event_name,
|
||||
scoped_ptr<base::ListValue> event_args,
|
||||
const GURL& event_url) {
|
||||
HandleEvent(extension_id, histogram_value, event_name, event_args.Pass(), 0,
|
||||
true, event_url);
|
||||
HandleEvent(extension_id, histogram_value, event_name, std::move(event_args),
|
||||
0, true, event_url);
|
||||
}
|
||||
|
||||
void EventRouterForwarder::DispatchEventToExtension(
|
||||
|
@ -64,7 +68,7 @@ void EventRouterForwarder::DispatchEventToExtension(
|
|||
const GURL& event_url) {
|
||||
if (!profile)
|
||||
return;
|
||||
HandleEvent(extension_id, histogram_value, event_name, event_args.Pass(),
|
||||
HandleEvent(extension_id, histogram_value, event_name, std::move(event_args),
|
||||
profile, use_profile_to_restrict_events, event_url);
|
||||
}
|
||||
|
||||
|
@ -92,7 +96,7 @@ void EventRouterForwarder::HandleEvent(const std::string& extension_id,
|
|||
}
|
||||
if (profile) {
|
||||
CallEventRouter(profile, extension_id, histogram_value, event_name,
|
||||
event_args.Pass(),
|
||||
std::move(event_args),
|
||||
use_profile_to_restrict_events ? profile : NULL, event_url);
|
||||
} else {
|
||||
std::vector<CefBrowserContextImpl*> profiles(
|
||||
|
@ -101,7 +105,7 @@ void EventRouterForwarder::HandleEvent(const std::string& extension_id,
|
|||
scoped_ptr<base::ListValue> per_profile_event_args(
|
||||
event_args->DeepCopy());
|
||||
CallEventRouter(profiles[i], extension_id, histogram_value, event_name,
|
||||
per_profile_event_args.Pass(),
|
||||
std::move(per_profile_event_args),
|
||||
use_profile_to_restrict_events ? profiles[i] : NULL,
|
||||
event_url);
|
||||
}
|
||||
|
@ -117,14 +121,14 @@ void EventRouterForwarder::CallEventRouter(
|
|||
content::BrowserContext* restrict_to_profile,
|
||||
const GURL& event_url) {
|
||||
scoped_ptr<Event> event(
|
||||
new Event(histogram_value, event_name, event_args.Pass()));
|
||||
new Event(histogram_value, event_name, std::move(event_args)));
|
||||
event->restrict_to_browser_context = restrict_to_profile;
|
||||
event->event_url = event_url;
|
||||
if (extension_id.empty()) {
|
||||
extensions::EventRouter::Get(profile)->BroadcastEvent(event.Pass());
|
||||
extensions::EventRouter::Get(profile)->BroadcastEvent(std::move(event));
|
||||
} else {
|
||||
extensions::EventRouter::Get(profile)
|
||||
->DispatchEventToExtension(extension_id, event.Pass());
|
||||
->DispatchEventToExtension(extension_id, std::move(event));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/values.h"
|
||||
#include "extensions/browser/extension_event_histogram_value.h"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "libcef/browser/extensions/extensions_browser_client.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/extensions/component_extension_resource_manager.h"
|
||||
#include "libcef/browser/extensions/extension_system_factory.h"
|
||||
|
@ -204,7 +206,7 @@ void CefExtensionsBrowserClient::BroadcastEventToRenderers(
|
|||
const std::string& event_name,
|
||||
scoped_ptr<base::ListValue> args) {
|
||||
event_router_forwarder_->BroadcastEventToRenderers(
|
||||
histogram_value, event_name, args.Pass(), GURL());
|
||||
histogram_value, event_name, std::move(args), GURL());
|
||||
}
|
||||
|
||||
net::NetLog* CefExtensionsBrowserClient::GetNetLog() {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "libcef/browser/extensions/pdf_extension_util.h"
|
||||
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "grit/cef_resources.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
|
@ -16,12 +15,6 @@ namespace {
|
|||
|
||||
// Tags in the manifest to be replaced.
|
||||
const char kNameTag[] = "<NAME>";
|
||||
const char kIndexTag[] = "<INDEX>";
|
||||
|
||||
// The index html pages to load for the material and non-material version of
|
||||
// the viewer.
|
||||
const char kRegularIndex[] = "index.html";
|
||||
const char kMaterialIndex[] = "index-material.html";
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -43,10 +36,6 @@ std::string GetManifest() {
|
|||
base::ReplaceFirstSubstringAfterOffset(
|
||||
&manifest_contents, 0, kNameTag, kPdfPluginName);
|
||||
|
||||
DCHECK(manifest_contents.find(kIndexTag) != std::string::npos);
|
||||
std::string index = switches::PdfMaterialUIEnabled() ?
|
||||
kMaterialIndex : kRegularIndex;
|
||||
base::ReplaceSubstringsAfterOffset(&manifest_contents, 0, kIndexTag, index);
|
||||
return manifest_contents;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "libcef/browser/file_dialog_manager.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "include/cef_dialog_handler.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
@ -153,7 +155,7 @@ CefFileDialogManager::CefFileDialogManager(
|
|||
scoped_ptr<CefFileDialogRunner> runner)
|
||||
: content::WebContentsObserver(browser->web_contents()),
|
||||
browser_(browser),
|
||||
runner_(runner.Pass()),
|
||||
runner_(std::move(runner)),
|
||||
file_chooser_pending_(false),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(web_contents());
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/javascript_dialog_manager.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
|
@ -70,7 +73,7 @@ CefJavaScriptDialogManager::CefJavaScriptDialogManager(
|
|||
CefBrowserHostImpl* browser,
|
||||
scoped_ptr<CefJavaScriptDialogRunner> runner)
|
||||
: browser_(browser),
|
||||
runner_(runner.Pass()),
|
||||
runner_(std::move(runner)),
|
||||
dialog_running_(false),
|
||||
weak_ptr_factory_(this) {
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libcef/browser/menu_manager.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/context_menu_params_impl.h"
|
||||
#include "libcef/browser/menu_runner.h"
|
||||
|
@ -91,7 +93,7 @@ CefMenuManager::CefMenuManager(CefBrowserHostImpl* browser,
|
|||
scoped_ptr<CefMenuRunner> runner)
|
||||
: content::WebContentsObserver(browser->web_contents()),
|
||||
browser_(browser),
|
||||
runner_(runner.Pass()),
|
||||
runner_(std::move(runner)),
|
||||
custom_menu_callback_(NULL),
|
||||
weak_ptr_factory_(this) {
|
||||
DCHECK(web_contents());
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
// 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/native/menu_2.h"
|
||||
|
||||
#include "ui/base/models/menu_model.h"
|
||||
#include "ui/views/controls/menu/menu_listener.h"
|
||||
|
||||
namespace views {
|
||||
|
||||
Menu2::Menu2(ui::MenuModel* model)
|
||||
: model_(model),
|
||||
wrapper_(MenuWrapper::CreateWrapper(model)) {
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
Menu2::~Menu2() {}
|
||||
|
||||
HMENU Menu2::GetNativeMenu() const {
|
||||
return wrapper_->GetNativeMenu();
|
||||
}
|
||||
|
||||
void Menu2::RunMenuAt(const gfx::Point& point, Alignment alignment) {
|
||||
wrapper_->RunMenuAt(point, alignment);
|
||||
}
|
||||
|
||||
void Menu2::RunContextMenuAt(const gfx::Point& point) {
|
||||
RunMenuAt(point, ALIGN_TOPLEFT);
|
||||
}
|
||||
|
||||
void Menu2::CancelMenu() {
|
||||
wrapper_->CancelMenu();
|
||||
}
|
||||
|
||||
void Menu2::Rebuild() {
|
||||
wrapper_->Rebuild(NULL);
|
||||
}
|
||||
|
||||
void Menu2::UpdateStates() {
|
||||
wrapper_->UpdateStates();
|
||||
}
|
||||
|
||||
MenuWrapper::MenuAction Menu2::GetMenuAction() const {
|
||||
return wrapper_->GetMenuAction();
|
||||
}
|
||||
|
||||
void Menu2::AddMenuListener(MenuListener* listener) {
|
||||
wrapper_->AddMenuListener(listener);
|
||||
}
|
||||
|
||||
void Menu2::RemoveMenuListener(MenuListener* listener) {
|
||||
wrapper_->RemoveMenuListener(listener);
|
||||
}
|
||||
|
||||
void Menu2::SetMinimumWidth(int width) {
|
||||
wrapper_->SetMinimumWidth(width);
|
||||
}
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,96 @@
|
|||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_NATIVE_MENU_2_H_
|
||||
#define CEF_LIBCEF_BROWSER_NATIVE_MENU_2_H_
|
||||
|
||||
#include "libcef/browser/native/menu_wrapper.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
namespace gfx {
|
||||
class Point;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
class MenuModel;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
|
||||
// A menu. Populated from a model, and relies on a delegate to execute commands.
|
||||
//
|
||||
// WARNING: do NOT create and use Menu2 on the stack. Menu2 notifies the model
|
||||
// of selection AFTER a delay. This means that if use a Menu2 on the stack
|
||||
// ActivatedAt is never invoked.
|
||||
class Menu2 {
|
||||
public:
|
||||
// How the menu is aligned relative to the point it is shown at.
|
||||
// The alignment is reversed by menu if text direction is right to left.
|
||||
enum Alignment {
|
||||
ALIGN_TOPLEFT,
|
||||
ALIGN_TOPRIGHT
|
||||
};
|
||||
|
||||
// Creates a new menu populated with the contents of |model|.
|
||||
// WARNING: this populates the menu on construction by invoking methods on
|
||||
// the model. As such, it is typically not safe to use this as the model
|
||||
// from the constructor. EG:
|
||||
// MyClass : menu_(this) {}
|
||||
// is likely to have problems.
|
||||
explicit Menu2(ui::MenuModel* model);
|
||||
virtual ~Menu2();
|
||||
|
||||
// Runs the menu at the specified point. This method blocks until done.
|
||||
// RunContextMenuAt is the same, but the alignment is the default for a
|
||||
// context menu.
|
||||
void RunMenuAt(const gfx::Point& point, Alignment alignment);
|
||||
void RunContextMenuAt(const gfx::Point& point);
|
||||
|
||||
// Cancels the active menu.
|
||||
void CancelMenu();
|
||||
|
||||
// Called when the model supplying data to this menu has changed, and the menu
|
||||
// must be rebuilt.
|
||||
void Rebuild();
|
||||
|
||||
// Called when the states of the menu items in the menu should be refreshed
|
||||
// from the model.
|
||||
void UpdateStates();
|
||||
|
||||
// For submenus.
|
||||
HMENU GetNativeMenu() const;
|
||||
|
||||
// Get the result of the last call to RunMenuAt to determine whether an
|
||||
// item was selected, the user navigated to a next or previous menu, or
|
||||
// nothing.
|
||||
MenuWrapper::MenuAction GetMenuAction() const;
|
||||
|
||||
// Add a listener to receive a callback when the menu opens.
|
||||
void AddMenuListener(MenuListener* listener);
|
||||
|
||||
// Remove a menu listener.
|
||||
void RemoveMenuListener(MenuListener* listener);
|
||||
|
||||
// Accessors.
|
||||
ui::MenuModel* model() const { return model_; }
|
||||
|
||||
// Sets the minimum width of the menu.
|
||||
void SetMinimumWidth(int width);
|
||||
|
||||
private:
|
||||
|
||||
ui::MenuModel* model_;
|
||||
|
||||
// The object that actually implements the menu.
|
||||
scoped_ptr<MenuWrapper> wrapper_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Menu2);
|
||||
};
|
||||
|
||||
} // namespace views
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_2_H_
|
|
@ -5,10 +5,10 @@
|
|||
#include "libcef/browser/native/menu_runner_win.h"
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/native/menu_2.h"
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
#include "ui/views/controls/menu/menu_2.h"
|
||||
|
||||
CefMenuRunnerWin::CefMenuRunnerWin() {
|
||||
}
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
|
||||
#include "libcef/browser/menu_runner.h"
|
||||
|
||||
#include "libcef/browser/native/native_menu_win.h"
|
||||
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "ui/views/controls/menu/native_menu_win.h"
|
||||
|
||||
class CefMenuRunnerWin : public CefMenuRunner {
|
||||
public:
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
// 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_NATIVE_MENU_WRAPPER_H_
|
||||
#define CEF_LIBCEF_BROWSER_NATIVE_MENU_WRAPPER_H_
|
||||
|
||||
#include "ui/gfx/native_widget_types.h"
|
||||
|
||||
namespace gfx {
|
||||
class Point;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
class MenuModel;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
|
||||
class MenuInsertionDelegateWin;
|
||||
class MenuListener;
|
||||
|
||||
// An interface that wraps an object that implements a menu.
|
||||
class MenuWrapper {
|
||||
public:
|
||||
// All of the possible actions that can result from RunMenuAt.
|
||||
enum MenuAction {
|
||||
MENU_ACTION_NONE, // Menu cancelled, or never opened.
|
||||
MENU_ACTION_SELECTED, // An item was selected.
|
||||
MENU_ACTION_PREVIOUS, // User wants to navigate to the previous menu.
|
||||
MENU_ACTION_NEXT, // User wants to navigate to the next menu.
|
||||
};
|
||||
|
||||
virtual ~MenuWrapper() {}
|
||||
|
||||
// Creates the appropriate instance of this wrapper for the current platform.
|
||||
static MenuWrapper* CreateWrapper(ui::MenuModel* model);
|
||||
|
||||
// Runs the menu at the specified point. This blocks until done.
|
||||
virtual void RunMenuAt(const gfx::Point& point, int alignment) = 0;
|
||||
|
||||
// Cancels the active menu.
|
||||
virtual void CancelMenu() = 0;
|
||||
|
||||
// Called when the model supplying data to this menu has changed, and the menu
|
||||
// must be rebuilt.
|
||||
virtual void Rebuild(MenuInsertionDelegateWin* delegate) = 0;
|
||||
|
||||
// Called when the states of the items in the menu must be updated from the
|
||||
// model.
|
||||
virtual void UpdateStates() = 0;
|
||||
|
||||
// Retrieve a native menu handle.
|
||||
virtual HMENU GetNativeMenu() const = 0;
|
||||
|
||||
// Get the result of the last call to RunMenuAt to determine whether an
|
||||
// item was selected, the user navigated to a next or previous menu, or
|
||||
// nothing.
|
||||
virtual MenuAction GetMenuAction() const = 0;
|
||||
|
||||
// Add a listener to receive a callback when the menu opens.
|
||||
virtual void AddMenuListener(MenuListener* listener) = 0;
|
||||
|
||||
// Remove a menu listener.
|
||||
virtual void RemoveMenuListener(MenuListener* listener) = 0;
|
||||
|
||||
// Sets the minimum width of the menu.
|
||||
virtual void SetMinimumWidth(int width) = 0;
|
||||
};
|
||||
|
||||
} // namespace views
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_WRAPPER_H_
|
|
@ -0,0 +1,759 @@
|
|||
// 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/native/native_menu_win.h"
|
||||
|
||||
#include "libcef/browser/native/menu_2.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/win/wrapped_window_proc.h"
|
||||
#include "ui/base/accelerators/accelerator.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/l10n/l10n_util_win.h"
|
||||
#include "ui/base/models/menu_model.h"
|
||||
#include "ui/events/keycodes/keyboard_codes.h"
|
||||
#include "ui/gfx/canvas.h"
|
||||
#include "ui/gfx/font_list.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/gfx/text_utils.h"
|
||||
#include "ui/gfx/win/hwnd_util.h"
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
#include "ui/native_theme/native_theme_win.h"
|
||||
#include "ui/views/controls/menu/menu_config.h"
|
||||
#include "ui/views/controls/menu/menu_insertion_delegate_win.h"
|
||||
#include "ui/views/controls/menu/menu_listener.h"
|
||||
#include "ui/views/layout/layout_constants.h"
|
||||
|
||||
using ui::NativeTheme;
|
||||
|
||||
namespace views {
|
||||
|
||||
// The width of an icon, including the pixels between the icon and
|
||||
// the item label.
|
||||
static const int kIconWidth = 23;
|
||||
// Margins between the top of the item and the label.
|
||||
static const int kItemTopMargin = 3;
|
||||
// Margins between the bottom of the item and the label.
|
||||
static const int kItemBottomMargin = 4;
|
||||
// Margins between the left of the item and the icon.
|
||||
static const int kItemLeftMargin = 4;
|
||||
// The width for displaying the sub-menu arrow.
|
||||
static const int kArrowWidth = 10;
|
||||
|
||||
struct NativeMenuWin::ItemData {
|
||||
// The Windows API requires that whoever creates the menus must own the
|
||||
// strings used for labels, and keep them around for the lifetime of the
|
||||
// created menu. So be it.
|
||||
base::string16 label;
|
||||
|
||||
// Someone needs to own submenus, it may as well be us.
|
||||
scoped_ptr<Menu2> submenu;
|
||||
|
||||
// We need a pointer back to the containing menu in various circumstances.
|
||||
NativeMenuWin* native_menu_win;
|
||||
|
||||
// The index of the item within the menu's model.
|
||||
int model_index;
|
||||
};
|
||||
|
||||
// Returns the NativeMenuWin for a particular HMENU.
|
||||
static NativeMenuWin* GetNativeMenuWinFromHMENU(HMENU hmenu) {
|
||||
MENUINFO mi = {0};
|
||||
mi.cbSize = sizeof(mi);
|
||||
mi.fMask = MIM_MENUDATA | MIM_STYLE;
|
||||
GetMenuInfo(hmenu, &mi);
|
||||
return reinterpret_cast<NativeMenuWin*>(mi.dwMenuData);
|
||||
}
|
||||
|
||||
// A window that receives messages from Windows relevant to the native menu
|
||||
// structure we have constructed in NativeMenuWin.
|
||||
class NativeMenuWin::MenuHostWindow {
|
||||
public:
|
||||
explicit MenuHostWindow(NativeMenuWin* parent) : parent_(parent) {
|
||||
RegisterClass();
|
||||
hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName,
|
||||
L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
|
||||
gfx::CheckWindowCreated(hwnd_);
|
||||
gfx::SetWindowUserData(hwnd_, this);
|
||||
}
|
||||
|
||||
~MenuHostWindow() {
|
||||
DestroyWindow(hwnd_);
|
||||
}
|
||||
|
||||
HWND hwnd() const { return hwnd_; }
|
||||
|
||||
private:
|
||||
static const wchar_t* kWindowClassName;
|
||||
|
||||
void RegisterClass() {
|
||||
static bool registered = false;
|
||||
if (registered)
|
||||
return;
|
||||
|
||||
WNDCLASSEX window_class;
|
||||
base::win::InitializeWindowClass(
|
||||
kWindowClassName,
|
||||
&base::win::WrappedWindowProc<MenuHostWindowProc>,
|
||||
CS_DBLCLKS,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
reinterpret_cast<HBRUSH>(COLOR_WINDOW+1),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&window_class);
|
||||
ATOM clazz = RegisterClassEx(&window_class);
|
||||
CHECK(clazz);
|
||||
registered = true;
|
||||
}
|
||||
|
||||
// Converts the WPARAM value passed to WM_MENUSELECT into an index
|
||||
// corresponding to the menu item that was selected.
|
||||
int GetMenuItemIndexFromWPARAM(HMENU menu, WPARAM w_param) const {
|
||||
int count = GetMenuItemCount(menu);
|
||||
// For normal command menu items, Windows passes a command id as the LOWORD
|
||||
// of WPARAM for WM_MENUSELECT. We need to walk forward through the menu
|
||||
// items to find an item with a matching ID. Ugh!
|
||||
for (int i = 0; i < count; ++i) {
|
||||
MENUITEMINFO mii = {0};
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_ID;
|
||||
GetMenuItemInfo(menu, i, MF_BYPOSITION, &mii);
|
||||
if (mii.wID == w_param)
|
||||
return i;
|
||||
}
|
||||
// If we didn't find a matching command ID, this means a submenu has been
|
||||
// selected instead, and rather than passing a command ID in
|
||||
// LOWORD(w_param), Windows has actually passed us a position, so we just
|
||||
// return it.
|
||||
return w_param;
|
||||
}
|
||||
|
||||
NativeMenuWin::ItemData* GetItemData(ULONG_PTR item_data) {
|
||||
return reinterpret_cast<NativeMenuWin::ItemData*>(item_data);
|
||||
}
|
||||
|
||||
// Called when the user selects a specific item.
|
||||
void OnMenuCommand(int position, HMENU menu) {
|
||||
NativeMenuWin* menu_win = GetNativeMenuWinFromHMENU(menu);
|
||||
ui::MenuModel* model = menu_win->model_;
|
||||
NativeMenuWin* root_menu = menu_win;
|
||||
while (root_menu->parent_)
|
||||
root_menu = root_menu->parent_;
|
||||
|
||||
// Only notify the model if it didn't already send out notification.
|
||||
// See comment in MenuMessageHook for details.
|
||||
if (root_menu->menu_action_ == MenuWrapper::MENU_ACTION_NONE)
|
||||
model->ActivatedAt(position);
|
||||
}
|
||||
|
||||
// Called as the user moves their mouse or arrows through the contents of the
|
||||
// menu.
|
||||
void OnMenuSelect(WPARAM w_param, HMENU menu) {
|
||||
if (!menu)
|
||||
return; // menu is null when closing on XP.
|
||||
|
||||
int position = GetMenuItemIndexFromWPARAM(menu, w_param);
|
||||
if (position >= 0)
|
||||
GetNativeMenuWinFromHMENU(menu)->model_->HighlightChangedTo(position);
|
||||
}
|
||||
|
||||
// Called by Windows to measure the size of an owner-drawn menu item.
|
||||
void OnMeasureItem(WPARAM w_param, MEASUREITEMSTRUCT* measure_item_struct) {
|
||||
NativeMenuWin::ItemData* data = GetItemData(measure_item_struct->itemData);
|
||||
if (data) {
|
||||
gfx::FontList font_list;
|
||||
measure_item_struct->itemWidth =
|
||||
gfx::GetStringWidth(data->label, font_list) +
|
||||
kIconWidth + kItemLeftMargin + views::kItemLabelSpacing -
|
||||
GetSystemMetrics(SM_CXMENUCHECK);
|
||||
if (data->submenu.get())
|
||||
measure_item_struct->itemWidth += kArrowWidth;
|
||||
// If the label contains an accelerator, make room for tab.
|
||||
if (data->label.find(L'\t') != base::string16::npos)
|
||||
measure_item_struct->itemWidth += gfx::GetStringWidth(L" ", font_list);
|
||||
measure_item_struct->itemHeight =
|
||||
font_list.GetHeight() + kItemBottomMargin + kItemTopMargin;
|
||||
} else {
|
||||
// Measure separator size.
|
||||
measure_item_struct->itemHeight = GetSystemMetrics(SM_CYMENU) / 2;
|
||||
measure_item_struct->itemWidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Called by Windows to paint an owner-drawn menu item.
|
||||
void OnDrawItem(UINT w_param, DRAWITEMSTRUCT* draw_item_struct) {
|
||||
HDC dc = draw_item_struct->hDC;
|
||||
COLORREF prev_bg_color, prev_text_color;
|
||||
|
||||
// Set background color and text color
|
||||
if (draw_item_struct->itemState & ODS_SELECTED) {
|
||||
prev_bg_color = SetBkColor(dc, GetSysColor(COLOR_HIGHLIGHT));
|
||||
prev_text_color = SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
||||
} else {
|
||||
prev_bg_color = SetBkColor(dc, GetSysColor(COLOR_MENU));
|
||||
if (draw_item_struct->itemState & ODS_DISABLED)
|
||||
prev_text_color = SetTextColor(dc, GetSysColor(COLOR_GRAYTEXT));
|
||||
else
|
||||
prev_text_color = SetTextColor(dc, GetSysColor(COLOR_MENUTEXT));
|
||||
}
|
||||
|
||||
if (draw_item_struct->itemData) {
|
||||
NativeMenuWin::ItemData* data = GetItemData(draw_item_struct->itemData);
|
||||
// Draw the background.
|
||||
HBRUSH hbr = CreateSolidBrush(GetBkColor(dc));
|
||||
FillRect(dc, &draw_item_struct->rcItem, hbr);
|
||||
DeleteObject(hbr);
|
||||
|
||||
// Draw the label.
|
||||
RECT rect = draw_item_struct->rcItem;
|
||||
rect.top += kItemTopMargin;
|
||||
// Should we add kIconWidth only when icon.width() != 0 ?
|
||||
rect.left += kItemLeftMargin + kIconWidth;
|
||||
rect.right -= views::kItemLabelSpacing;
|
||||
UINT format = DT_TOP | DT_SINGLELINE;
|
||||
// Check whether the mnemonics should be underlined.
|
||||
BOOL underline_mnemonics;
|
||||
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &underline_mnemonics, 0);
|
||||
if (!underline_mnemonics)
|
||||
format |= DT_HIDEPREFIX;
|
||||
gfx::FontList font_list;
|
||||
HGDIOBJ old_font = static_cast<HFONT>(
|
||||
SelectObject(dc, font_list.GetPrimaryFont().GetNativeFont()));
|
||||
|
||||
// If an accelerator is specified (with a tab delimiting the rest of the
|
||||
// label from the accelerator), we have to justify the fist part on the
|
||||
// left and the accelerator on the right.
|
||||
// TODO(jungshik): This will break in RTL UI. Currently, he/ar use the
|
||||
// window system UI font and will not hit here.
|
||||
base::string16 label = data->label;
|
||||
base::string16 accel;
|
||||
base::string16::size_type tab_pos = label.find(L'\t');
|
||||
if (tab_pos != base::string16::npos) {
|
||||
accel = label.substr(tab_pos);
|
||||
label = label.substr(0, tab_pos);
|
||||
}
|
||||
DrawTextEx(dc, const_cast<wchar_t*>(label.data()),
|
||||
static_cast<int>(label.size()), &rect, format | DT_LEFT, NULL);
|
||||
if (!accel.empty())
|
||||
DrawTextEx(dc, const_cast<wchar_t*>(accel.data()),
|
||||
static_cast<int>(accel.size()), &rect,
|
||||
format | DT_RIGHT, NULL);
|
||||
SelectObject(dc, old_font);
|
||||
|
||||
ui::MenuModel::ItemType type =
|
||||
data->native_menu_win->model_->GetTypeAt(data->model_index);
|
||||
|
||||
// Draw the icon after the label, otherwise it would be covered
|
||||
// by the label.
|
||||
gfx::Image icon;
|
||||
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
|
||||
// We currently don't support items with both icons and checkboxes.
|
||||
const gfx::ImageSkia* skia_icon = icon.ToImageSkia();
|
||||
DCHECK(type != ui::MenuModel::TYPE_CHECK);
|
||||
gfx::Canvas canvas(
|
||||
skia_icon->GetRepresentation(1.0f),
|
||||
false);
|
||||
skia::DrawToNativeContext(
|
||||
canvas.sk_canvas(), dc,
|
||||
draw_item_struct->rcItem.left + kItemLeftMargin,
|
||||
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
|
||||
draw_item_struct->rcItem.top - skia_icon->height()) / 2, NULL);
|
||||
} else if (type == ui::MenuModel::TYPE_CHECK &&
|
||||
data->native_menu_win->model_->IsItemCheckedAt(
|
||||
data->model_index)) {
|
||||
// Manually render a checkbox.
|
||||
const MenuConfig& config = MenuConfig::instance();
|
||||
NativeTheme::State state;
|
||||
if (draw_item_struct->itemState & ODS_DISABLED) {
|
||||
state = NativeTheme::kDisabled;
|
||||
} else {
|
||||
state = draw_item_struct->itemState & ODS_SELECTED ?
|
||||
NativeTheme::kHovered : NativeTheme::kNormal;
|
||||
}
|
||||
gfx::Canvas canvas(gfx::Size(config.check_width, config.check_height),
|
||||
1.0f,
|
||||
false);
|
||||
NativeTheme::ExtraParams extra;
|
||||
extra.menu_check.is_radio = false;
|
||||
gfx::Rect bounds(0, 0, config.check_width, config.check_height);
|
||||
|
||||
// Draw the background and the check.
|
||||
ui::NativeThemeWin* native_theme = ui::NativeThemeWin::instance();
|
||||
native_theme->Paint(
|
||||
canvas.sk_canvas(), NativeTheme::kMenuCheckBackground,
|
||||
state, bounds, extra);
|
||||
native_theme->Paint(
|
||||
canvas.sk_canvas(), NativeTheme::kMenuCheck, state, bounds, extra);
|
||||
|
||||
// Draw checkbox to menu.
|
||||
skia::DrawToNativeContext(canvas.sk_canvas(), dc,
|
||||
draw_item_struct->rcItem.left + kItemLeftMargin,
|
||||
draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom -
|
||||
draw_item_struct->rcItem.top - config.check_height) / 2, NULL);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Draw the separator
|
||||
draw_item_struct->rcItem.top +=
|
||||
(draw_item_struct->rcItem.bottom - draw_item_struct->rcItem.top) / 3;
|
||||
DrawEdge(dc, &draw_item_struct->rcItem, EDGE_ETCHED, BF_TOP);
|
||||
}
|
||||
|
||||
SetBkColor(dc, prev_bg_color);
|
||||
SetTextColor(dc, prev_text_color);
|
||||
}
|
||||
|
||||
bool ProcessWindowMessage(HWND window,
|
||||
UINT message,
|
||||
WPARAM w_param,
|
||||
LPARAM l_param,
|
||||
LRESULT* l_result) {
|
||||
switch (message) {
|
||||
case WM_MENUCOMMAND:
|
||||
OnMenuCommand(w_param, reinterpret_cast<HMENU>(l_param));
|
||||
*l_result = 0;
|
||||
return true;
|
||||
case WM_MENUSELECT:
|
||||
OnMenuSelect(LOWORD(w_param), reinterpret_cast<HMENU>(l_param));
|
||||
*l_result = 0;
|
||||
return true;
|
||||
case WM_MEASUREITEM:
|
||||
OnMeasureItem(w_param, reinterpret_cast<MEASUREITEMSTRUCT*>(l_param));
|
||||
*l_result = 0;
|
||||
return true;
|
||||
case WM_DRAWITEM:
|
||||
OnDrawItem(w_param, reinterpret_cast<DRAWITEMSTRUCT*>(l_param));
|
||||
*l_result = 0;
|
||||
return true;
|
||||
// TODO(beng): bring over owner draw from old menu system.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK MenuHostWindowProc(HWND window,
|
||||
UINT message,
|
||||
WPARAM w_param,
|
||||
LPARAM l_param) {
|
||||
MenuHostWindow* host =
|
||||
reinterpret_cast<MenuHostWindow*>(gfx::GetWindowUserData(window));
|
||||
// host is null during initial construction.
|
||||
LRESULT l_result = 0;
|
||||
if (!host || !host->ProcessWindowMessage(window, message, w_param, l_param,
|
||||
&l_result)) {
|
||||
return DefWindowProc(window, message, w_param, l_param);
|
||||
}
|
||||
return l_result;
|
||||
}
|
||||
|
||||
HWND hwnd_;
|
||||
NativeMenuWin* parent_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MenuHostWindow);
|
||||
};
|
||||
|
||||
struct NativeMenuWin::HighlightedMenuItemInfo {
|
||||
HighlightedMenuItemInfo()
|
||||
: has_parent(false),
|
||||
has_submenu(false),
|
||||
menu(NULL),
|
||||
position(-1) {
|
||||
}
|
||||
|
||||
bool has_parent;
|
||||
bool has_submenu;
|
||||
|
||||
// The menu and position. These are only set for non-disabled menu items.
|
||||
NativeMenuWin* menu;
|
||||
int position;
|
||||
};
|
||||
|
||||
// static
|
||||
const wchar_t* NativeMenuWin::MenuHostWindow::kWindowClassName =
|
||||
L"ViewsMenuHostWindow";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NativeMenuWin, public:
|
||||
|
||||
NativeMenuWin::NativeMenuWin(ui::MenuModel* model, HWND system_menu_for)
|
||||
: model_(model),
|
||||
menu_(NULL),
|
||||
owner_draw_(l10n_util::NeedOverrideDefaultUIFont(NULL, NULL) &&
|
||||
!system_menu_for),
|
||||
system_menu_for_(system_menu_for),
|
||||
first_item_index_(0),
|
||||
menu_action_(MENU_ACTION_NONE),
|
||||
menu_to_select_(NULL),
|
||||
position_to_select_(-1),
|
||||
parent_(NULL),
|
||||
destroyed_flag_(NULL),
|
||||
menu_to_select_factory_(this) {
|
||||
}
|
||||
|
||||
NativeMenuWin::~NativeMenuWin() {
|
||||
if (destroyed_flag_)
|
||||
*destroyed_flag_ = true;
|
||||
STLDeleteContainerPointers(items_.begin(), items_.end());
|
||||
DestroyMenu(menu_);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NativeMenuWin, MenuWrapper implementation:
|
||||
|
||||
void NativeMenuWin::RunMenuAt(const gfx::Point& point, int alignment) {
|
||||
CreateHostWindow();
|
||||
UpdateStates();
|
||||
UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RECURSE;
|
||||
flags |= GetAlignmentFlags(alignment);
|
||||
menu_action_ = MENU_ACTION_NONE;
|
||||
|
||||
// Set a hook function so we can listen for keyboard events while the
|
||||
// menu is open, and store a pointer to this object in a static
|
||||
// variable so the hook has access to it (ugly, but it's the
|
||||
// only way).
|
||||
open_native_menu_win_ = this;
|
||||
HHOOK hhook = SetWindowsHookEx(WH_MSGFILTER, MenuMessageHook,
|
||||
GetModuleHandle(NULL), ::GetCurrentThreadId());
|
||||
|
||||
// Mark that any registered listeners have not been called for this particular
|
||||
// opening of the menu.
|
||||
listeners_called_ = false;
|
||||
|
||||
// Command dispatch is done through WM_MENUCOMMAND, handled by the host
|
||||
// window.
|
||||
menu_to_select_ = NULL;
|
||||
position_to_select_ = -1;
|
||||
menu_to_select_factory_.InvalidateWeakPtrs();
|
||||
bool destroyed = false;
|
||||
destroyed_flag_ = &destroyed;
|
||||
model_->MenuWillShow();
|
||||
TrackPopupMenu(menu_, flags, point.x(), point.y(), 0, host_window_->hwnd(),
|
||||
NULL);
|
||||
UnhookWindowsHookEx(hhook);
|
||||
open_native_menu_win_ = NULL;
|
||||
if (destroyed)
|
||||
return;
|
||||
destroyed_flag_ = NULL;
|
||||
if (menu_to_select_) {
|
||||
// Folks aren't too happy if we notify immediately. In particular, notifying
|
||||
// the delegate can cause destruction leaving the stack in a weird
|
||||
// state. Instead post a task, then notify. This mirrors what WM_MENUCOMMAND
|
||||
// does.
|
||||
menu_to_select_factory_.InvalidateWeakPtrs();
|
||||
base::MessageLoop::current()->PostTask(
|
||||
FROM_HERE,
|
||||
base::Bind(&NativeMenuWin::DelayedSelect,
|
||||
menu_to_select_factory_.GetWeakPtr()));
|
||||
menu_action_ = MENU_ACTION_SELECTED;
|
||||
}
|
||||
// Send MenuClosed after we schedule the select, otherwise MenuClosed is
|
||||
// processed after the select (MenuClosed posts a delayed task too).
|
||||
model_->MenuClosed();
|
||||
}
|
||||
|
||||
void NativeMenuWin::CancelMenu() {
|
||||
EndMenu();
|
||||
}
|
||||
|
||||
void NativeMenuWin::Rebuild(MenuInsertionDelegateWin* delegate) {
|
||||
ResetNativeMenu();
|
||||
items_.clear();
|
||||
|
||||
owner_draw_ = model_->HasIcons() || owner_draw_;
|
||||
first_item_index_ = delegate ? delegate->GetInsertionIndex(menu_) : 0;
|
||||
for (int menu_index = first_item_index_;
|
||||
menu_index < first_item_index_ + model_->GetItemCount(); ++menu_index) {
|
||||
int model_index = menu_index - first_item_index_;
|
||||
if (model_->GetTypeAt(model_index) == ui::MenuModel::TYPE_SEPARATOR)
|
||||
AddSeparatorItemAt(menu_index, model_index);
|
||||
else
|
||||
AddMenuItemAt(menu_index, model_index);
|
||||
}
|
||||
}
|
||||
|
||||
void NativeMenuWin::UpdateStates() {
|
||||
// A depth-first walk of the menu items, updating states.
|
||||
int model_index = 0;
|
||||
std::vector<ItemData*>::const_iterator it;
|
||||
for (it = items_.begin(); it != items_.end(); ++it, ++model_index) {
|
||||
int menu_index = model_index + first_item_index_;
|
||||
SetMenuItemState(menu_index, model_->IsEnabledAt(model_index),
|
||||
model_->IsItemCheckedAt(model_index), false);
|
||||
if (model_->IsItemDynamicAt(model_index)) {
|
||||
// TODO(atwilson): Update the icon as well (http://crbug.com/66508).
|
||||
SetMenuItemLabel(menu_index, model_index,
|
||||
model_->GetLabelAt(model_index));
|
||||
}
|
||||
Menu2* submenu = (*it)->submenu.get();
|
||||
if (submenu)
|
||||
submenu->UpdateStates();
|
||||
}
|
||||
}
|
||||
|
||||
HMENU NativeMenuWin::GetNativeMenu() const {
|
||||
return menu_;
|
||||
}
|
||||
|
||||
NativeMenuWin::MenuAction NativeMenuWin::GetMenuAction() const {
|
||||
return menu_action_;
|
||||
}
|
||||
|
||||
void NativeMenuWin::AddMenuListener(MenuListener* listener) {
|
||||
listeners_.AddObserver(listener);
|
||||
}
|
||||
|
||||
void NativeMenuWin::RemoveMenuListener(MenuListener* listener) {
|
||||
listeners_.RemoveObserver(listener);
|
||||
}
|
||||
|
||||
void NativeMenuWin::SetMinimumWidth(int width) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NativeMenuWin, private:
|
||||
|
||||
// static
|
||||
NativeMenuWin* NativeMenuWin::open_native_menu_win_ = NULL;
|
||||
|
||||
void NativeMenuWin::DelayedSelect() {
|
||||
if (menu_to_select_)
|
||||
menu_to_select_->model_->ActivatedAt(position_to_select_);
|
||||
}
|
||||
|
||||
// static
|
||||
bool NativeMenuWin::GetHighlightedMenuItemInfo(
|
||||
HMENU menu,
|
||||
HighlightedMenuItemInfo* info) {
|
||||
for (int i = 0; i < ::GetMenuItemCount(menu); i++) {
|
||||
UINT state = ::GetMenuState(menu, i, MF_BYPOSITION);
|
||||
if (state & MF_HILITE) {
|
||||
if (state & MF_POPUP) {
|
||||
HMENU submenu = GetSubMenu(menu, i);
|
||||
if (GetHighlightedMenuItemInfo(submenu, info))
|
||||
info->has_parent = true;
|
||||
else
|
||||
info->has_submenu = true;
|
||||
} else if (!(state & MF_SEPARATOR) && !(state & MF_DISABLED)) {
|
||||
info->menu = GetNativeMenuWinFromHMENU(menu);
|
||||
info->position = i;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
LRESULT CALLBACK NativeMenuWin::MenuMessageHook(
|
||||
int n_code, WPARAM w_param, LPARAM l_param) {
|
||||
LRESULT result = CallNextHookEx(NULL, n_code, w_param, l_param);
|
||||
|
||||
NativeMenuWin* this_ptr = open_native_menu_win_;
|
||||
if (!this_ptr)
|
||||
return result;
|
||||
|
||||
// The first time this hook is called, that means the menu has successfully
|
||||
// opened, so call the callback function on all of our listeners.
|
||||
if (!this_ptr->listeners_called_) {
|
||||
FOR_EACH_OBSERVER(MenuListener, this_ptr->listeners_, OnMenuOpened());
|
||||
this_ptr->listeners_called_ = true;
|
||||
}
|
||||
|
||||
MSG* msg = reinterpret_cast<MSG*>(l_param);
|
||||
if (msg->message == WM_LBUTTONUP || msg->message == WM_RBUTTONUP) {
|
||||
HighlightedMenuItemInfo info;
|
||||
if (GetHighlightedMenuItemInfo(this_ptr->menu_, &info) && info.menu) {
|
||||
// It appears that when running a menu by way of TrackPopupMenu(Ex) win32
|
||||
// gets confused if the underlying window paints itself. As its very easy
|
||||
// for the underlying window to repaint itself (especially since some menu
|
||||
// items trigger painting of the tabstrip on mouse over) we have this
|
||||
// workaround. When the mouse is released on a menu item we remember the
|
||||
// menu item and end the menu. When the nested message loop returns we
|
||||
// schedule a task to notify the model. It's still possible to get a
|
||||
// WM_MENUCOMMAND, so we have to be careful that we don't notify the model
|
||||
// twice.
|
||||
this_ptr->menu_to_select_ = info.menu;
|
||||
this_ptr->position_to_select_ = info.position;
|
||||
EndMenu();
|
||||
}
|
||||
} else if (msg->message == WM_KEYDOWN) {
|
||||
HighlightedMenuItemInfo info;
|
||||
if (GetHighlightedMenuItemInfo(this_ptr->menu_, &info)) {
|
||||
if (msg->wParam == VK_LEFT && !info.has_parent) {
|
||||
this_ptr->menu_action_ = MENU_ACTION_PREVIOUS;
|
||||
::EndMenu();
|
||||
} else if (msg->wParam == VK_RIGHT && !info.has_parent &&
|
||||
!info.has_submenu) {
|
||||
this_ptr->menu_action_ = MENU_ACTION_NEXT;
|
||||
::EndMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool NativeMenuWin::IsSeparatorItemAt(int menu_index) const {
|
||||
MENUITEMINFO mii = {0};
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_FTYPE;
|
||||
GetMenuItemInfo(menu_, menu_index, MF_BYPOSITION, &mii);
|
||||
return !!(mii.fType & MF_SEPARATOR);
|
||||
}
|
||||
|
||||
void NativeMenuWin::AddMenuItemAt(int menu_index, int model_index) {
|
||||
MENUITEMINFO mii = {0};
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_DATA;
|
||||
if (!owner_draw_)
|
||||
mii.fType = MFT_STRING;
|
||||
else
|
||||
mii.fType = MFT_OWNERDRAW;
|
||||
|
||||
ItemData* item_data = new ItemData;
|
||||
item_data->label = base::string16();
|
||||
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
||||
if (type == ui::MenuModel::TYPE_SUBMENU) {
|
||||
item_data->submenu.reset(new Menu2(model_->GetSubmenuModelAt(model_index)));
|
||||
mii.fMask |= MIIM_SUBMENU;
|
||||
mii.hSubMenu = item_data->submenu->GetNativeMenu();
|
||||
GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this;
|
||||
} else {
|
||||
if (type == ui::MenuModel::TYPE_RADIO)
|
||||
mii.fType |= MFT_RADIOCHECK;
|
||||
mii.wID = model_->GetCommandIdAt(model_index);
|
||||
}
|
||||
item_data->native_menu_win = this;
|
||||
item_data->model_index = model_index;
|
||||
items_.insert(items_.begin() + model_index, item_data);
|
||||
mii.dwItemData = reinterpret_cast<ULONG_PTR>(item_data);
|
||||
UpdateMenuItemInfoForString(&mii, model_index,
|
||||
model_->GetLabelAt(model_index));
|
||||
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
||||
}
|
||||
|
||||
void NativeMenuWin::AddSeparatorItemAt(int menu_index, int model_index) {
|
||||
MENUITEMINFO mii = {0};
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_FTYPE;
|
||||
mii.fType = MFT_SEPARATOR;
|
||||
// Insert a dummy entry into our label list so we can index directly into it
|
||||
// using item indices if need be.
|
||||
items_.insert(items_.begin() + model_index, new ItemData);
|
||||
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
||||
}
|
||||
|
||||
void NativeMenuWin::SetMenuItemState(int menu_index, bool enabled, bool checked,
|
||||
bool is_default) {
|
||||
if (IsSeparatorItemAt(menu_index))
|
||||
return;
|
||||
|
||||
UINT state = enabled ? MFS_ENABLED : MFS_DISABLED;
|
||||
if (checked)
|
||||
state |= MFS_CHECKED;
|
||||
if (is_default)
|
||||
state |= MFS_DEFAULT;
|
||||
|
||||
MENUITEMINFO mii = {0};
|
||||
mii.cbSize = sizeof(mii);
|
||||
mii.fMask = MIIM_STATE;
|
||||
mii.fState = state;
|
||||
SetMenuItemInfo(menu_, menu_index, MF_BYPOSITION, &mii);
|
||||
}
|
||||
|
||||
void NativeMenuWin::SetMenuItemLabel(int menu_index,
|
||||
int model_index,
|
||||
const base::string16& label) {
|
||||
if (IsSeparatorItemAt(menu_index))
|
||||
return;
|
||||
|
||||
MENUITEMINFO mii = {0};
|
||||
mii.cbSize = sizeof(mii);
|
||||
UpdateMenuItemInfoForString(&mii, model_index, label);
|
||||
SetMenuItemInfo(menu_, menu_index, MF_BYPOSITION, &mii);
|
||||
}
|
||||
|
||||
void NativeMenuWin::UpdateMenuItemInfoForString(MENUITEMINFO* mii,
|
||||
int model_index,
|
||||
const base::string16& label) {
|
||||
base::string16 formatted = label;
|
||||
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
||||
// Strip out any tabs, otherwise they get interpreted as accelerators and can
|
||||
// lead to weird behavior.
|
||||
base::ReplaceSubstringsAfterOffset(&formatted, 0, L"\t", L" ");
|
||||
if (type != ui::MenuModel::TYPE_SUBMENU) {
|
||||
// Add accelerator details to the label if provided.
|
||||
ui::Accelerator accelerator(ui::VKEY_UNKNOWN, ui::EF_NONE);
|
||||
if (model_->GetAcceleratorAt(model_index, &accelerator)) {
|
||||
formatted += L"\t";
|
||||
formatted += accelerator.GetShortcutText();
|
||||
}
|
||||
}
|
||||
|
||||
// Update the owned string, since Windows will want us to keep this new
|
||||
// version around.
|
||||
items_[model_index]->label = formatted;
|
||||
|
||||
// Give Windows a pointer to the label string.
|
||||
mii->fMask |= MIIM_STRING;
|
||||
mii->dwTypeData =
|
||||
const_cast<wchar_t*>(items_[model_index]->label.c_str());
|
||||
}
|
||||
|
||||
UINT NativeMenuWin::GetAlignmentFlags(int alignment) const {
|
||||
UINT alignment_flags = TPM_TOPALIGN;
|
||||
if (alignment == Menu2::ALIGN_TOPLEFT)
|
||||
alignment_flags |= TPM_LEFTALIGN;
|
||||
else if (alignment == Menu2::ALIGN_TOPRIGHT)
|
||||
alignment_flags |= TPM_RIGHTALIGN;
|
||||
return alignment_flags;
|
||||
}
|
||||
|
||||
void NativeMenuWin::ResetNativeMenu() {
|
||||
if (IsWindow(system_menu_for_)) {
|
||||
if (menu_)
|
||||
GetSystemMenu(system_menu_for_, TRUE);
|
||||
menu_ = GetSystemMenu(system_menu_for_, FALSE);
|
||||
} else {
|
||||
if (menu_)
|
||||
DestroyMenu(menu_);
|
||||
menu_ = CreatePopupMenu();
|
||||
// Rather than relying on the return value of TrackPopupMenuEx, which is
|
||||
// always a command identifier, instead we tell the menu to notify us via
|
||||
// our host window and the WM_MENUCOMMAND message.
|
||||
MENUINFO mi = {0};
|
||||
mi.cbSize = sizeof(mi);
|
||||
mi.fMask = MIM_STYLE | MIM_MENUDATA;
|
||||
mi.dwStyle = MNS_NOTIFYBYPOS;
|
||||
mi.dwMenuData = reinterpret_cast<ULONG_PTR>(this);
|
||||
SetMenuInfo(menu_, &mi);
|
||||
}
|
||||
}
|
||||
|
||||
void NativeMenuWin::CreateHostWindow() {
|
||||
// This only gets called from RunMenuAt, and as such there is only ever one
|
||||
// host window per menu hierarchy, no matter how many NativeMenuWin objects
|
||||
// exist wrapping submenus.
|
||||
if (!host_window_.get())
|
||||
host_window_.reset(new MenuHostWindow(this));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// MenuWrapper, public:
|
||||
|
||||
// static
|
||||
MenuWrapper* MenuWrapper::CreateWrapper(ui::MenuModel* model) {
|
||||
return new NativeMenuWin(model, NULL);
|
||||
}
|
||||
|
||||
} // namespace views
|
|
@ -0,0 +1,170 @@
|
|||
// 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_NATIVE_NATIVE_MENU_WIN_H_
|
||||
#define CEF_LIBCEF_BROWSER_NATIVE_NATIVE_MENU_WIN_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "libcef/browser/native/menu_wrapper.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/strings/string16.h"
|
||||
|
||||
namespace ui {
|
||||
class MenuModel;
|
||||
}
|
||||
|
||||
namespace views {
|
||||
|
||||
// A Windows implementation of MenuWrapper.
|
||||
// TODO(beng): rename to MenuWin once the old class is dead.
|
||||
class NativeMenuWin : public MenuWrapper {
|
||||
public:
|
||||
// Construct a NativeMenuWin, with a model and delegate. If |system_menu_for|
|
||||
// is non-NULL, the NativeMenuWin wraps the system menu for that window.
|
||||
// The caller owns the model and the delegate.
|
||||
NativeMenuWin(ui::MenuModel* model, HWND system_menu_for);
|
||||
~NativeMenuWin() override;
|
||||
|
||||
// Overridden from MenuWrapper:
|
||||
void RunMenuAt(const gfx::Point& point, int alignment) override;
|
||||
void CancelMenu() override;
|
||||
void Rebuild(MenuInsertionDelegateWin* delegate) override;
|
||||
void UpdateStates() override;
|
||||
HMENU GetNativeMenu() const override;
|
||||
MenuAction GetMenuAction() const override;
|
||||
void AddMenuListener(MenuListener* listener) override;
|
||||
void RemoveMenuListener(MenuListener* listener) override;
|
||||
void SetMinimumWidth(int width) override;
|
||||
|
||||
private:
|
||||
// IMPORTANT: Note about indices.
|
||||
// Functions in this class deal in two index spaces:
|
||||
// 1. menu_index - the index of an item within the actual Windows
|
||||
// native menu.
|
||||
// 2. model_index - the index of the item within our model.
|
||||
// These two are most often but not always the same value! The
|
||||
// notable exception is when this object is used to wrap the
|
||||
// Windows System Menu. In this instance, the model indices start
|
||||
// at 0, but the insertion index into the existing menu is not.
|
||||
// It is important to take this into consideration when editing the
|
||||
// code in the functions in this class.
|
||||
|
||||
struct HighlightedMenuItemInfo;
|
||||
|
||||
// Returns true if the item at the specified index is a separator.
|
||||
bool IsSeparatorItemAt(int menu_index) const;
|
||||
|
||||
// Add items. See note above about indices.
|
||||
void AddMenuItemAt(int menu_index, int model_index);
|
||||
void AddSeparatorItemAt(int menu_index, int model_index);
|
||||
|
||||
// Sets the state of the item at the specified index.
|
||||
void SetMenuItemState(int menu_index,
|
||||
bool enabled,
|
||||
bool checked,
|
||||
bool is_default);
|
||||
|
||||
// Sets the label of the item at the specified index.
|
||||
void SetMenuItemLabel(int menu_index,
|
||||
int model_index,
|
||||
const base::string16& label);
|
||||
|
||||
// Updates the local data structure with the correctly formatted version of
|
||||
// |label| at the specified model_index, and adds string data to |mii| if
|
||||
// the menu is not owner-draw. That's a mouthful. This function exists because
|
||||
// of the peculiarities of the Windows menu API.
|
||||
void UpdateMenuItemInfoForString(MENUITEMINFO* mii,
|
||||
int model_index,
|
||||
const base::string16& label);
|
||||
|
||||
// Returns the alignment flags to be passed to TrackPopupMenuEx, based on the
|
||||
// supplied alignment and the UI text direction.
|
||||
UINT GetAlignmentFlags(int alignment) const;
|
||||
|
||||
// Resets the native menu stored in |menu_| by destroying any old menu then
|
||||
// creating a new empty one.
|
||||
void ResetNativeMenu();
|
||||
|
||||
// Creates the host window that receives notifications from the menu.
|
||||
void CreateHostWindow();
|
||||
|
||||
// Callback from task to notify menu it was selected.
|
||||
void DelayedSelect();
|
||||
|
||||
// Given a menu that's currently popped-up, find the currently highlighted
|
||||
// item. Returns true if a highlighted item was found.
|
||||
static bool GetHighlightedMenuItemInfo(HMENU menu,
|
||||
HighlightedMenuItemInfo* info);
|
||||
|
||||
// Hook to receive keyboard events while the menu is open.
|
||||
static LRESULT CALLBACK MenuMessageHook(
|
||||
int n_code, WPARAM w_param, LPARAM l_param);
|
||||
|
||||
// Our attached model and delegate.
|
||||
ui::MenuModel* model_;
|
||||
|
||||
HMENU menu_;
|
||||
|
||||
// True if the contents of menu items in this menu are drawn by the menu host
|
||||
// window, rather than Windows.
|
||||
bool owner_draw_;
|
||||
|
||||
// An object that collects all of the data associated with an individual menu
|
||||
// item.
|
||||
struct ItemData;
|
||||
std::vector<ItemData*> items_;
|
||||
|
||||
// The window that receives notifications from the menu.
|
||||
class MenuHostWindow;
|
||||
friend MenuHostWindow;
|
||||
scoped_ptr<MenuHostWindow> host_window_;
|
||||
|
||||
// The HWND this menu is the system menu for, or NULL if the menu is not a
|
||||
// system menu.
|
||||
HWND system_menu_for_;
|
||||
|
||||
// The index of the first item in the model in the menu.
|
||||
int first_item_index_;
|
||||
|
||||
// The action that took place during the call to RunMenuAt.
|
||||
MenuAction menu_action_;
|
||||
|
||||
// A list of listeners to call when the menu opens.
|
||||
base::ObserverList<MenuListener> listeners_;
|
||||
|
||||
// Keep track of whether the listeners have already been called at least
|
||||
// once.
|
||||
bool listeners_called_;
|
||||
|
||||
// See comment in MenuMessageHook for details on these.
|
||||
NativeMenuWin* menu_to_select_;
|
||||
int position_to_select_;
|
||||
|
||||
// If we're a submenu, this is our parent.
|
||||
NativeMenuWin* parent_;
|
||||
|
||||
// If non-null the destructor sets this to true. This is set to non-null while
|
||||
// the menu is showing. It is used to detect if the menu was deleted while
|
||||
// running.
|
||||
bool* destroyed_flag_;
|
||||
|
||||
base::WeakPtrFactory<NativeMenuWin> menu_to_select_factory_;
|
||||
|
||||
// Ugly: a static pointer to the instance of this class that currently
|
||||
// has a menu open, because our hook function that receives keyboard
|
||||
// events doesn't have a mechanism to get a user data pointer.
|
||||
static NativeMenuWin* open_native_menu_win_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NativeMenuWin);
|
||||
};
|
||||
|
||||
} // namespace views
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_NATIVE_MENU_WIN_H_
|
|
@ -34,7 +34,7 @@ struct CefNavigateParams {
|
|||
content::Referrer referrer;
|
||||
|
||||
// The frame that the request should be loaded in or -1 to use the main frame.
|
||||
int64 frame_id;
|
||||
int64_t frame_id;
|
||||
|
||||
// Usually the URL of the document in the top-level window, which may be
|
||||
// checked by the third-party cookie blocking policy. Leaving it empty may
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "include/cef_version.h"
|
||||
#include "include/cef_web_plugin.h"
|
||||
|
@ -413,7 +414,7 @@ class ChromeProtocolHandlerWrapper :
|
|||
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
|
||||
chrome_protocol_handler)
|
||||
: request_manager_(request_manager),
|
||||
chrome_protocol_handler_(chrome_protocol_handler.Pass()) {
|
||||
chrome_protocol_handler_(std::move(chrome_protocol_handler)) {
|
||||
DCHECK(request_manager_);
|
||||
}
|
||||
|
||||
|
@ -482,8 +483,8 @@ WrapChromeProtocolHandler(
|
|||
chrome_protocol_handler) {
|
||||
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> ret(
|
||||
new ChromeProtocolHandlerWrapper(request_manager,
|
||||
chrome_protocol_handler.Pass()));
|
||||
return ret.Pass();
|
||||
std::move(chrome_protocol_handler)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace scheme
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "libcef/browser/net/internal_scheme_handler.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
|
@ -130,7 +131,7 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
|
|||
public:
|
||||
explicit InternalHandlerFactory(
|
||||
scoped_ptr<InternalHandlerDelegate> delegate)
|
||||
: delegate_(delegate.Pass()) {
|
||||
: delegate_(std::move(delegate)) {
|
||||
}
|
||||
|
||||
CefRefPtr<CefResourceHandler> Create(
|
||||
|
@ -188,7 +189,7 @@ InternalHandlerDelegate::Action::Action()
|
|||
CefRefPtr<CefSchemeHandlerFactory> CreateInternalHandlerFactory(
|
||||
scoped_ptr<InternalHandlerDelegate> delegate) {
|
||||
DCHECK(delegate.get());
|
||||
return new InternalHandlerFactory(delegate.Pass());
|
||||
return new InternalHandlerFactory(std::move(delegate));
|
||||
}
|
||||
|
||||
} // namespace scheme
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "libcef/browser/net/network_delegate.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "include/cef_urlrequest.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
@ -458,7 +459,7 @@ net::Filter* CefNetworkDelegate::SetupFilter(net::URLRequest* request,
|
|||
net::Filter* last_filter = filter_list;
|
||||
do {
|
||||
if (!last_filter->next_filter_.get()) {
|
||||
last_filter->next_filter_ = wrapper.Pass();
|
||||
last_filter->next_filter_ = std::move(wrapper);
|
||||
break;
|
||||
}
|
||||
last_filter = last_filter->next_filter_.get();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define CEF_LIBCEF_BROWSER_NET_NETWORK_DELEGATE_H_
|
||||
#pragma once
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "net/base/network_delegate_impl.h"
|
||||
|
||||
// Used for intercepting resource requests, redirects and responses. The single
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#ifndef CEF_LIBCEF_BROWSER_RESOURCE_REQUEST_JOB_H_
|
||||
#define CEF_LIBCEF_BROWSER_RESOURCE_REQUEST_JOB_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "include/cef_browser.h"
|
||||
|
@ -66,8 +68,8 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
|||
bool done_;
|
||||
CefRefPtr<CefResponse> response_;
|
||||
GURL redirect_url_;
|
||||
int64 remaining_bytes_;
|
||||
int64 sent_bytes_;
|
||||
int64_t remaining_bytes_;
|
||||
int64_t sent_bytes_;
|
||||
CefRefPtr<CefRequest> cef_request_;
|
||||
CefRefPtr<CefResourceRequestJobCallback> callback_;
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers_;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "include/cef_response_filter.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/macros.h"
|
||||
#include "net/filter/filter.h"
|
||||
|
||||
class CefResponseFilterWrapper : public net::Filter {
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
|
||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <winhttp.h>
|
||||
#endif
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
|
@ -26,6 +24,7 @@
|
|||
#include "base/strings/string_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/threading/worker_pool.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/net/proxy_service_factory.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
|
@ -56,6 +55,10 @@
|
|||
#include "net/url_request/url_request_job_factory_impl.h"
|
||||
#include "net/url_request/url_request_job_manager.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <winhttp.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
#include "net/cert_net/nss_ocsp.h"
|
||||
#endif
|
||||
|
@ -109,8 +112,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
|||
: settings_(settings),
|
||||
io_loop_(io_loop),
|
||||
file_loop_(file_loop),
|
||||
proxy_config_service_(proxy_config_service.Pass()),
|
||||
request_interceptors_(request_interceptors.Pass()) {
|
||||
proxy_config_service_(std::move(proxy_config_service)),
|
||||
request_interceptors_(std::move(request_interceptors)) {
|
||||
// Must first be created on the UI thread.
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
|
@ -173,10 +176,10 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||
NULL,
|
||||
url_request_context_.get(),
|
||||
url_request_context_->network_delegate(),
|
||||
proxy_config_service_.Pass(),
|
||||
std::move(proxy_config_service_),
|
||||
*command_line,
|
||||
true);
|
||||
storage_->set_proxy_service(system_proxy_service.Pass());
|
||||
storage_->set_proxy_service(std::move(system_proxy_service));
|
||||
|
||||
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
|
||||
|
||||
|
@ -236,7 +239,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||
make_scoped_ptr(new net::HttpNetworkSession(network_session_params)));
|
||||
storage_->set_http_transaction_factory(make_scoped_ptr(
|
||||
new net::HttpCache(storage_->http_network_session(),
|
||||
main_backend.Pass(),
|
||||
std::move(main_backend),
|
||||
true /* set_up_quic_server_info */)));
|
||||
|
||||
#if !defined(DISABLE_FTP_SUPPORT)
|
||||
|
@ -262,17 +265,17 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||
|
||||
// Set up interceptors in the reverse order.
|
||||
scoped_ptr<net::URLRequestJobFactory> top_job_factory =
|
||||
job_factory.Pass();
|
||||
std::move(job_factory);
|
||||
for (content::URLRequestInterceptorScopedVector::reverse_iterator i =
|
||||
request_interceptors_.rbegin();
|
||||
i != request_interceptors_.rend();
|
||||
++i) {
|
||||
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
|
||||
top_job_factory.Pass(), make_scoped_ptr(*i)));
|
||||
std::move(top_job_factory), make_scoped_ptr(*i)));
|
||||
}
|
||||
request_interceptors_.weak_clear();
|
||||
|
||||
storage_->set_job_factory(top_job_factory.Pass());
|
||||
storage_->set_job_factory(std::move(top_job_factory));
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
// Only do this for the first (global) request context.
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libcef/browser/osr/browser_platform_delegate_osr.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||
#include "libcef/browser/osr/web_contents_view_osr.h"
|
||||
|
@ -13,7 +15,7 @@
|
|||
|
||||
CefBrowserPlatformDelegateOsr::CefBrowserPlatformDelegateOsr(
|
||||
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate)
|
||||
: native_delegate_(native_delegate.Pass()),
|
||||
: native_delegate_(std::move(native_delegate)),
|
||||
view_osr_(nullptr) {
|
||||
native_delegate_->set_windowless_handler(this);
|
||||
}
|
||||
|
@ -97,7 +99,6 @@ void CefBrowserPlatformDelegateOsr::SendFocusEvent(bool setFocus) {
|
|||
view->SendFocusEvent(setFocus);
|
||||
}
|
||||
|
||||
|
||||
gfx::Point CefBrowserPlatformDelegateOsr::GetScreenPoint(
|
||||
const gfx::Point& view) const {
|
||||
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
|
||||
|
|
|
@ -4,11 +4,13 @@
|
|||
|
||||
#include "libcef/browser/osr/browser_platform_delegate_osr_linux.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
CefBrowserPlatformDelegateOsrLinux::CefBrowserPlatformDelegateOsrLinux(
|
||||
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate)
|
||||
: CefBrowserPlatformDelegateOsr(native_delegate.Pass()) {
|
||||
: CefBrowserPlatformDelegateOsr(std::move(native_delegate)) {
|
||||
}
|
||||
|
||||
CefWindowHandle
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
|
||||
#include "libcef/browser/osr/browser_platform_delegate_osr_mac.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||
|
||||
CefBrowserPlatformDelegateOsrMac::CefBrowserPlatformDelegateOsrMac(
|
||||
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate)
|
||||
: CefBrowserPlatformDelegateOsr(native_delegate.Pass()) {
|
||||
: CefBrowserPlatformDelegateOsr(std::move(native_delegate)) {
|
||||
}
|
||||
|
||||
CefWindowHandle CefBrowserPlatformDelegateOsrMac::GetHostWindowHandle() const {
|
||||
|
|
|
@ -4,11 +4,13 @@
|
|||
|
||||
#include "libcef/browser/osr/browser_platform_delegate_osr_win.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
CefBrowserPlatformDelegateOsrWin::CefBrowserPlatformDelegateOsrWin(
|
||||
scoped_ptr<CefBrowserPlatformDelegateNative> native_delegate)
|
||||
: CefBrowserPlatformDelegateOsr(native_delegate.Pass()) {
|
||||
: CefBrowserPlatformDelegateOsr(std::move(native_delegate)) {
|
||||
}
|
||||
|
||||
CefWindowHandle CefBrowserPlatformDelegateOsrWin::GetHostWindowHandle() const {
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
|
||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/osr/osr_util.h"
|
||||
#include "libcef/browser/osr/software_output_device_osr.h"
|
||||
|
@ -155,7 +159,7 @@ class CefCopyFrameGenerator {
|
|||
frame_in_progress_ = true;
|
||||
|
||||
// Don't exceed the frame rate threshold.
|
||||
const int64 frame_rate_delta =
|
||||
const int64_t frame_rate_delta =
|
||||
(base::TimeTicks::Now() - frame_start_time_).InMilliseconds();
|
||||
if (frame_rate_delta < frame_rate_threshold_ms_) {
|
||||
// Generate the frame after the necessary time has passed.
|
||||
|
@ -196,7 +200,8 @@ class CefCopyFrameGenerator {
|
|||
damage_rect));
|
||||
|
||||
request->set_area(gfx::Rect(view_->GetPhysicalBackingSize()));
|
||||
view_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput(request.Pass());
|
||||
view_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput(
|
||||
std::move(request));
|
||||
}
|
||||
|
||||
void CopyFromCompositingSurfaceHasResult(
|
||||
|
@ -209,12 +214,12 @@ class CefCopyFrameGenerator {
|
|||
}
|
||||
|
||||
if (result->HasTexture()) {
|
||||
PrepareTextureCopyOutputResult(damage_rect, result.Pass());
|
||||
PrepareTextureCopyOutputResult(damage_rect, std::move(result));
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(result->HasBitmap());
|
||||
PrepareBitmapCopyOutputResult(damage_rect, result.Pass());
|
||||
PrepareBitmapCopyOutputResult(damage_rect, std::move(result));
|
||||
}
|
||||
|
||||
void PrepareTextureCopyOutputResult(
|
||||
|
@ -251,7 +256,7 @@ class CefCopyFrameGenerator {
|
|||
|
||||
scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock(
|
||||
new SkAutoLockPixels(*bitmap_));
|
||||
uint8* pixels = static_cast<uint8*>(bitmap_->getPixels());
|
||||
uint8_t* pixels = static_cast<uint8_t*>(bitmap_->getPixels());
|
||||
|
||||
cc::TextureMailbox texture_mailbox;
|
||||
scoped_ptr<cc::SingleReleaseCallback> release_callback;
|
||||
|
@ -300,7 +305,8 @@ class CefCopyFrameGenerator {
|
|||
|
||||
if (generator) {
|
||||
generator->CopyFromCompositingSurfaceFinished(
|
||||
damage_rect, bitmap.Pass(), bitmap_pixels_lock.Pass(), result);
|
||||
damage_rect, std::move(bitmap), std::move(bitmap_pixels_lock),
|
||||
result);
|
||||
} else {
|
||||
bitmap_pixels_lock.reset();
|
||||
bitmap.reset();
|
||||
|
@ -314,11 +320,11 @@ class CefCopyFrameGenerator {
|
|||
bool result) {
|
||||
// Restore ownership of the bitmap to the view.
|
||||
DCHECK(!bitmap_);
|
||||
bitmap_ = bitmap.Pass();
|
||||
bitmap_ = std::move(bitmap);
|
||||
|
||||
if (result) {
|
||||
OnCopyFrameCaptureSuccess(damage_rect, *bitmap_,
|
||||
bitmap_pixels_lock.Pass());
|
||||
std::move(bitmap_pixels_lock));
|
||||
} else {
|
||||
bitmap_pixels_lock.reset();
|
||||
OnCopyFrameCaptureFailure(damage_rect);
|
||||
|
@ -335,7 +341,7 @@ class CefCopyFrameGenerator {
|
|||
scoped_ptr<SkAutoLockPixels> bitmap_pixels_lock(
|
||||
new SkAutoLockPixels(*source));
|
||||
OnCopyFrameCaptureSuccess(damage_rect, *source,
|
||||
bitmap_pixels_lock.Pass());
|
||||
std::move(bitmap_pixels_lock));
|
||||
} else {
|
||||
OnCopyFrameCaptureFailure(damage_rect);
|
||||
}
|
||||
|
@ -632,7 +638,7 @@ void CefRenderWidgetHostViewOSR::UnlockMouse() {
|
|||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
||||
uint32 output_surface_id,
|
||||
uint32_t output_surface_id,
|
||||
scoped_ptr<cc::CompositorFrame> frame) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
|
||||
|
||||
|
@ -659,7 +665,7 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
|||
// The compositor will draw directly to the SoftwareOutputDevice which
|
||||
// then calls OnPaint.
|
||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
||||
frame.Pass());
|
||||
std::move(frame));
|
||||
} else {
|
||||
if (!copy_frame_generator_.get()) {
|
||||
copy_frame_generator_.reset(
|
||||
|
@ -676,7 +682,7 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
|||
damage_rect.Intersect(gfx::Rect(frame_size));
|
||||
|
||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
||||
frame.Pass());
|
||||
std::move(frame));
|
||||
|
||||
// Request a copy of the last compositor frame which will eventually call
|
||||
// OnPaint asynchronously.
|
||||
|
@ -869,7 +875,7 @@ bool CefRenderWidgetHostViewOSR::CanCopyToVideoFrame() const {
|
|||
|
||||
void CefRenderWidgetHostViewOSR::BeginFrameSubscription(
|
||||
scoped_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) {
|
||||
delegated_frame_host_->BeginFrameSubscription(subscriber.Pass());
|
||||
delegated_frame_host_->BeginFrameSubscription(std::move(subscriber));
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::EndFrameSubscription() {
|
||||
|
@ -1428,7 +1434,7 @@ void CefRenderWidgetHostViewOSR::CancelWidget() {
|
|||
if (render_widget_host_ && !is_destroyed_) {
|
||||
is_destroyed_ = true;
|
||||
// Results in a call to Destroy().
|
||||
render_widget_host_->Shutdown();
|
||||
render_widget_host_->ShutdownAndDestroyWidget(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "include/cef_browser.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/browser/compositor/delegated_frame_host.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
|
@ -122,7 +123,7 @@ class CefRenderWidgetHostViewOSR
|
|||
|
||||
// RenderWidgetHostViewBase implementation.
|
||||
void OnSwapCompositorFrame(
|
||||
uint32 output_surface_id,
|
||||
uint32_t output_surface_id,
|
||||
scoped_ptr<cc::CompositorFrame> frame) override;
|
||||
void ClearCompositorFrame() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
@ -266,7 +269,7 @@ bool CefRenderWidgetHostViewOSR::GetLineBreakIndex(
|
|||
// 75% of maximum height.
|
||||
const size_t loop_end_idx = std::min(bounds.size(), range.end());
|
||||
int max_height = 0;
|
||||
int min_y_offset = kint32max;
|
||||
int min_y_offset = std::numeric_limits<int32_t>::max();
|
||||
for (size_t idx = range.start(); idx < loop_end_idx; ++idx) {
|
||||
max_height = std::max(max_height, bounds[idx].height());
|
||||
min_y_offset = std::min(min_y_offset, bounds[idx].y());
|
||||
|
@ -337,5 +340,5 @@ void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
|||
browser_compositor_->compositor()->SetVisible(false);
|
||||
browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0));
|
||||
browser_compositor_->compositor()->SetRootLayer(NULL);
|
||||
content::BrowserCompositorMac::Recycle(browser_compositor_.Pass());
|
||||
content::BrowserCompositorMac::Recycle(std::move(browser_compositor_));
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
#include "chrome/browser/renderer_host/pepper/device_id_fetcher.h"
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/prefs/pref_service.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#if defined(OS_CHROMEOS)
|
||||
#include "chromeos/cryptohome/system_salt_getter.h"
|
||||
|
@ -149,7 +151,7 @@ void DeviceIDFetcher::ComputeOnUIThread(const std::string& salt,
|
|||
|
||||
// Build the identifier as follows:
|
||||
// SHA256(machine-id||service||SHA256(machine-id||service||salt))
|
||||
std::vector<uint8> salt_bytes;
|
||||
std::vector<uint8_t> salt_bytes;
|
||||
if (!base::HexStringToBytes(salt, &salt_bytes))
|
||||
salt_bytes.clear();
|
||||
if (salt_bytes.size() != kSaltLength) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "libcef/browser/pepper/pepper_flash_browser_host.h"
|
||||
|
||||
#include "base/time/time.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#ifndef CEF_LIBCEF_BROWSER_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_
|
||||
#define CEF_LIBCEF_BROWSER_PEPPER_PEPPER_FLASH_BROWSER_HOST_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "ppapi/host/host_message_context.h"
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libcef/browser/pepper/pepper_isolated_file_system_message_filter.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
|
|
|
@ -5,10 +5,13 @@
|
|||
#ifndef CEF_LIBCEF_BROWSER_PEPPER_PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PEPPER_PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/macros.h"
|
||||
#include "ppapi/c/pp_instance.h"
|
||||
#include "ppapi/c/pp_resource.h"
|
||||
#include "ppapi/c/private/ppb_isolated_file_system_private.h"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "libcef/browser/plugins/plugin_info_message_filter.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/web_plugin_impl.h"
|
||||
|
@ -16,6 +18,7 @@
|
|||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/thread_task_runner_handle.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/content_settings/core/browser/content_settings_utils.h"
|
||||
|
@ -533,10 +536,10 @@ void CefPluginInfoMessageFilter::Context::GetPluginContentSetting(
|
|||
!legacy_ask_user;
|
||||
uses_plugin_specific_setting = specific_setting && !use_policy;
|
||||
if (uses_plugin_specific_setting) {
|
||||
value = specific_setting.Pass();
|
||||
value = std::move(specific_setting);
|
||||
info = specific_info;
|
||||
} else {
|
||||
value = general_setting.Pass();
|
||||
value = std::move(general_setting);
|
||||
info = general_info;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
#include "include/internal/cef_types_wrappers.h"
|
||||
#include "libcef/browser/printing/print_view_manager.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/lazy_instance.h"
|
||||
|
@ -67,7 +70,7 @@ void FillInDictionaryFromPdfPrintSettings(
|
|||
scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
||||
dict->SetInteger(kSettingMediaSizeWidthMicrons, pdf_settings.page_width);
|
||||
dict->SetInteger(kSettingMediaSizeHeightMicrons, pdf_settings.page_height);
|
||||
print_settings.Set(kSettingMediaSize, dict.Pass());
|
||||
print_settings.Set(kSettingMediaSize, std::move(dict));
|
||||
}
|
||||
|
||||
int margin_type = DEFAULT_MARGINS;
|
||||
|
@ -92,7 +95,7 @@ void FillInDictionaryFromPdfPrintSettings(
|
|||
dict->SetDouble(kSettingMarginRight, pdf_settings.margin_right);
|
||||
dict->SetDouble(kSettingMarginBottom, pdf_settings.margin_bottom);
|
||||
dict->SetDouble(kSettingMarginLeft, pdf_settings.margin_left);
|
||||
print_settings.Set(kSettingMarginsCustom, dict.Pass());
|
||||
print_settings.Set(kSettingMarginsCustom, std::move(dict));
|
||||
}
|
||||
|
||||
// Service settings.
|
||||
|
@ -116,7 +119,7 @@ void StopWorker(int document_cookie) {
|
|||
}
|
||||
|
||||
scoped_refptr<base::RefCountedBytes>
|
||||
GetDataFromHandle(base::SharedMemoryHandle handle, uint32 data_size) {
|
||||
GetDataFromHandle(base::SharedMemoryHandle handle, uint32_t data_size) {
|
||||
scoped_ptr<base::SharedMemory> shared_buf(
|
||||
new base::SharedMemory(handle, true));
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#define CEF_LIBCEF_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
|
||||
|
||||
#include "libcef/browser/printing/print_view_manager_base.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "content/public/browser/web_contents_user_data.h"
|
||||
|
||||
struct PrintHostMsg_DidPreviewDocument_Params;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libcef/browser/printing/print_view_manager_base.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
|
||||
#include "base/auto_reset.h"
|
||||
|
@ -172,7 +174,7 @@ void PrintViewManagerBase::OnDidPrintPage(
|
|||
#else
|
||||
// Update the rendered document. It will send notifications to the listener.
|
||||
document->SetPage(params.page_number,
|
||||
metafile.Pass(),
|
||||
std::move(metafile),
|
||||
params.page_size,
|
||||
params.content_area);
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#ifndef CEF_LIBCEF_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
||||
#define CEF_LIBCEF_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/prefs/pref_member.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/printing/browser/print_manager.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "libcef/browser/printing/printing_message_filter.h"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
|
@ -204,7 +205,7 @@ void PrintingMessageFilter::OnUpdatePrintSettings(
|
|||
printer_query = queue_->CreatePrinterQuery(host_id, routing_id);
|
||||
}
|
||||
printer_query->SetSettings(
|
||||
new_settings.Pass(),
|
||||
std::move(new_settings),
|
||||
base::Bind(&PrintingMessageFilter::OnUpdatePrintSettingsReply, this,
|
||||
printer_query, reply_msg));
|
||||
}
|
||||
|
@ -237,7 +238,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply(
|
|||
}
|
||||
}
|
||||
|
||||
void PrintingMessageFilter::OnCheckForCancel(int32 preview_ui_id,
|
||||
void PrintingMessageFilter::OnCheckForCancel(int32_t preview_ui_id,
|
||||
int preview_request_id,
|
||||
bool* cancel) {
|
||||
*cancel = false;
|
||||
|
|
|
@ -5,9 +5,13 @@
|
|||
#ifndef CEF_LIBCEF_BROWSER_PRINTING_PRINTING_MESSAGE_FILTER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PRINTING_PRINTING_MESSAGE_FILTER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/browser_message_filter.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
@ -82,7 +86,7 @@ class PrintingMessageFilter : public content::BrowserMessageFilter {
|
|||
void OnUpdatePrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
void OnCheckForCancel(int32 preview_ui_id,
|
||||
void OnCheckForCancel(int32_t preview_ui_id,
|
||||
int preview_request_id,
|
||||
bool* cancel);
|
||||
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/resource_dispatcher_host_delegate.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
#include "libcef/browser/origin_whitelist_impl.h"
|
||||
|
@ -13,6 +18,7 @@
|
|||
|
||||
#include "base/guid.h"
|
||||
#include "base/memory/scoped_vector.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/browser/plugin_service_filter.h"
|
||||
#include "content/public/browser/resource_request_info.h"
|
||||
|
@ -28,7 +34,7 @@
|
|||
namespace {
|
||||
|
||||
void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream,
|
||||
int64 expected_content_size,
|
||||
int64_t expected_content_size,
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const std::string& extension_id,
|
||||
|
@ -59,7 +65,7 @@ void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream,
|
|||
int tab_id = -1;
|
||||
|
||||
streams_private->ExecuteMimeTypeHandler(
|
||||
extension_id, tab_id, stream.Pass(), view_id, expected_content_size,
|
||||
extension_id, tab_id, std::move(stream), view_id, expected_content_size,
|
||||
embedded, render_process_id, render_frame_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <map>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "content/public/browser/resource_dispatcher_host_delegate.h"
|
||||
|
||||
// Implements ResourceDispatcherHostDelegate.
|
||||
|
|
|
@ -24,6 +24,28 @@ void CreateTemporaryFileOnFileThread(
|
|||
message_loop_proxy->PostTask(FROM_HERE, base::Bind(callback, file_path));
|
||||
}
|
||||
|
||||
// Release the wrapped callback object after completion.
|
||||
class CefCompletionCallbackWrapper : public CefCompletionCallback {
|
||||
public:
|
||||
explicit CefCompletionCallbackWrapper(
|
||||
CefRefPtr<CefCompletionCallback> callback)
|
||||
: callback_(callback) {
|
||||
}
|
||||
|
||||
void OnComplete() override {
|
||||
if (callback_) {
|
||||
callback_->OnComplete();
|
||||
callback_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<CefCompletionCallback> callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefCompletionCallbackWrapper);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefCompletionCallbackWrapper);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
using content::TracingController;
|
||||
|
@ -52,6 +74,9 @@ bool CefTraceSubscriber::BeginTracing(
|
|||
|
||||
TracingController::StartTracingDoneCallback done_callback;
|
||||
if (callback.get()) {
|
||||
// Work around a bug introduced in http://crbug.com/542390#c22 that keeps a
|
||||
// reference to |done_callback| after execution.
|
||||
callback = new CefCompletionCallbackWrapper(callback);
|
||||
done_callback =
|
||||
base::Bind(&CefCompletionCallback::OnComplete, callback.get());
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ struct ParamTraits<net::UploadElement> {
|
|||
default: {
|
||||
DCHECK(type == net::UploadElement::TYPE_FILE);
|
||||
base::FilePath file_path;
|
||||
uint64 offset, length;
|
||||
uint64_t offset, length;
|
||||
base::Time expected_modification_time;
|
||||
if (!ReadParam(m, iter, &file_path))
|
||||
return false;
|
||||
|
@ -94,7 +94,7 @@ bool ParamTraits<scoped_refptr<net::UploadData> >::Read(
|
|||
ScopedVector<net::UploadElement> elements;
|
||||
if (!ReadParam(m, iter, &elements))
|
||||
return false;
|
||||
int64 identifier;
|
||||
int64_t identifier;
|
||||
if (!ReadParam(m, iter, &identifier))
|
||||
return false;
|
||||
bool is_chunked = false;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// IPC messages for CEF.
|
||||
// Multiply-included message file, hence no include guard.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libcef/common/net/upload_data.h"
|
||||
|
||||
#include "base/memory/shared_memory.h"
|
||||
|
@ -63,7 +65,7 @@ IPC_STRUCT_BEGIN(Cef_Request_Params)
|
|||
IPC_STRUCT_MEMBER(int, request_id)
|
||||
|
||||
// Unique id of the target frame. -1 if unknown / invalid.
|
||||
IPC_STRUCT_MEMBER(int64, frame_id)
|
||||
IPC_STRUCT_MEMBER(int64_t, frame_id)
|
||||
|
||||
// True if the request is user-initiated instead of internal.
|
||||
IPC_STRUCT_MEMBER(bool, user_initiated)
|
||||
|
@ -126,7 +128,7 @@ IPC_STRUCT_BEGIN(CefMsg_LoadRequest_Params)
|
|||
|
||||
// Identifies the frame within the RenderView that sent the request.
|
||||
// -1 if unknown / invalid.
|
||||
IPC_STRUCT_MEMBER(int64, frame_id)
|
||||
IPC_STRUCT_MEMBER(int64_t, frame_id)
|
||||
|
||||
// Usually the URL of the document in the top-level window, which may be
|
||||
// checked by the third-party cookie blocking policy. Leaving it empty may
|
||||
|
@ -251,13 +253,13 @@ IPC_SYNC_MESSAGE_CONTROL1_3(
|
|||
|
||||
// Sent when a frame is identified for the first time.
|
||||
IPC_MESSAGE_ROUTED3(CefHostMsg_FrameIdentified,
|
||||
int64 /* frame_id */,
|
||||
int64 /* parent_frame_id */,
|
||||
int64_t /* frame_id */,
|
||||
int64_t /* parent_frame_id */,
|
||||
base::string16 /* frame_name */)
|
||||
|
||||
// Sent when a frame has finished loading. Based on ViewHostMsg_DidFinishLoad.
|
||||
IPC_MESSAGE_ROUTED4(CefHostMsg_DidFinishLoad,
|
||||
int64 /* frame_id */,
|
||||
int64_t /* frame_id */,
|
||||
GURL /* validated_url */,
|
||||
bool /* is_main_frame */,
|
||||
int /* http_status_code */)
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "include/cef_stream.h"
|
||||
#include "include/cef_version.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
|
@ -53,7 +56,7 @@ const char kPDFPluginExtension[] = "pdf";
|
|||
const char kPDFPluginDescription[] = "Portable Document Format";
|
||||
const char kPDFPluginOutOfProcessMimeType[] =
|
||||
"application/x-google-chrome-pdf";
|
||||
const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
|
||||
const uint32_t kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
|
||||
ppapi::PERMISSION_DEV;
|
||||
|
||||
content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface;
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#ifndef CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
|
||||
#define CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/crash/content/app/crash_reporter_client.h"
|
||||
|
||||
class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "libcef/common/extensions/extensions_client.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/lazy_instance.h"
|
||||
|
@ -118,7 +120,7 @@ scoped_ptr<FeatureProvider> CefExtensionsClient::CreateFeatureProvider(
|
|||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
return provider.Pass();
|
||||
return provider;
|
||||
}
|
||||
|
||||
scoped_ptr<JSONFeatureProviderSource>
|
||||
|
@ -142,7 +144,7 @@ CefExtensionsClient::CreateFeatureProviderSource(
|
|||
NOTREACHED();
|
||||
source.reset();
|
||||
}
|
||||
return source.Pass();
|
||||
return source;
|
||||
}
|
||||
|
||||
void CefExtensionsClient::FilterHostPermissions(
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#ifndef CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_CLIENT_H_
|
||||
#define CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_CLIENT_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "extensions/common/extensions_client.h"
|
||||
#include "extensions/common/permissions/extensions_api_permissions.h"
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void UploadData::AppendBytes(const char* bytes, int bytes_len) {
|
|||
}
|
||||
|
||||
void UploadData::AppendFileRange(const base::FilePath& file_path,
|
||||
uint64 offset, uint64 length,
|
||||
uint64_t offset, uint64_t length,
|
||||
const base::Time& expected_modification_time) {
|
||||
DCHECK(!is_chunked_);
|
||||
elements_.push_back(new UploadElement());
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
#ifndef CEF_LIBCEF_COMMON_NET_UPLOAD_DATA_H_
|
||||
#define CEF_LIBCEF_COMMON_NET_UPLOAD_DATA_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libcef/common/net/upload_element.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_vector.h"
|
||||
#include "base/supports_user_data.h"
|
||||
|
@ -36,7 +37,7 @@ class NET_EXPORT UploadData
|
|||
void AppendBytes(const char* bytes, int bytes_len);
|
||||
|
||||
void AppendFileRange(const base::FilePath& file_path,
|
||||
uint64 offset, uint64 length,
|
||||
uint64_t offset, uint64_t length,
|
||||
const base::Time& expected_modification_time);
|
||||
|
||||
// Initializes the object to send chunks of upload data over time rather
|
||||
|
@ -63,8 +64,8 @@ class NET_EXPORT UploadData
|
|||
// Identifies a particular upload instance, which is used by the cache to
|
||||
// formulate a cache key. This value should be unique across browser
|
||||
// sessions. A value of 0 is used to indicate an unspecified identifier.
|
||||
void set_identifier(int64 id) { identifier_ = id; }
|
||||
int64 identifier() const { return identifier_; }
|
||||
void set_identifier(int64_t id) { identifier_ = id; }
|
||||
int64_t identifier() const { return identifier_; }
|
||||
|
||||
private:
|
||||
friend class base::RefCounted<UploadData>;
|
||||
|
@ -72,7 +73,7 @@ class NET_EXPORT UploadData
|
|||
~UploadData() override;
|
||||
|
||||
ScopedVector<UploadElement> elements_;
|
||||
int64 identifier_;
|
||||
int64_t identifier_;
|
||||
bool is_chunked_;
|
||||
bool last_chunk_appended_;
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
#include "libcef/common/net/upload_element.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "net/base/file_stream.h"
|
||||
#include "net/base/net_errors.h"
|
||||
|
||||
|
@ -16,7 +14,7 @@ UploadElement::UploadElement()
|
|||
bytes_start_(NULL),
|
||||
bytes_length_(0),
|
||||
file_range_offset_(0),
|
||||
file_range_length_(kuint64max) {
|
||||
file_range_length_(std::numeric_limits<uint64_t>::max()) {
|
||||
}
|
||||
|
||||
UploadElement::~UploadElement() {
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#ifndef CEF_LIBCEF_COMMON_NET_UPLOAD_ELEMENT_H_
|
||||
#define CEF_LIBCEF_COMMON_NET_UPLOAD_ELEMENT_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/time/time.h"
|
||||
#include "net/base/net_export.h"
|
||||
|
@ -28,10 +30,10 @@ class NET_EXPORT UploadElement {
|
|||
Type type() const { return type_; }
|
||||
|
||||
const char* bytes() const { return bytes_start_ ? bytes_start_ : &buf_[0]; }
|
||||
uint64 bytes_length() const { return buf_.size() + bytes_length_; }
|
||||
uint64_t bytes_length() const { return buf_.size() + bytes_length_; }
|
||||
const base::FilePath& file_path() const { return file_path_; }
|
||||
uint64 file_range_offset() const { return file_range_offset_; }
|
||||
uint64 file_range_length() const { return file_range_length_; }
|
||||
uint64_t file_range_offset() const { return file_range_offset_; }
|
||||
uint64_t file_range_length() const { return file_range_length_; }
|
||||
// If NULL time is returned, we do not do the check.
|
||||
const base::Time& expected_file_modification_time() const {
|
||||
return expected_file_modification_time_;
|
||||
|
@ -52,14 +54,15 @@ class NET_EXPORT UploadElement {
|
|||
}
|
||||
|
||||
void SetToFilePath(const base::FilePath& path) {
|
||||
SetToFilePathRange(path, 0, kuint64max, base::Time());
|
||||
SetToFilePathRange(path, 0, std::numeric_limits<uint64_t>::max(),
|
||||
base::Time());
|
||||
}
|
||||
|
||||
// If expected_modification_time is NULL, we do not check for the file
|
||||
// change. Also note that the granularity for comparison is time_t, not
|
||||
// the full precision.
|
||||
void SetToFilePathRange(const base::FilePath& path,
|
||||
uint64 offset, uint64 length,
|
||||
uint64_t offset, uint64_t length,
|
||||
const base::Time& expected_modification_time) {
|
||||
type_ = TYPE_FILE;
|
||||
file_path_ = path;
|
||||
|
@ -72,10 +75,10 @@ class NET_EXPORT UploadElement {
|
|||
Type type_;
|
||||
std::vector<char> buf_;
|
||||
const char* bytes_start_;
|
||||
uint64 bytes_length_;
|
||||
uint64_t bytes_length_;
|
||||
base::FilePath file_path_;
|
||||
uint64 file_range_offset_;
|
||||
uint64 file_range_length_;
|
||||
uint64_t file_range_offset_;
|
||||
uint64_t file_range_length_;
|
||||
base::Time expected_file_modification_time_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(UploadElement);
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "libcef/common/cef_messages.h"
|
||||
|
@ -51,7 +53,7 @@ class BytesElementReader : public net::UploadBytesElementReader {
|
|||
explicit BytesElementReader(scoped_ptr<net::UploadElement> element)
|
||||
: net::UploadBytesElementReader(element->bytes(),
|
||||
element->bytes_length()),
|
||||
element_(element.Pass()) {
|
||||
element_(std::move(element)) {
|
||||
DCHECK_EQ(net::UploadElement::TYPE_BYTES, element_->type());
|
||||
}
|
||||
|
||||
|
@ -77,7 +79,7 @@ class FileElementReader : public net::UploadFileElementReader {
|
|||
element->file_range_offset(),
|
||||
element->file_range_length(),
|
||||
element->expected_file_modification_time()),
|
||||
element_(element.Pass()) {
|
||||
element_(std::move(element)) {
|
||||
DCHECK_EQ(net::UploadElement::TYPE_FILE, element_->type());
|
||||
}
|
||||
|
||||
|
@ -518,7 +520,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
|
|||
|
||||
Reset();
|
||||
|
||||
url_ = request.url().spec().utf16();
|
||||
url_ = request.url().string();
|
||||
method_ = request.httpMethod();
|
||||
|
||||
::GetHeaderMap(request, headermap_, referrer_url_);
|
||||
|
@ -531,7 +533,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
|
|||
static_cast<CefPostDataImpl*>(postdata_.get())->Set(body);
|
||||
}
|
||||
|
||||
first_party_for_cookies_ = request.firstPartyForCookies().spec().utf16();
|
||||
first_party_for_cookies_ = request.firstPartyForCookies().string();
|
||||
|
||||
if (request.cachePolicy() == blink::WebURLRequest::ReloadIgnoringCacheData)
|
||||
flags_ |= UR_FLAG_SKIP_CACHE;
|
||||
|
@ -757,7 +759,7 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
|
|||
fetcher.SetUploadFilePath(
|
||||
content_type,
|
||||
base::FilePath(impl->GetFile()),
|
||||
0, kuint64max,
|
||||
0, std::numeric_limits<uint64_t>::max(),
|
||||
GetFileTaskRunner());
|
||||
break;
|
||||
case PDE_TYPE_EMPTY:
|
||||
|
@ -815,10 +817,10 @@ void CefRequestImpl::SetTrackChanges(bool track_changes) {
|
|||
}
|
||||
}
|
||||
|
||||
uint8 CefRequestImpl::GetChanges() const {
|
||||
uint8_t CefRequestImpl::GetChanges() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
uint8 changes = changes_;
|
||||
uint8_t changes = changes_;
|
||||
if (postdata_.get() &&
|
||||
static_cast<CefPostDataImpl*>(postdata_.get())->HasChanges()) {
|
||||
changes |= kChangedPostData;
|
||||
|
@ -826,13 +828,13 @@ uint8 CefRequestImpl::GetChanges() const {
|
|||
return changes;
|
||||
}
|
||||
|
||||
void CefRequestImpl::Changed(uint8 changes) {
|
||||
void CefRequestImpl::Changed(uint8_t changes) {
|
||||
lock_.AssertAcquired();
|
||||
if (track_changes_)
|
||||
changes_ |= changes;
|
||||
}
|
||||
|
||||
bool CefRequestImpl::ShouldSet(uint8 changes, bool changed_only) const {
|
||||
bool CefRequestImpl::ShouldSet(uint8_t changes, bool changed_only) const {
|
||||
lock_.AssertAcquired();
|
||||
|
||||
// Always change if changes are not being tracked.
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#define CEF_LIBCEF_COMMON_REQUEST_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "include/cef_request.h"
|
||||
|
||||
#include "base/synchronization/lock.h"
|
||||
|
@ -111,11 +113,11 @@ class CefRequestImpl : public CefRequest {
|
|||
void SetReadOnly(bool read_only);
|
||||
|
||||
void SetTrackChanges(bool track_changes);
|
||||
uint8 GetChanges() const;
|
||||
uint8_t GetChanges() const;
|
||||
|
||||
private:
|
||||
void Changed(uint8 changes);
|
||||
bool ShouldSet(uint8 changes, bool changed_only) const;
|
||||
void Changed(uint8_t changes);
|
||||
bool ShouldSet(uint8_t changes, bool changed_only) const;
|
||||
|
||||
void Reset();
|
||||
|
||||
|
@ -140,7 +142,7 @@ class CefRequestImpl : public CefRequest {
|
|||
bool track_changes_;
|
||||
|
||||
// Bitmask of |Changes| values which indicate which fields have changed.
|
||||
uint8 changes_;
|
||||
uint8_t changes_;
|
||||
|
||||
mutable base::Lock lock_;
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ bool CefBrowserImpl::SendProcessMessage(CefProcessId target_process,
|
|||
CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
|
||||
blink::WebFrame* frame) {
|
||||
DCHECK(frame);
|
||||
int64 frame_id = webkit_glue::GetIdentifier(frame);
|
||||
int64_t frame_id = webkit_glue::GetIdentifier(frame);
|
||||
|
||||
// Frames are re-used between page loads. Only add the frame to the map once.
|
||||
FrameMap::const_iterator it = frames_.find(frame_id);
|
||||
|
@ -329,7 +329,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
|
|||
CefRefPtr<CefFrameImpl> framePtr(new CefFrameImpl(this, frame));
|
||||
frames_.insert(std::make_pair(frame_id, framePtr));
|
||||
|
||||
int64 parent_id = frame->parent() == NULL ?
|
||||
int64_t parent_id = frame->parent() == NULL ?
|
||||
webkit_glue::kInvalidFrameId :
|
||||
webkit_glue::GetIdentifier(frame->parent());
|
||||
base::string16 name = frame->uniqueName();
|
||||
|
@ -340,7 +340,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
|
|||
return framePtr;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64 frame_id) {
|
||||
CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) {
|
||||
if (frame_id == webkit_glue::kInvalidFrameId) {
|
||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
||||
return GetWebFrameImpl(render_view()->GetWebView()->mainFrame());
|
||||
|
@ -368,7 +368,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64 frame_id) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void CefBrowserImpl::AddFrameObject(int64 frame_id,
|
||||
void CefBrowserImpl::AddFrameObject(int64_t frame_id,
|
||||
CefTrackNode* tracked_object) {
|
||||
CefRefPtr<CefTrackManager> manager;
|
||||
|
||||
|
@ -453,7 +453,7 @@ void CefBrowserImpl::DidCommitProvisionalLoad(blink::WebLocalFrame* frame,
|
|||
}
|
||||
|
||||
void CefBrowserImpl::FrameDetached(WebFrame* frame) {
|
||||
int64 frame_id = webkit_glue::GetIdentifier(frame);
|
||||
int64_t frame_id = webkit_glue::GetIdentifier(frame);
|
||||
|
||||
if (!frames_.empty()) {
|
||||
// Remove the frame from the map.
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#define CEF_LIBCEF_RENDERER_BROWSER_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -89,10 +91,10 @@ class CefBrowserImpl : public CefBrowser,
|
|||
|
||||
// Returns the matching CefFrameImpl reference or creates a new one.
|
||||
CefRefPtr<CefFrameImpl> GetWebFrameImpl(blink::WebFrame* frame);
|
||||
CefRefPtr<CefFrameImpl> GetWebFrameImpl(int64 frame_id);
|
||||
CefRefPtr<CefFrameImpl> GetWebFrameImpl(int64_t frame_id);
|
||||
|
||||
// Frame objects will be deleted immediately before the frame is closed.
|
||||
void AddFrameObject(int64 frame_id, CefTrackNode* tracked_object);
|
||||
void AddFrameObject(int64_t frame_id, CefTrackNode* tracked_object);
|
||||
|
||||
int browser_id() const { return browser_id_; }
|
||||
bool is_popup() const { return is_popup_; }
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
@ -28,11 +30,13 @@
|
|||
#include "libcef/renderer/webkit_glue.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/metrics/user_metrics_action.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pepper_permission_util.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
|
@ -40,13 +44,13 @@
|
|||
#include "chrome/renderer/content_settings_observer.h"
|
||||
#include "chrome/renderer/loadtimes_extension_bindings.h"
|
||||
#include "chrome/renderer/pepper/chrome_pdf_print_client.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "chrome/renderer/spellchecker/spellcheck.h"
|
||||
#include "chrome/renderer/spellchecker/spellcheck_provider.h"
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "components/nacl/common/nacl_constants.h"
|
||||
#include "components/printing/renderer/print_web_view_helper.h"
|
||||
#include "components/web_cache/renderer/web_cache_render_process_observer.h"
|
||||
#include "content/child/worker_task_runner.h"
|
||||
#include "content/common/frame_messages.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
|
@ -135,19 +139,6 @@ void AppendParams(const std::vector<base::string16>& additional_names,
|
|||
existing_values->swap(values);
|
||||
}
|
||||
|
||||
std::string GetPluginInstancePosterAttribute(
|
||||
const blink::WebPluginParams& params) {
|
||||
DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size());
|
||||
|
||||
for (size_t i = 0; i < params.attributeNames.size(); ++i) {
|
||||
if (params.attributeNames[i].utf8() == "poster" &&
|
||||
!params.attributeValues[i].isEmpty()) {
|
||||
return params.attributeValues[i].utf8();
|
||||
}
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// Placeholder object for guest views.
|
||||
|
@ -676,13 +667,12 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
|||
params.mimeType = blink::WebString::fromUTF8(actual_mime_type.c_str());
|
||||
}
|
||||
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
auto create_blocked_plugin =
|
||||
[&render_frame, &frame, ¶ms, &info, &identifier, &group_name](
|
||||
auto create_blocked_plugin = [&render_frame, &frame, ¶ms, &info,
|
||||
&identifier, &group_name](
|
||||
int template_id, const base::string16& message) {
|
||||
return CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
render_frame, frame, params, info, identifier, group_name,
|
||||
template_id, message, PlaceholderPosterInfo());
|
||||
template_id, message, PowerSaverInfo());
|
||||
};
|
||||
switch (status) {
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kNotFound: {
|
||||
|
@ -696,52 +686,29 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
|||
// CefContentRendererClient::CreatePlugin instead, to
|
||||
// reduce the chance of future regressions.
|
||||
bool is_prerendering = false;
|
||||
bool is_flash =
|
||||
info.name == base::ASCIIToUTF16(content::kFlashPluginName);
|
||||
|
||||
std::string override_for_testing = command_line->GetSwitchValueASCII(
|
||||
switches::kOverridePluginPowerSaverForTesting);
|
||||
|
||||
// This feature has only been tested throughly with Flash thus far.
|
||||
// It is also enabled for the Power Saver test plugin for browser tests.
|
||||
bool can_throttle_plugin_type =
|
||||
is_flash || override_for_testing == "ignore-list";
|
||||
|
||||
bool power_saver_setting_on =
|
||||
status ==
|
||||
CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
|
||||
bool power_saver_enabled =
|
||||
override_for_testing == "always" ||
|
||||
(power_saver_setting_on && can_throttle_plugin_type);
|
||||
bool blocked_for_background_tab =
|
||||
power_saver_enabled && render_frame->IsHidden();
|
||||
|
||||
PlaceholderPosterInfo poster_info;
|
||||
if (power_saver_enabled) {
|
||||
poster_info.poster_attribute =
|
||||
GetPluginInstancePosterAttribute(params);
|
||||
poster_info.base_url = frame->document().url();
|
||||
}
|
||||
|
||||
if (blocked_for_background_tab || is_prerendering ||
|
||||
!poster_info.poster_attribute.empty()) {
|
||||
PowerSaverInfo power_saver_info =
|
||||
PowerSaverInfo::Get(render_frame, power_saver_setting_on, params,
|
||||
info, frame->document().url());
|
||||
if (power_saver_info.blocked_for_background_tab || is_prerendering ||
|
||||
!power_saver_info.poster_attribute.empty()) {
|
||||
placeholder = CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
render_frame, frame, params, info, identifier, group_name,
|
||||
poster_info.poster_attribute.empty() ? IDR_BLOCKED_PLUGIN_HTML
|
||||
power_saver_info.poster_attribute.empty()
|
||||
? IDR_BLOCKED_PLUGIN_HTML
|
||||
: IDR_PLUGIN_POSTER_HTML,
|
||||
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name),
|
||||
poster_info);
|
||||
placeholder->set_blocked_for_background_tab(
|
||||
blocked_for_background_tab);
|
||||
power_saver_info);
|
||||
placeholder->set_blocked_for_prerendering(is_prerendering);
|
||||
placeholder->set_power_saver_enabled(power_saver_enabled);
|
||||
placeholder->AllowLoading();
|
||||
break;
|
||||
}
|
||||
|
||||
scoped_ptr<content::PluginInstanceThrottler> throttler;
|
||||
if (power_saver_enabled) {
|
||||
if (power_saver_info.power_saver_enabled) {
|
||||
throttler = content::PluginInstanceThrottler::Create();
|
||||
// PluginPreroller manages its own lifetime.
|
||||
new CefPluginPreroller(
|
||||
|
@ -751,7 +718,7 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
|||
}
|
||||
|
||||
return render_frame->CreatePlugin(frame, info, params,
|
||||
throttler.Pass());
|
||||
std::move(throttler));
|
||||
}
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported: {
|
||||
content::RenderThread::Get()->RecordAction(
|
||||
|
@ -815,6 +782,9 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin(
|
|||
void CefContentRendererClient::BrowserCreated(
|
||||
content::RenderView* render_view,
|
||||
content::RenderFrame* render_frame) {
|
||||
if (!render_view || !render_frame)
|
||||
return;
|
||||
|
||||
// Swapped out RenderWidgets will be created in the parent/owner process for
|
||||
// frames that are hosted in a separate process (e.g. guest views or OOP
|
||||
// frames). Don't create any CEF objects for swapped out RenderWidgets.
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
#ifndef LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
#define LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "ppapi/host/host_factory.h"
|
||||
|
||||
namespace content {
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "libcef/renderer/plugins/cef_plugin_placeholder.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
#include "libcef/renderer/plugins/plugin_preroller.h"
|
||||
|
@ -95,7 +97,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
|||
const base::string16& name,
|
||||
int template_id,
|
||||
const base::string16& message,
|
||||
const PlaceholderPosterInfo& poster_info) {
|
||||
const PowerSaverInfo& power_saver_info) {
|
||||
base::DictionaryValue values;
|
||||
values.SetString("message", message);
|
||||
values.SetString("name", name);
|
||||
|
@ -106,16 +108,17 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
|||
? "document"
|
||||
: "embedded");
|
||||
|
||||
if (!poster_info.poster_attribute.empty()) {
|
||||
values.SetString("poster", poster_info.poster_attribute);
|
||||
values.SetString("baseurl", poster_info.base_url.spec());
|
||||
if (!power_saver_info.poster_attribute.empty()) {
|
||||
values.SetString("poster", power_saver_info.poster_attribute);
|
||||
values.SetString("baseurl", power_saver_info.base_url.spec());
|
||||
|
||||
if (!poster_info.custom_poster_size.IsEmpty()) {
|
||||
if (!power_saver_info.custom_poster_size.IsEmpty()) {
|
||||
float zoom_factor =
|
||||
blink::WebView::zoomLevelToZoomFactor(frame->view()->zoomLevel());
|
||||
int width = roundf(poster_info.custom_poster_size.width() / zoom_factor);
|
||||
int width =
|
||||
roundf(power_saver_info.custom_poster_size.width() / zoom_factor);
|
||||
int height =
|
||||
roundf(poster_info.custom_poster_size.height() / zoom_factor);
|
||||
roundf(power_saver_info.custom_poster_size.height() / zoom_factor);
|
||||
values.SetString("visibleWidth", base::IntToString(width) + "px");
|
||||
values.SetString("visibleHeight", base::IntToString(height) + "px");
|
||||
}
|
||||
|
@ -132,10 +135,15 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
|
|||
CefPluginPlaceholder* blocked_plugin = new CefPluginPlaceholder(
|
||||
render_frame, frame, params, html_data, name);
|
||||
|
||||
if (!poster_info.poster_attribute.empty())
|
||||
if (!power_saver_info.poster_attribute.empty())
|
||||
blocked_plugin->BlockForPowerSaverPoster();
|
||||
blocked_plugin->SetPluginInfo(info);
|
||||
blocked_plugin->SetIdentifier(identifier);
|
||||
|
||||
blocked_plugin->set_power_saver_enabled(power_saver_info.power_saver_enabled);
|
||||
blocked_plugin->set_blocked_for_background_tab(
|
||||
power_saver_info.blocked_for_background_tab);
|
||||
|
||||
return blocked_plugin;
|
||||
}
|
||||
|
||||
|
@ -271,7 +279,7 @@ blink::WebPlugin* CefPluginPlaceholder::CreatePlugin() {
|
|||
throttler.get());
|
||||
}
|
||||
return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(),
|
||||
GetPluginParams(), throttler.Pass());
|
||||
GetPluginParams(), std::move(throttler));
|
||||
}
|
||||
|
||||
gin::ObjectTemplateBuilder CefPluginPlaceholder::GetObjectTemplateBuilder(
|
||||
|
|
|
@ -5,29 +5,16 @@
|
|||
#ifndef CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
||||
#define CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "components/plugins/renderer/loadable_plugin_placeholder.h"
|
||||
#include "content/public/renderer/context_menu_client.h"
|
||||
#include "content/public/renderer/render_process_observer.h"
|
||||
|
||||
namespace gfx {
|
||||
class Size;
|
||||
}
|
||||
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
|
||||
// This contains information specifying the poster image of plugin placeholders.
|
||||
// The default constructor specifies no poster image.
|
||||
struct PlaceholderPosterInfo {
|
||||
// The poster image specified in image 'srcset' attribute format.
|
||||
std::string poster_attribute;
|
||||
|
||||
// Used to resolve relative paths in |poster_attribute|.
|
||||
GURL base_url;
|
||||
|
||||
// Specify this to provide partially obscured plugins a centered poster image.
|
||||
gfx::Size custom_poster_size;
|
||||
};
|
||||
|
||||
class CefPluginPlaceholder final
|
||||
: public plugins::LoadablePluginPlaceholder,
|
||||
public content::RenderProcessObserver,
|
||||
|
@ -45,7 +32,7 @@ class CefPluginPlaceholder final
|
|||
const base::string16& name,
|
||||
int resource_id,
|
||||
const base::string16& message,
|
||||
const PlaceholderPosterInfo& poster_info);
|
||||
const PowerSaverInfo& power_saver_info);
|
||||
|
||||
// Creates a new WebViewPlugin with a MissingPlugin as a delegate.
|
||||
static CefPluginPlaceholder* CreateLoadableMissingPlugin(
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "base/base64.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/renderer/plugins/power_saver_info.h"
|
||||
#include "third_party/WebKit/public/platform/WebRect.h"
|
||||
#include "third_party/WebKit/public/web/WebElement.h"
|
||||
#include "third_party/WebKit/public/web/WebPlugin.h"
|
||||
|
@ -60,14 +61,15 @@ void CefPluginPreroller::OnThrottleStateChange() {
|
|||
if (!throttler_->IsThrottled())
|
||||
return;
|
||||
|
||||
PlaceholderPosterInfo poster_info;
|
||||
poster_info.poster_attribute = keyframe_data_url_.spec();
|
||||
poster_info.custom_poster_size = throttler_->GetSize();
|
||||
PowerSaverInfo power_saver_info;
|
||||
power_saver_info.power_saver_enabled = true;
|
||||
power_saver_info.poster_attribute = keyframe_data_url_.spec();
|
||||
power_saver_info.custom_poster_size = throttler_->GetSize();
|
||||
|
||||
CefPluginPlaceholder* placeholder =
|
||||
CefPluginPlaceholder::CreateBlockedPlugin(
|
||||
render_frame(), frame_, params_, info_, identifier_, name_,
|
||||
IDR_PLUGIN_POSTER_HTML, message_, poster_info);
|
||||
IDR_PLUGIN_POSTER_HTML, message_, power_saver_info);
|
||||
placeholder->SetPremadePlugin(throttler_);
|
||||
placeholder->set_power_saver_enabled(true);
|
||||
placeholder->AllowLoading();
|
||||
|
|
|
@ -54,7 +54,7 @@ void CefRenderMessageFilter::OnDevToolsAgentAttach(
|
|||
base::Bind(&CefRenderMessageFilter::OnDevToolsAgentAttach_RT, this));
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnDevToolsAgentDetach(int32 routing_id) {
|
||||
void CefRenderMessageFilter::OnDevToolsAgentDetach(int32_t routing_id) {
|
||||
CEF_POST_TASK_RT(
|
||||
base::Bind(&CefRenderMessageFilter::OnDevToolsAgentDetach_RT, this,
|
||||
routing_id));
|
||||
|
@ -65,7 +65,7 @@ void CefRenderMessageFilter::OnDevToolsAgentAttach_RT() {
|
|||
CefContentRendererClient::Get()->DevToolsAgentAttached();
|
||||
}
|
||||
|
||||
void CefRenderMessageFilter::OnDevToolsAgentDetach_RT(int32 routing_id) {
|
||||
void CefRenderMessageFilter::OnDevToolsAgentDetach_RT(int32_t routing_id) {
|
||||
CEF_REQUIRE_RT();
|
||||
|
||||
// Wait for the DevToolsAgent to detach. It would be better to receive
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
#ifndef CEF_LIBCEF_RENDERER_RENDER_MESSAGE_FILTER_H_
|
||||
#define CEF_LIBCEF_RENDERER_RENDER_MESSAGE_FILTER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ipc/ipc_channel_proxy.h"
|
||||
#include "ipc/message_filter.h"
|
||||
|
||||
|
@ -24,10 +27,10 @@ class CefRenderMessageFilter : public IPC::MessageFilter {
|
|||
private:
|
||||
// Message handlers called on the IO thread.
|
||||
void OnDevToolsAgentAttach(const std::string& host_id, int session_id);
|
||||
void OnDevToolsAgentDetach(int32 routing_id);
|
||||
void OnDevToolsAgentDetach(int32_t routing_id);
|
||||
|
||||
void OnDevToolsAgentAttach_RT();
|
||||
void OnDevToolsAgentDetach_RT(int32 routing_id);
|
||||
void OnDevToolsAgentDetach_RT(int32_t routing_id);
|
||||
|
||||
IPC::Sender* sender_;
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// be found in the LICENSE file.
|
||||
|
||||
#include "libcef/renderer/render_urlrequest_impl.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/response_impl.h"
|
||||
|
||||
|
@ -169,7 +172,7 @@ class CefRenderURLRequest::Context
|
|||
url_request_ = NULL;
|
||||
}
|
||||
|
||||
void OnDownloadProgress(int64 current) {
|
||||
void OnDownloadProgress(int64_t current) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
DCHECK(url_request_.get());
|
||||
|
||||
|
@ -186,7 +189,7 @@ class CefRenderURLRequest::Context
|
|||
client_->OnDownloadData(url_request_.get(), data, dataLength);
|
||||
}
|
||||
|
||||
void OnUploadProgress(int64 current, int64 total) {
|
||||
void OnUploadProgress(int64_t current, int64_t total) {
|
||||
DCHECK(CalledOnValidThread());
|
||||
DCHECK(url_request_.get());
|
||||
if (current == total)
|
||||
|
@ -226,10 +229,10 @@ class CefRenderURLRequest::Context
|
|||
CefRefPtr<CefResponse> response_;
|
||||
scoped_ptr<blink::WebURLLoader> loader_;
|
||||
scoped_ptr<CefWebURLLoaderClient> url_client_;
|
||||
int64 upload_data_size_;
|
||||
int64_t upload_data_size_;
|
||||
bool got_upload_progress_complete_;
|
||||
int64 download_data_received_;
|
||||
int64 download_data_total_;
|
||||
int64_t download_data_received_;
|
||||
int64_t download_data_total_;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -212,11 +212,11 @@ class CefV8IsolateManager {
|
|||
return;
|
||||
|
||||
if (!message_listener_registered_) {
|
||||
v8::V8::AddMessageListener(&MessageListenerCallbackImpl);
|
||||
isolate_->AddMessageListener(&MessageListenerCallbackImpl);
|
||||
message_listener_registered_ = true;
|
||||
}
|
||||
|
||||
v8::V8::SetCaptureStackTraceForUncaughtExceptions(true,
|
||||
isolate_->SetCaptureStackTraceForUncaughtExceptions(true,
|
||||
stack_size, v8::StackTrace::kDetailed);
|
||||
}
|
||||
|
||||
|
@ -477,18 +477,20 @@ void GetCefString(v8::Local<v8::String> str, CefString& out) {
|
|||
// V8 function callback.
|
||||
void FunctionCallbackImpl(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
||||
v8::Isolate* isolate = info.GetIsolate();
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
|
||||
CefV8Handler* handler =
|
||||
static_cast<CefV8Handler*>(v8::External::Cast(*info.Data())->Value());
|
||||
|
||||
CefV8ValueList params;
|
||||
for (int i = 0; i < info.Length(); i++)
|
||||
params.push_back(new CefV8ValueImpl(isolate, info[i]));
|
||||
params.push_back(new CefV8ValueImpl(isolate, context, info[i]));
|
||||
|
||||
CefString func_name;
|
||||
GetCefString(v8::Handle<v8::String>::Cast(info.Callee()->GetName()),
|
||||
func_name);
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, info.This());
|
||||
CefRefPtr<CefV8Value> object =
|
||||
new CefV8ValueImpl(isolate, context, info.This());
|
||||
CefRefPtr<CefV8Value> retval;
|
||||
CefString exception;
|
||||
|
||||
|
@ -511,8 +513,8 @@ void FunctionCallbackImpl(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
|||
}
|
||||
|
||||
// V8 Accessor callbacks
|
||||
void AccessorGetterCallbackImpl(
|
||||
v8::Local<v8::String> property,
|
||||
void AccessorNameGetterCallbackImpl(
|
||||
v8::Local<v8::Name> property,
|
||||
const v8::PropertyCallbackInfo<v8::Value>& info) {
|
||||
v8::Isolate* isolate = info.GetIsolate();
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
|
@ -527,9 +529,9 @@ void AccessorGetterCallbackImpl(
|
|||
|
||||
if (accessorPtr.get()) {
|
||||
CefRefPtr<CefV8Value> retval;
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, obj);
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||
CefString name, exception;
|
||||
GetCefString(property, name);
|
||||
GetCefString(v8::Local<v8::String>::Cast(property), name);
|
||||
if (accessorPtr->Get(name, object, retval, exception)) {
|
||||
if (!exception.empty()) {
|
||||
info.GetReturnValue().Set(
|
||||
|
@ -549,8 +551,8 @@ void AccessorGetterCallbackImpl(
|
|||
return info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
void AccessorSetterCallbackImpl(
|
||||
v8::Local<v8::String> property,
|
||||
void AccessorNameSetterCallbackImpl(
|
||||
v8::Local<v8::Name> property,
|
||||
v8::Local<v8::Value> value,
|
||||
const v8::PropertyCallbackInfo<void>& info) {
|
||||
v8::Isolate* isolate = info.GetIsolate();
|
||||
|
@ -565,10 +567,11 @@ void AccessorSetterCallbackImpl(
|
|||
accessorPtr = tracker->GetAccessor();
|
||||
|
||||
if (accessorPtr.get()) {
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, obj);
|
||||
CefRefPtr<CefV8Value> cefValue = new CefV8ValueImpl(isolate, value);
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(isolate, context, obj);
|
||||
CefRefPtr<CefV8Value> cefValue =
|
||||
new CefV8ValueImpl(isolate, context, value);
|
||||
CefString name, exception;
|
||||
GetCefString(property, name);
|
||||
GetCefString(v8::Local<v8::String>::Cast(property), name);
|
||||
accessorPtr->Set(name, object, cefValue, exception);
|
||||
if (!exception.empty()) {
|
||||
isolate->ThrowException(
|
||||
|
@ -633,7 +636,8 @@ class ExtensionWrapper : public v8::Extension {
|
|||
|
||||
class CefV8ExceptionImpl : public CefV8Exception {
|
||||
public:
|
||||
explicit CefV8ExceptionImpl(v8::Local<v8::Message> message)
|
||||
CefV8ExceptionImpl(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Message> message)
|
||||
: line_number_(0),
|
||||
start_position_(0),
|
||||
end_position_(0),
|
||||
|
@ -651,8 +655,8 @@ class CefV8ExceptionImpl : public CefV8Exception {
|
|||
line_number_ = message->GetLineNumber();
|
||||
start_position_ = message->GetStartPosition();
|
||||
end_position_ = message->GetEndPosition();
|
||||
start_column_ = message->GetStartColumn();
|
||||
end_column_ = message->GetEndColumn();
|
||||
start_column_ = message->GetStartColumn(context).FromJust();
|
||||
end_column_ = message->GetEndColumn(context).FromJust();
|
||||
}
|
||||
|
||||
CefString GetMessage() override { return message_; }
|
||||
|
@ -694,7 +698,8 @@ void MessageListenerCallbackImpl(v8::Handle<v8::Message> message,
|
|||
CefRefPtr<CefV8StackTrace> stackTrace =
|
||||
new CefV8StackTraceImpl(isolate, v8Stack);
|
||||
|
||||
CefRefPtr<CefV8Exception> exception = new CefV8ExceptionImpl(message);
|
||||
CefRefPtr<CefV8Exception> exception = new CefV8ExceptionImpl(
|
||||
static_cast<CefV8ContextImpl*>(context.get())->GetV8Context(), message);
|
||||
|
||||
if (CEF_CURRENTLY_ON_RT()) {
|
||||
handler->OnUncaughtException(context->GetBrowser(), context->GetFrame(),
|
||||
|
@ -917,7 +922,7 @@ CefRefPtr<CefV8Value> CefV8ContextImpl::GetGlobal() {
|
|||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Local<v8::Context> context = GetV8Context();
|
||||
v8::Context::Scope context_scope(context);
|
||||
return new CefV8ValueImpl(isolate, context->Global());
|
||||
return new CefV8ValueImpl(isolate, context, context->Global());
|
||||
}
|
||||
|
||||
bool CefV8ContextImpl::Enter() {
|
||||
|
@ -994,10 +999,10 @@ bool CefV8ContextImpl::Eval(const CefString& code,
|
|||
CallV8Function(context, func, obj, 1, &code_val, handle_->isolate());
|
||||
|
||||
if (try_catch.HasCaught()) {
|
||||
exception = new CefV8ExceptionImpl(try_catch.Message());
|
||||
exception = new CefV8ExceptionImpl(context, try_catch.Message());
|
||||
return false;
|
||||
} else if (!func_rv.IsEmpty()) {
|
||||
retval = new CefV8ValueImpl(isolate, func_rv.ToLocalChecked());
|
||||
retval = new CefV8ValueImpl(isolate, context, func_rv.ToLocalChecked());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1100,13 +1105,13 @@ void CefV8ValueImpl::Handle::SetWeakIfNecessary() {
|
|||
|
||||
// The added reference will be released in Destructor.
|
||||
AddRef();
|
||||
handle_.SetWeak(this, Destructor);
|
||||
handle_.SetWeak(this, Destructor, v8::WeakCallbackType::kParameter);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void CefV8ValueImpl::Handle::Destructor(
|
||||
const v8::WeakCallbackData<v8::Value, Handle>& data) {
|
||||
const v8::WeakCallbackInfo<Handle>& data) {
|
||||
data.GetParameter()->Release();
|
||||
}
|
||||
|
||||
|
@ -1307,12 +1312,13 @@ CefV8ValueImpl::CefV8ValueImpl(v8::Isolate* isolate)
|
|||
}
|
||||
|
||||
CefV8ValueImpl::CefV8ValueImpl(v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Value> value)
|
||||
: isolate_(isolate),
|
||||
type_(TYPE_INVALID),
|
||||
rethrow_exceptions_(false) {
|
||||
DCHECK(isolate_);
|
||||
InitFromV8Value(value);
|
||||
InitFromV8Value(context, value);
|
||||
}
|
||||
|
||||
CefV8ValueImpl::~CefV8ValueImpl() {
|
||||
|
@ -1322,7 +1328,8 @@ CefV8ValueImpl::~CefV8ValueImpl() {
|
|||
handle_->SetWeakIfNecessary();
|
||||
}
|
||||
|
||||
void CefV8ValueImpl::InitFromV8Value(v8::Local<v8::Value> value) {
|
||||
void CefV8ValueImpl::InitFromV8Value(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Value> value) {
|
||||
if (value->IsUndefined()) {
|
||||
InitUndefined();
|
||||
} else if (value->IsNull()) {
|
||||
|
@ -1332,16 +1339,17 @@ void CefV8ValueImpl::InitFromV8Value(v8::Local<v8::Value> value) {
|
|||
} else if (value->IsFalse()) {
|
||||
InitBool(false);
|
||||
} else if (value->IsBoolean()) {
|
||||
InitBool(value->ToBoolean()->Value());
|
||||
InitBool(value->ToBoolean(context).ToLocalChecked()->Value());
|
||||
} else if (value->IsInt32()) {
|
||||
InitInt(value->ToInt32()->Value());
|
||||
InitInt(value->ToInt32(context).ToLocalChecked()->Value());
|
||||
} else if (value->IsUint32()) {
|
||||
InitUInt(value->ToUint32()->Value());
|
||||
InitUInt(value->ToUint32(context).ToLocalChecked()->Value());
|
||||
} else if (value->IsNumber()) {
|
||||
InitDouble(value->ToNumber()->Value());
|
||||
InitDouble(value->ToNumber(context).ToLocalChecked()->Value());
|
||||
} else if (value->IsDate()) {
|
||||
// Convert from milliseconds to seconds.
|
||||
InitDate(CefTime(value->ToNumber()->Value() / 1000));
|
||||
InitDate(
|
||||
CefTime(value->ToNumber(context).ToLocalChecked()->Value() / 1000));
|
||||
} else if (value->IsString()) {
|
||||
CefString rv;
|
||||
GetCefString(value->ToString(), rv);
|
||||
|
@ -1655,9 +1663,16 @@ bool CefV8ValueImpl::HasValue(const CefString& key) {
|
|||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
return obj->Has(GetV8String(isolate, key));
|
||||
return obj->Has(context, GetV8String(isolate, key)).FromJust();
|
||||
}
|
||||
|
||||
bool CefV8ValueImpl::HasValue(int index) {
|
||||
|
@ -1668,10 +1683,18 @@ bool CefV8ValueImpl::HasValue(int index) {
|
|||
return false;
|
||||
}
|
||||
|
||||
v8::HandleScope handle_scope(handle_->isolate());
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
return obj->Has(index);
|
||||
return obj->Has(context, index).FromJust();
|
||||
}
|
||||
|
||||
bool CefV8ValueImpl::DeleteValue(const CefString& key) {
|
||||
|
@ -1679,13 +1702,20 @@ bool CefV8ValueImpl::DeleteValue(const CefString& key) {
|
|||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool del = obj->Delete(GetV8String(isolate, key));
|
||||
return (!HasCaught(try_catch) && del);
|
||||
return (!HasCaught(context, try_catch) && del);
|
||||
}
|
||||
|
||||
bool CefV8ValueImpl::DeleteValue(int index) {
|
||||
|
@ -1698,13 +1728,20 @@ bool CefV8ValueImpl::DeleteValue(int index) {
|
|||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool del = obj->Delete(index);
|
||||
return (!HasCaught(try_catch) && del);
|
||||
v8::Maybe<bool> del = obj->Delete(context, index);
|
||||
return (!HasCaught(context, try_catch) && del.FromJust());
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key) {
|
||||
|
@ -1712,14 +1749,21 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key) {
|
|||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
v8::Local<v8::Value> ret_value = obj->Get(GetV8String(isolate, key));
|
||||
if (!HasCaught(try_catch) && !ret_value.IsEmpty())
|
||||
return new CefV8ValueImpl(isolate, ret_value);
|
||||
if (!HasCaught(context, try_catch) && !ret_value.IsEmpty())
|
||||
return new CefV8ValueImpl(isolate, context, ret_value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1733,14 +1777,21 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index) {
|
|||
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
v8::Local<v8::Value> ret_value = obj->Get(v8::Number::New(isolate, index));
|
||||
if (!HasCaught(try_catch) && !ret_value.IsEmpty())
|
||||
return new CefV8ValueImpl(isolate, ret_value);
|
||||
if (!HasCaught(context, try_catch) && !ret_value.IsEmpty())
|
||||
return new CefV8ValueImpl(isolate, context, ret_value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1753,23 +1804,35 @@ bool CefV8ValueImpl::SetValue(const CefString& key,
|
|||
if (impl && impl->IsValid()) {
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool set;
|
||||
// TODO(cef): This usage may not exactly match the previous implementation.
|
||||
// Set will trigger interceptors and/or accessors whereas ForceSet will not.
|
||||
// It might be better to split this functionality into separate methods.
|
||||
// Set will trigger interceptors and/or accessors whereas DefineOwnProperty
|
||||
// will not. It might be better to split this functionality into separate
|
||||
// methods.
|
||||
if (attribute == V8_PROPERTY_ATTRIBUTE_NONE) {
|
||||
set = obj->Set(GetV8String(isolate, key), impl->GetV8Value(true));
|
||||
v8::Maybe<bool> set = obj->Set(context,
|
||||
GetV8String(isolate, key),
|
||||
impl->GetV8Value(true));
|
||||
return (!HasCaught(context, try_catch) && set.FromJust());
|
||||
} else {
|
||||
set = obj->ForceSet(GetV8String(isolate, key),
|
||||
v8::Maybe<bool> set = obj->DefineOwnProperty(
|
||||
context,
|
||||
GetV8String(isolate, key),
|
||||
impl->GetV8Value(true),
|
||||
static_cast<v8::PropertyAttribute>(attribute));
|
||||
return (!HasCaught(context, try_catch) && set.FromJust());
|
||||
}
|
||||
return (!HasCaught(try_catch) && set);
|
||||
} else {
|
||||
NOTREACHED() << "invalid input parameter";
|
||||
return false;
|
||||
|
@ -1788,13 +1851,20 @@ bool CefV8ValueImpl::SetValue(int index, CefRefPtr<CefV8Value> value) {
|
|||
if (impl && impl->IsValid()) {
|
||||
v8::Isolate* isolate = handle_->isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
if (context.IsEmpty()) {
|
||||
NOTREACHED() << "not currently in a V8 context";
|
||||
return false;
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> value = handle_->GetNewV8Handle(false);
|
||||
v8::Local<v8::Object> obj = value->ToObject();
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool set = obj->Set(index, impl->GetV8Value(true));
|
||||
return (!HasCaught(try_catch) && set);
|
||||
v8::Maybe<bool> set = obj->Set(context, index, impl->GetV8Value(true));
|
||||
return (!HasCaught(context, try_catch) && set.FromJust());
|
||||
} else {
|
||||
NOTREACHED() << "invalid input parameter";
|
||||
return false;
|
||||
|
@ -1827,17 +1897,18 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
|
|||
if (!accessorPtr.get())
|
||||
return false;
|
||||
|
||||
v8::AccessorGetterCallback getter = AccessorGetterCallbackImpl;
|
||||
v8::AccessorSetterCallback setter =
|
||||
v8::AccessorNameGetterCallback getter = AccessorNameGetterCallbackImpl;
|
||||
v8::AccessorNameSetterCallback setter =
|
||||
(attribute & V8_PROPERTY_ATTRIBUTE_READONLY) ?
|
||||
NULL : AccessorSetterCallbackImpl;
|
||||
NULL : AccessorNameSetterCallbackImpl;
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
try_catch.SetVerbose(true);
|
||||
bool set = obj->SetAccessor(GetV8String(isolate, key), getter, setter, obj,
|
||||
v8::Maybe<bool> set = obj->SetAccessor(
|
||||
context, GetV8String(isolate, key), getter, setter, obj,
|
||||
static_cast<v8::AccessControl>(settings),
|
||||
static_cast<v8::PropertyAttribute>(attribute));
|
||||
return (!HasCaught(try_catch) && set);
|
||||
return (!HasCaught(context, try_catch) && set.FromJust());
|
||||
}
|
||||
|
||||
bool CefV8ValueImpl::GetKeys(std::vector<CefString>& keys) {
|
||||
|
@ -2090,8 +2161,10 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
|
|||
CallV8Function(context_local, func, recv, argc, argv,
|
||||
handle_->isolate());
|
||||
|
||||
if (!HasCaught(try_catch) && !func_rv.IsEmpty())
|
||||
retval = new CefV8ValueImpl(isolate, func_rv.ToLocalChecked());
|
||||
if (!HasCaught(context_local, try_catch) && !func_rv.IsEmpty()) {
|
||||
retval = new CefV8ValueImpl(isolate, context_local,
|
||||
func_rv.ToLocalChecked());
|
||||
}
|
||||
}
|
||||
|
||||
if (argv)
|
||||
|
@ -2100,9 +2173,10 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::ExecuteFunctionWithContext(
|
|||
return retval;
|
||||
}
|
||||
|
||||
bool CefV8ValueImpl::HasCaught(v8::TryCatch& try_catch) {
|
||||
bool CefV8ValueImpl::HasCaught(v8::Local<v8::Context> context,
|
||||
v8::TryCatch& try_catch) {
|
||||
if (try_catch.HasCaught()) {
|
||||
last_exception_ = new CefV8ExceptionImpl(try_catch.Message());
|
||||
last_exception_ = new CefV8ExceptionImpl(context, try_catch.Message());
|
||||
if (rethrow_exceptions_)
|
||||
try_catch.ReThrow();
|
||||
return true;
|
||||
|
|
|
@ -205,12 +205,14 @@ class CefV8ValueImpl : public CefV8Value {
|
|||
public:
|
||||
explicit CefV8ValueImpl(v8::Isolate* isolate);
|
||||
CefV8ValueImpl(v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Value> value);
|
||||
~CefV8ValueImpl() override;
|
||||
|
||||
// Used for initializing the CefV8ValueImpl. Should be called a single time
|
||||
// after the CefV8ValueImpl is created.
|
||||
void InitFromV8Value(v8::Local<v8::Value> value);
|
||||
void InitFromV8Value(v8::Local<v8::Context> context,
|
||||
v8::Local<v8::Value> value);
|
||||
void InitUndefined();
|
||||
void InitNull();
|
||||
void InitBool(bool value);
|
||||
|
@ -279,7 +281,7 @@ class CefV8ValueImpl : public CefV8Value {
|
|||
|
||||
protected:
|
||||
// Test for and record any exception.
|
||||
bool HasCaught(v8::TryCatch& try_catch);
|
||||
bool HasCaught(v8::Local<v8::Context> context, v8::TryCatch& try_catch);
|
||||
|
||||
class Handle : public CefV8HandleBase {
|
||||
public:
|
||||
|
@ -302,7 +304,7 @@ class CefV8ValueImpl : public CefV8Value {
|
|||
|
||||
private:
|
||||
// Callback for weak persistent reference destruction.
|
||||
static void Destructor(const v8::WeakCallbackData<v8::Value, Handle>& data);
|
||||
static void Destructor(const v8::WeakCallbackInfo<Handle>& data);
|
||||
|
||||
persistentType handle_;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ MSVC_POP_WARNING();
|
|||
|
||||
namespace webkit_glue {
|
||||
|
||||
const int64 kInvalidFrameId = -1;
|
||||
const int64_t kInvalidFrameId = -1;
|
||||
|
||||
bool CanGoBack(blink::WebView* view) {
|
||||
if (!view)
|
||||
|
@ -123,7 +123,7 @@ bool SetNodeValue(blink::WebNode& node, const blink::WebString& value) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int64 GetIdentifier(blink::WebFrame* frame) {
|
||||
int64_t GetIdentifier(blink::WebFrame* frame) {
|
||||
// Each WebFrame will have an associated RenderFrame. The RenderFrame
|
||||
// routing IDs are unique within a given renderer process.
|
||||
content::RenderFrame* render_frame =
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
#ifndef CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_
|
||||
#define CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
#include "include/internal/cef_types.h"
|
||||
|
@ -21,7 +23,7 @@ class WebView;
|
|||
|
||||
namespace webkit_glue {
|
||||
|
||||
extern const int64 kInvalidFrameId;
|
||||
extern const int64_t kInvalidFrameId;
|
||||
|
||||
bool CanGoBack(blink::WebView* view);
|
||||
bool CanGoForward(blink::WebView* view);
|
||||
|
@ -37,7 +39,7 @@ blink::WebString GetNodeName(const blink::WebNode& node);
|
|||
blink::WebString CreateNodeMarkup(const blink::WebNode& node);
|
||||
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value);
|
||||
|
||||
int64 GetIdentifier(blink::WebFrame* frame);
|
||||
int64_t GetIdentifier(blink::WebFrame* frame);
|
||||
|
||||
// Find the frame with the specified |unique_name| relative to
|
||||
// |relative_to_frame| in the frame hierarchy.
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
|
||||
#include "libcef/utility/content_utility_client.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/chrome_utility_messages.h"
|
||||
#include "chrome/utility/utility_message_handler.h"
|
||||
#include "content/public/common/service_registry.h"
|
||||
|
@ -28,7 +31,7 @@ void CreateProxyResolverFactory(
|
|||
// is connected to. When that message pipe is closed, either explicitly on the
|
||||
// other end (in the browser process), or by a connection error, this object
|
||||
// will be destroyed.
|
||||
new net::MojoProxyResolverFactoryImpl(request.Pass());
|
||||
new net::MojoProxyResolverFactoryImpl(std::move(request));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -4,10 +4,15 @@
|
|||
|
||||
#include "libcef/utility/printing_handler.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/scoped_native_library.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_utility_printing_messages.h"
|
||||
#include "content/public/utility/utility_thread.h"
|
||||
|
@ -58,7 +63,7 @@ void PrintingHandler::OnRenderPDFPagesToMetafile(
|
|||
const printing::PdfRenderSettings& settings) {
|
||||
pdf_rendering_settings_ = settings;
|
||||
base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit);
|
||||
int page_count = LoadPDF(pdf_file.Pass());
|
||||
int page_count = LoadPDF(std::move(pdf_file));
|
||||
Send(
|
||||
new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count));
|
||||
}
|
||||
|
@ -69,7 +74,7 @@ void PrintingHandler::OnRenderPDFPagesToMetafileGetPage(
|
|||
base::File emf_file = IPC::PlatformFileForTransitToFile(output_file);
|
||||
double scale_factor = 1.0;
|
||||
bool success =
|
||||
RenderPdfPageToMetafile(page_number, emf_file.Pass(), &scale_factor);
|
||||
RenderPdfPageToMetafile(page_number, std::move(emf_file), &scale_factor);
|
||||
Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone(
|
||||
success, scale_factor));
|
||||
}
|
||||
|
@ -79,7 +84,7 @@ void PrintingHandler::OnRenderPDFPagesToMetafileStop() {
|
|||
}
|
||||
|
||||
int PrintingHandler::LoadPDF(base::File pdf_file) {
|
||||
int64 length = pdf_file.GetLength();
|
||||
int64_t length = pdf_file.GetLength();
|
||||
if (length < 0)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -36,13 +36,14 @@ patches = [
|
|||
{
|
||||
# Fix ninja output for localization directories on OS X.
|
||||
# http://code.google.com/p/gyp/issues/detail?id=331
|
||||
# Improve error reporting when MSVS configuration fails on Windows.
|
||||
# https://code.google.com/p/gyp/issues/detail?id=471
|
||||
'name': 'gyp_331',
|
||||
'path': '../tools/gyp/pylib/',
|
||||
},
|
||||
{
|
||||
# Enable popups in offscreen rendering on OS X.
|
||||
#
|
||||
# Fix dismissal of select popups on blur with OSR.
|
||||
# https://codereview.chromium.org/1565053002
|
||||
'name': 'webkit_popups',
|
||||
'path': '../third_party/WebKit/',
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
|
||||
index 8971b07f..f37aa2a 100644
|
||||
index 6d4a181..952a058 100644
|
||||
--- render_widget_host_view_guest.cc
|
||||
+++ render_widget_host_view_guest.cc
|
||||
@@ -191,6 +191,9 @@ void RenderWidgetHostViewGuest::Destroy() {
|
||||
@@ -218,6 +218,9 @@ void RenderWidgetHostViewGuest::Destroy() {
|
||||
}
|
||||
|
||||
gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
|
||||
index 61dbe6c..59d1673 100644
|
||||
index 33262a8..5da1220 100644
|
||||
--- browser/browser_plugin/browser_plugin_guest.cc
|
||||
+++ browser/browser_plugin/browser_plugin_guest.cc
|
||||
@@ -23,7 +23,7 @@
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
|
@ -11,7 +11,7 @@ index 61dbe6c..59d1673 100644
|
|||
#include "content/common/browser_plugin/browser_plugin_constants.h"
|
||||
#include "content/common/browser_plugin/browser_plugin_messages.h"
|
||||
#include "content/common/content_constants_internal.h"
|
||||
@@ -290,20 +290,19 @@ void BrowserPluginGuest::InitInternal(
|
||||
@@ -294,20 +294,19 @@ void BrowserPluginGuest::InitInternal(
|
||||
guest_window_rect_ = params.view_rect;
|
||||
|
||||
if (owner_web_contents_ != owner_web_contents) {
|
||||
|
@ -36,7 +36,7 @@ index 61dbe6c..59d1673 100644
|
|||
}
|
||||
|
||||
RendererPreferences* renderer_prefs =
|
||||
@@ -787,11 +786,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
@@ -791,11 +790,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||
static_cast<RenderViewHostImpl*>(GetWebContents()->GetRenderViewHost())
|
||||
->GetWidget()
|
||||
->Init();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue