mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 3a87aecc (#433059)
This commit is contained in:
23
BUILD.gn
23
BUILD.gn
@ -99,8 +99,12 @@ import("//build/config/locales.gni")
|
|||||||
import("//build/config/sanitizers/sanitizers.gni")
|
import("//build/config/sanitizers/sanitizers.gni")
|
||||||
import("//build/config/ui.gni")
|
import("//build/config/ui.gni")
|
||||||
import("//cef/cef_repack_locales.gni")
|
import("//cef/cef_repack_locales.gni")
|
||||||
|
import("//chrome/common/features.gni")
|
||||||
|
import("//extensions/features/features.gni")
|
||||||
import("//media/media_options.gni")
|
import("//media/media_options.gni")
|
||||||
import("//mojo/public/tools/bindings/mojom.gni")
|
import("//mojo/public/tools/bindings/mojom.gni")
|
||||||
|
import("//ppapi/features/features.gni")
|
||||||
|
import("//printing/features/features.gni")
|
||||||
import("//third_party/icu/config.gni")
|
import("//third_party/icu/config.gni")
|
||||||
import("//third_party/widevine/cdm/widevine.gni")
|
import("//third_party/widevine/cdm/widevine.gni")
|
||||||
import("//tools/grit/repack.gni")
|
import("//tools/grit/repack.gni")
|
||||||
@ -318,10 +322,10 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/net/network_delegate.h",
|
"libcef/browser/net/network_delegate.h",
|
||||||
"libcef/browser/net/resource_request_job.cc",
|
"libcef/browser/net/resource_request_job.cc",
|
||||||
"libcef/browser/net/resource_request_job.h",
|
"libcef/browser/net/resource_request_job.h",
|
||||||
"libcef/browser/net/response_filter_wrapper.cc",
|
|
||||||
"libcef/browser/net/response_filter_wrapper.h",
|
|
||||||
"libcef/browser/net/scheme_handler.cc",
|
"libcef/browser/net/scheme_handler.cc",
|
||||||
"libcef/browser/net/scheme_handler.h",
|
"libcef/browser/net/scheme_handler.h",
|
||||||
|
"libcef/browser/net/source_stream.cc",
|
||||||
|
"libcef/browser/net/source_stream.h",
|
||||||
"libcef/browser/net/url_request_context.cc",
|
"libcef/browser/net/url_request_context.cc",
|
||||||
"libcef/browser/net/url_request_context.h",
|
"libcef/browser/net/url_request_context.h",
|
||||||
"libcef/browser/net/url_request_context_getter.h",
|
"libcef/browser/net/url_request_context_getter.h",
|
||||||
@ -608,12 +612,13 @@ static_library("libcef_static") {
|
|||||||
"//content/public/renderer",
|
"//content/public/renderer",
|
||||||
"//content/public/utility",
|
"//content/public/utility",
|
||||||
"//crypto",
|
"//crypto",
|
||||||
"//device/core",
|
"//device/base",
|
||||||
"//device/geolocation",
|
"//device/geolocation",
|
||||||
"//device/hid",
|
"//device/hid",
|
||||||
"//extensions/browser",
|
"//extensions/browser",
|
||||||
|
"//extensions/browser/api:api_registration",
|
||||||
"//extensions/common/api",
|
"//extensions/common/api",
|
||||||
"//extensions/common/api:api_registration",
|
"//extensions/features",
|
||||||
"//extensions/renderer",
|
"//extensions/renderer",
|
||||||
"//extensions/utility",
|
"//extensions/utility",
|
||||||
"//gpu",
|
"//gpu",
|
||||||
@ -624,6 +629,8 @@ static_library("libcef_static") {
|
|||||||
"//net:net_browser_services",
|
"//net:net_browser_services",
|
||||||
"//net:net_with_v8",
|
"//net:net_with_v8",
|
||||||
"//pdf",
|
"//pdf",
|
||||||
|
"//ppapi/features",
|
||||||
|
"//printing/features",
|
||||||
"//skia",
|
"//skia",
|
||||||
"//storage/browser",
|
"//storage/browser",
|
||||||
"//third_party/brotli",
|
"//third_party/brotli",
|
||||||
@ -632,7 +639,7 @@ static_library("libcef_static") {
|
|||||||
"//third_party/leveldatabase",
|
"//third_party/leveldatabase",
|
||||||
"//third_party/libxml",
|
"//third_party/libxml",
|
||||||
"//third_party/WebKit/public:blink",
|
"//third_party/WebKit/public:blink",
|
||||||
"//third_party/widevine/cdm:version_h",
|
"//third_party/widevine/cdm:headers",
|
||||||
"//third_party/icu",
|
"//third_party/icu",
|
||||||
"//third_party/zlib:minizip",
|
"//third_party/zlib:minizip",
|
||||||
"//ui/base",
|
"//ui/base",
|
||||||
@ -672,8 +679,10 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/osr/browser_platform_delegate_osr_win.cc",
|
"libcef/browser/osr/browser_platform_delegate_osr_win.cc",
|
||||||
"libcef/browser/osr/browser_platform_delegate_osr_win.h",
|
"libcef/browser/osr/browser_platform_delegate_osr_win.h",
|
||||||
"libcef/browser/osr/render_widget_host_view_osr_win.cc",
|
"libcef/browser/osr/render_widget_host_view_osr_win.cc",
|
||||||
"libcef/utility/printing_handler.cc",
|
|
||||||
"libcef/utility/printing_handler.h",
|
# Part of //chrome/utility.
|
||||||
|
"//chrome/utility/printing_handler.cc",
|
||||||
|
"//chrome/utility/printing_handler.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
|
@ -7,5 +7,5 @@
|
|||||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||||
|
|
||||||
{
|
{
|
||||||
'chromium_checkout': '614d31daee2f61b0180df403a8ad43f20b9f6dd7',
|
'chromium_checkout': '3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a',
|
||||||
}
|
}
|
||||||
|
@ -62,22 +62,35 @@ typedef struct _cef_response_filter_t {
|
|||||||
int (CEF_CALLBACK *init_filter)(struct _cef_response_filter_t* self);
|
int (CEF_CALLBACK *init_filter)(struct _cef_response_filter_t* self);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to filter a chunk of data. |data_in| is the input buffer containing
|
// Called to filter a chunk of data. Expected usage is as follows:
|
||||||
// |data_in_size| bytes of pre-filter data (|data_in| will be NULL if
|
//
|
||||||
// |data_in_size| is zero). |data_out| is the output buffer that can accept up
|
// A. Read input data from |data_in| and set |data_in_read| to the number of
|
||||||
// to |data_out_size| bytes of filtered output data. Set |data_in_read| to the
|
// bytes that were read up to a maximum of |data_in_size|. |data_in| will
|
||||||
// number of bytes that were read from |data_in|. Set |data_out_written| to
|
// be NULL if |data_in_size| is zero.
|
||||||
// the number of bytes that were written into |data_out|. If some or all of
|
// B. Write filtered output data to |data_out| and set |data_out_written| to
|
||||||
// the pre-filter data was read successfully but more data is needed in order
|
// the number of bytes that were written up to a maximum of
|
||||||
// to continue filtering (filtered output is pending) return
|
// |data_out_size|. If no output data was written then all data must be
|
||||||
// RESPONSE_FILTER_NEED_MORE_DATA. If some or all of the pre-filter data was
|
// read from |data_in| (user must set |data_in_read| = |data_in_size|).
|
||||||
// read successfully and all available filtered output has been written return
|
// C. Return RESPONSE_FILTER_DONE if all output data was written or
|
||||||
// RESPONSE_FILTER_DONE. If an error occurs during filtering return
|
// RESPONSE_FILTER_NEED_MORE_DATA if output data is still pending.
|
||||||
// RESPONSE_FILTER_ERROR. This function will be called repeatedly until there
|
//
|
||||||
// is no more data to filter (resource response is complete), |data_in_read|
|
// This function will be called repeatedly until the input buffer has been
|
||||||
// matches |data_in_size| (all available pre-filter bytes have been read), and
|
// fully read (user sets |data_in_read| = |data_in_size|) and there is no more
|
||||||
// the function returns RESPONSE_FILTER_DONE or RESPONSE_FILTER_ERROR. Do not
|
// input data to filter (the resource response is complete). This function may
|
||||||
// keep a reference to the buffers passed to this function.
|
// then be called an additional time with an NULL input buffer if the user
|
||||||
|
// filled the output buffer (set |data_out_written| = |data_out_size|) and
|
||||||
|
// returned RESPONSE_FILTER_NEED_MORE_DATA to indicate that output data is
|
||||||
|
// still pending.
|
||||||
|
//
|
||||||
|
// Calls to this function will stop when one of the following conditions is
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// A. There is no more input data to filter (the resource response is
|
||||||
|
// complete) and the user sets |data_out_written| = 0 or returns
|
||||||
|
// RESPONSE_FILTER_DONE to indicate that all data has been written, or;
|
||||||
|
// B. The user returns RESPONSE_FILTER_ERROR to indicate an error.
|
||||||
|
//
|
||||||
|
// Do not keep a reference to the buffers passed to this function.
|
||||||
///
|
///
|
||||||
cef_response_filter_status_t (CEF_CALLBACK *filter)(
|
cef_response_filter_status_t (CEF_CALLBACK *filter)(
|
||||||
struct _cef_response_filter_t* self, void* data_in, size_t data_in_size,
|
struct _cef_response_filter_t* self, void* data_in, size_t data_in_size,
|
||||||
|
@ -57,22 +57,34 @@ class CefResponseFilter : public virtual CefBase {
|
|||||||
virtual bool InitFilter() =0;
|
virtual bool InitFilter() =0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called to filter a chunk of data. |data_in| is the input buffer containing
|
// Called to filter a chunk of data. Expected usage is as follows:
|
||||||
// |data_in_size| bytes of pre-filter data (|data_in| will be NULL if
|
//
|
||||||
// |data_in_size| is zero). |data_out| is the output buffer that can accept up
|
// A. Read input data from |data_in| and set |data_in_read| to the number of
|
||||||
// to |data_out_size| bytes of filtered output data. Set |data_in_read| to the
|
// bytes that were read up to a maximum of |data_in_size|. |data_in| will
|
||||||
// number of bytes that were read from |data_in|. Set |data_out_written| to
|
// be NULL if |data_in_size| is zero.
|
||||||
// the number of bytes that were written into |data_out|. If some or all of
|
// B. Write filtered output data to |data_out| and set |data_out_written| to
|
||||||
// the pre-filter data was read successfully but more data is needed in order
|
// the number of bytes that were written up to a maximum of
|
||||||
// to continue filtering (filtered output is pending) return
|
// |data_out_size|. If no output data was written then all data must be
|
||||||
// RESPONSE_FILTER_NEED_MORE_DATA. If some or all of the pre-filter data was
|
// read from |data_in| (user must set |data_in_read| = |data_in_size|).
|
||||||
// read successfully and all available filtered output has been written return
|
// C. Return RESPONSE_FILTER_DONE if all output data was written or
|
||||||
// RESPONSE_FILTER_DONE. If an error occurs during filtering return
|
// RESPONSE_FILTER_NEED_MORE_DATA if output data is still pending.
|
||||||
// RESPONSE_FILTER_ERROR. This method will be called repeatedly until there is
|
//
|
||||||
// no more data to filter (resource response is complete), |data_in_read|
|
// This method will be called repeatedly until the input buffer has been
|
||||||
// matches |data_in_size| (all available pre-filter bytes have been read), and
|
// fully read (user sets |data_in_read| = |data_in_size|) and there is no
|
||||||
// the method returns RESPONSE_FILTER_DONE or RESPONSE_FILTER_ERROR. Do not
|
// more input data to filter (the resource response is complete). This method
|
||||||
// keep a reference to the buffers passed to this method.
|
// may then be called an additional time with an empty input buffer if the
|
||||||
|
// user filled the output buffer (set |data_out_written| = |data_out_size|)
|
||||||
|
// and returned RESPONSE_FILTER_NEED_MORE_DATA to indicate that output data is
|
||||||
|
// still pending.
|
||||||
|
//
|
||||||
|
// Calls to this method will stop when one of the following conditions is met:
|
||||||
|
//
|
||||||
|
// A. There is no more input data to filter (the resource response is
|
||||||
|
// complete) and the user sets |data_out_written| = 0 or returns
|
||||||
|
// RESPONSE_FILTER_DONE to indicate that all data has been written, or;
|
||||||
|
// B. The user returns RESPONSE_FILTER_ERROR to indicate an error.
|
||||||
|
//
|
||||||
|
// Do not keep a reference to the buffers passed to this method.
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=data_in,default_retval=RESPONSE_FILTER_ERROR)--*/
|
/*--cef(optional_param=data_in,default_retval=RESPONSE_FILTER_ERROR)--*/
|
||||||
virtual FilterStatus Filter(void* data_in,
|
virtual FilterStatus Filter(void* data_in,
|
||||||
|
@ -563,12 +563,6 @@ typedef struct _cef_browser_settings_t {
|
|||||||
///
|
///
|
||||||
cef_state_t javascript_dom_paste;
|
cef_state_t javascript_dom_paste;
|
||||||
|
|
||||||
///
|
|
||||||
// Controls whether the caret position will be drawn. Also configurable using
|
|
||||||
// the "enable-caret-browsing" command-line switch.
|
|
||||||
///
|
|
||||||
cef_state_t caret_browsing;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Controls whether any plugins will be loaded. Also configurable using the
|
// Controls whether any plugins will be loaded. Also configurable using the
|
||||||
// "disable-plugins" command-line switch.
|
// "disable-plugins" command-line switch.
|
||||||
|
@ -705,7 +705,6 @@ struct CefBrowserSettingsTraits {
|
|||||||
target->javascript_close_windows = src->javascript_close_windows;
|
target->javascript_close_windows = src->javascript_close_windows;
|
||||||
target->javascript_access_clipboard = src->javascript_access_clipboard;
|
target->javascript_access_clipboard = src->javascript_access_clipboard;
|
||||||
target->javascript_dom_paste = src->javascript_dom_paste;
|
target->javascript_dom_paste = src->javascript_dom_paste;
|
||||||
target->caret_browsing = src->caret_browsing;
|
|
||||||
target->plugins = src->plugins;
|
target->plugins = src->plugins;
|
||||||
target->universal_access_from_file_urls =
|
target->universal_access_from_file_urls =
|
||||||
src->universal_access_from_file_urls;
|
src->universal_access_from_file_urls;
|
||||||
|
@ -741,7 +741,8 @@ void CefBrowserHostImpl::Print() {
|
|||||||
if (!actionable_contents)
|
if (!actionable_contents)
|
||||||
return;
|
return;
|
||||||
printing::CefPrintViewManager::FromWebContents(
|
printing::CefPrintViewManager::FromWebContents(
|
||||||
actionable_contents)->PrintNow();
|
actionable_contents)->PrintNow(
|
||||||
|
actionable_contents->GetRenderViewHost()->GetMainFrame());
|
||||||
} else {
|
} else {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::Bind(&CefBrowserHostImpl::Print, this));
|
base::Bind(&CefBrowserHostImpl::Print, this));
|
||||||
@ -762,7 +763,8 @@ void CefBrowserHostImpl::PrintToPDF(const CefString& path,
|
|||||||
callback.get(), path);
|
callback.get(), path);
|
||||||
}
|
}
|
||||||
printing::CefPrintViewManager::FromWebContents(actionable_contents)->
|
printing::CefPrintViewManager::FromWebContents(actionable_contents)->
|
||||||
PrintToPDF(base::FilePath(path), settings, pdf_callback);
|
PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
|
||||||
|
settings, pdf_callback);
|
||||||
} else {
|
} else {
|
||||||
CEF_POST_TASK(CEF_UIT,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::Bind(&CefBrowserHostImpl::PrintToPDF, this, path, settings,
|
base::Bind(&CefBrowserHostImpl::PrintToPDF, this, path, settings,
|
||||||
@ -1413,7 +1415,8 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
|||||||
menu_manager_->Destroy();
|
menu_manager_->Destroy();
|
||||||
|
|
||||||
// Notify any observers that may have state associated with this browser.
|
// Notify any observers that may have state associated with this browser.
|
||||||
FOR_EACH_OBSERVER(Observer, observers_, OnBrowserDestroyed(this));
|
for (auto& observer : observers_)
|
||||||
|
observer.OnBrowserDestroyed(this);
|
||||||
|
|
||||||
// Disassociate the platform delegate from this browser.
|
// Disassociate the platform delegate from this browser.
|
||||||
platform_delegate_->BrowserDestroyed(this);
|
platform_delegate_->BrowserDestroyed(this);
|
||||||
@ -2108,11 +2111,12 @@ void CefBrowserHostImpl::UpdateTargetURL(content::WebContents* source,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserHostImpl::AddMessageToConsole(content::WebContents* source,
|
bool CefBrowserHostImpl::DidAddMessageToConsole(
|
||||||
int32_t level,
|
content::WebContents* source,
|
||||||
const base::string16& message,
|
int32_t level,
|
||||||
int32_t line_no,
|
const base::string16& message,
|
||||||
const base::string16& source_id) {
|
int32_t line_no,
|
||||||
|
const base::string16& source_id) {
|
||||||
if (client_.get()) {
|
if (client_.get()) {
|
||||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||||
if (handler.get())
|
if (handler.get())
|
||||||
@ -2355,28 +2359,21 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
|||||||
bool webcam_requested =
|
bool webcam_requested =
|
||||||
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
||||||
if (microphone_requested || webcam_requested) {
|
if (microphone_requested || webcam_requested) {
|
||||||
switch (request.request_type) {
|
// Pick the desired device or fall back to the first available of the
|
||||||
case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY:
|
// given type.
|
||||||
case content::MEDIA_DEVICE_ACCESS:
|
if (microphone_requested) {
|
||||||
case content::MEDIA_GENERATE_STREAM:
|
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
|
||||||
case content::MEDIA_ENUMERATE_DEVICES:
|
request.requested_audio_device_id,
|
||||||
// Pick the desired device or fall back to the first available of the
|
true,
|
||||||
// given type.
|
false,
|
||||||
if (microphone_requested) {
|
&devices);
|
||||||
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
|
}
|
||||||
request.requested_audio_device_id,
|
if (webcam_requested) {
|
||||||
true,
|
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
|
||||||
false,
|
request.requested_video_device_id,
|
||||||
&devices);
|
false,
|
||||||
}
|
true,
|
||||||
if (webcam_requested) {
|
&devices);
|
||||||
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
|
|
||||||
request.requested_video_device_id,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
&devices);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3015,6 +3012,24 @@ gfx::Point CefBrowserHostImpl::GetScreenPoint(const gfx::Point& view) const {
|
|||||||
return gfx::Point();
|
return gfx::Point();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserHostImpl::StartDragging(
|
||||||
|
const content::DropData& drop_data,
|
||||||
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
|
const gfx::ImageSkia& image,
|
||||||
|
const gfx::Vector2d& image_offset,
|
||||||
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh) {
|
||||||
|
if (platform_delegate_) {
|
||||||
|
platform_delegate_->StartDragging(drop_data, allowed_ops, image,
|
||||||
|
image_offset, event_info, source_rwh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefBrowserHostImpl::UpdateDragCursor(blink::WebDragOperation operation) {
|
||||||
|
if (platform_delegate_)
|
||||||
|
platform_delegate_->UpdateDragCursor(operation);
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::OnAddressChange(CefRefPtr<CefFrame> frame,
|
void CefBrowserHostImpl::OnAddressChange(CefRefPtr<CefFrame> frame,
|
||||||
const GURL& url) {
|
const GURL& url) {
|
||||||
if (client_.get()) {
|
if (client_.get()) {
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
#include "content/public/browser/web_contents_delegate.h"
|
#include "content/public/browser/web_contents_delegate.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
|
|
||||||
|
namespace content {
|
||||||
|
struct DragEventSourceInfo;
|
||||||
|
class RenderWidgetHostImpl;
|
||||||
|
}
|
||||||
|
|
||||||
namespace net {
|
namespace net {
|
||||||
class URLRequest;
|
class URLRequest;
|
||||||
}
|
}
|
||||||
@ -323,6 +328,15 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
// scaling will be applied to the result.
|
// scaling will be applied to the result.
|
||||||
gfx::Point GetScreenPoint(const gfx::Point& view) const;
|
gfx::Point GetScreenPoint(const gfx::Point& view) const;
|
||||||
|
|
||||||
|
void StartDragging(
|
||||||
|
const content::DropData& drop_data,
|
||||||
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
|
const gfx::ImageSkia& image,
|
||||||
|
const gfx::Vector2d& image_offset,
|
||||||
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh);
|
||||||
|
void UpdateDragCursor(blink::WebDragOperation operation);
|
||||||
|
|
||||||
// Thread safe accessors.
|
// Thread safe accessors.
|
||||||
const CefBrowserSettings& settings() const { return settings_; }
|
const CefBrowserSettings& settings() const { return settings_; }
|
||||||
CefRefPtr<CefClient> client() const { return client_; }
|
CefRefPtr<CefClient> client() const { return client_; }
|
||||||
@ -365,11 +379,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
void CloseContents(content::WebContents* source) override;
|
void CloseContents(content::WebContents* source) override;
|
||||||
void UpdateTargetURL(content::WebContents* source,
|
void UpdateTargetURL(content::WebContents* source,
|
||||||
const GURL& url) override;
|
const GURL& url) override;
|
||||||
bool AddMessageToConsole(content::WebContents* source,
|
bool DidAddMessageToConsole(content::WebContents* source,
|
||||||
int32_t level,
|
int32_t level,
|
||||||
const base::string16& message,
|
const base::string16& message,
|
||||||
int32_t line_no,
|
int32_t line_no,
|
||||||
const base::string16& source_id) override;
|
const base::string16& source_id) override;
|
||||||
void BeforeUnloadFired(content::WebContents* source,
|
void BeforeUnloadFired(content::WebContents* source,
|
||||||
bool proceed,
|
bool proceed,
|
||||||
bool* proceed_to_fire_unload) override;
|
bool* proceed_to_fire_unload) override;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "libcef/browser/extensions/extensions_browser_client.h"
|
#include "libcef/browser/extensions/extensions_browser_client.h"
|
||||||
#include "libcef/browser/extensions/extension_system_factory.h"
|
#include "libcef/browser/extensions/extension_system_factory.h"
|
||||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||||
|
#include "libcef/browser/printing/printing_message_filter.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/extensions/extensions_client.h"
|
#include "libcef/common/extensions/extensions_client.h"
|
||||||
#include "libcef/common/extensions/extensions_util.h"
|
#include "libcef/common/extensions/extensions_util.h"
|
||||||
@ -181,6 +182,8 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
extensions::CefExtensionSystemFactory::GetInstance();
|
extensions::CefExtensionSystemFactory::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
|
||||||
|
|
||||||
CefRequestContextSettings settings;
|
CefRequestContextSettings settings;
|
||||||
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
||||||
|
|
||||||
|
@ -177,6 +177,21 @@ void CefBrowserPlatformDelegate::DragTargetDrop(const CefMouseEvent& event) {
|
|||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserPlatformDelegate::StartDragging(
|
||||||
|
const content::DropData& drop_data,
|
||||||
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
|
const gfx::ImageSkia& image,
|
||||||
|
const gfx::Vector2d& image_offset,
|
||||||
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh) {
|
||||||
|
NOTREACHED();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefBrowserPlatformDelegate::UpdateDragCursor(
|
||||||
|
blink::WebDragOperation operation) {
|
||||||
|
NOTREACHED();
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegate::DragSourceEndedAt(
|
void CefBrowserPlatformDelegate::DragSourceEndedAt(
|
||||||
int x, int y,
|
int x, int y,
|
||||||
cef_drag_operations_mask_t op) {
|
cef_drag_operations_mask_t op) {
|
||||||
|
@ -244,6 +244,14 @@ class CefBrowserPlatformDelegate {
|
|||||||
cef_drag_operations_mask_t allowed_ops);
|
cef_drag_operations_mask_t allowed_ops);
|
||||||
virtual void DragTargetDragLeave();
|
virtual void DragTargetDragLeave();
|
||||||
virtual void DragTargetDrop(const CefMouseEvent& event);
|
virtual void DragTargetDrop(const CefMouseEvent& event);
|
||||||
|
virtual void StartDragging(
|
||||||
|
const content::DropData& drop_data,
|
||||||
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
|
const gfx::ImageSkia& image,
|
||||||
|
const gfx::Vector2d& image_offset,
|
||||||
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh);
|
||||||
|
virtual void UpdateDragCursor(blink::WebDragOperation operation);
|
||||||
virtual void DragSourceEndedAt(int x, int y,
|
virtual void DragSourceEndedAt(int x, int y,
|
||||||
cef_drag_operations_mask_t op);
|
cef_drag_operations_mask_t op);
|
||||||
virtual void DragSourceSystemDragEnded();
|
virtual void DragSourceSystemDragEnded();
|
||||||
|
@ -82,7 +82,7 @@ class NET_EXPORT CefURLFetcherResponseWriter :
|
|||||||
return num_bytes;
|
return num_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Finish(const net::CompletionCallback& callback) override {
|
int Finish(int net_error, const net::CompletionCallback& callback) override {
|
||||||
if (url_request_.get())
|
if (url_request_.get())
|
||||||
url_request_ = NULL;
|
url_request_ = NULL;
|
||||||
return net::OK;
|
return net::OK;
|
||||||
|
@ -39,7 +39,9 @@
|
|||||||
#include "base/base_switches.h"
|
#include "base/base_switches.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
|
#include "base/json/json_reader.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "cef/grit/cef_resources.h"
|
||||||
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
|
#include "chrome/browser/spellchecker/spellcheck_message_filter.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||||
@ -60,6 +62,7 @@
|
|||||||
#include "content/public/browser/render_widget_host_view.h"
|
#include "content/public/browser/render_widget_host_view.h"
|
||||||
#include "content/public/browser/resource_dispatcher_host.h"
|
#include "content/public/browser/resource_dispatcher_host.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
|
#include "content/public/common/service_names.mojom.h"
|
||||||
#include "content/public/common/storage_quota_params.h"
|
#include "content/public/common/storage_quota_params.h"
|
||||||
#include "content/public/common/web_preferences.h"
|
#include "content/public/common/web_preferences.h"
|
||||||
#include "extensions/browser/extensions_browser_client.h"
|
#include "extensions/browser/extensions_browser_client.h"
|
||||||
@ -72,6 +75,7 @@
|
|||||||
#include "net/ssl/ssl_cert_request_info.h"
|
#include "net/ssl/ssl_cert_request_info.h"
|
||||||
#include "ppapi/host/ppapi_host.h"
|
#include "ppapi/host/ppapi_host.h"
|
||||||
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
|
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
|
||||||
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
#include "ui/base/ui_base_switches.h"
|
#include "ui/base/ui_base_switches.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
@ -457,9 +461,10 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
|||||||
const base::CommandLine* command_line =
|
const base::CommandLine* command_line =
|
||||||
base::CommandLine::ForCurrentProcess();
|
base::CommandLine::ForCurrentProcess();
|
||||||
const int id = host->GetID();
|
const int id = host->GetID();
|
||||||
|
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
||||||
|
|
||||||
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(id));
|
host->GetChannel()->AddFilter(new CefBrowserMessageFilter(id));
|
||||||
host->AddFilter(new printing::CefPrintingMessageFilter(id));
|
host->AddFilter(new printing::CefPrintingMessageFilter(id, profile));
|
||||||
|
|
||||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||||
host->AddFilter(new SpellCheckMessageFilter(id));
|
host->AddFilter(new SpellCheckMessageFilter(id));
|
||||||
@ -468,18 +473,16 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
content::BrowserContext* browser_context = host->GetBrowserContext();
|
|
||||||
|
|
||||||
host->AddFilter(new CefPluginInfoMessageFilter(id,
|
host->AddFilter(new CefPluginInfoMessageFilter(id,
|
||||||
static_cast<CefBrowserContext*>(browser_context)));
|
static_cast<CefBrowserContext*>(profile)));
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
if (extensions::ExtensionsEnabled()) {
|
||||||
host->AddFilter(
|
host->AddFilter(
|
||||||
new extensions::ExtensionMessageFilter(id, browser_context));
|
new extensions::ExtensionMessageFilter(id, profile));
|
||||||
host->AddFilter(
|
host->AddFilter(
|
||||||
new extensions::IOThreadExtensionMessageFilter(id, browser_context));
|
new extensions::IOThreadExtensionMessageFilter(id, profile));
|
||||||
host->AddFilter(
|
host->AddFilter(
|
||||||
new extensions::ExtensionsGuestViewMessageFilter(id, browser_context));
|
new extensions::ExtensionsGuestViewMessageFilter(id, profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the renderer process crashes then the host may already have
|
// If the renderer process crashes then the host may already have
|
||||||
@ -489,7 +492,7 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
|||||||
host->AddObserver(CefBrowserInfoManager::GetInstance());
|
host->AddObserver(CefBrowserInfoManager::GetInstance());
|
||||||
|
|
||||||
host->Send(new CefProcessMsg_SetIsIncognitoProcess(
|
host->Send(new CefProcessMsg_SetIsIncognitoProcess(
|
||||||
browser_context->IsOffTheRecord()));
|
profile->IsOffTheRecord()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefContentBrowserClient::ShouldUseProcessPerSite(
|
bool CefContentBrowserClient::ShouldUseProcessPerSite(
|
||||||
@ -587,6 +590,25 @@ void CefContentBrowserClient::SiteInstanceDeleting(
|
|||||||
site_instance->GetId()));
|
site_instance->GetId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<base::Value>
|
||||||
|
CefContentBrowserClient::GetServiceManifestOverlay(
|
||||||
|
const std::string& name) {
|
||||||
|
int id = -1;
|
||||||
|
if (name == content::mojom::kBrowserServiceName)
|
||||||
|
id = IDR_CEF_BROWSER_MANIFEST_OVERLAY;
|
||||||
|
else if (name == content::mojom::kRendererServiceName)
|
||||||
|
id = IDR_CEF_RENDERER_MANIFEST_OVERLAY;
|
||||||
|
else if (name == content::mojom::kUtilityServiceName)
|
||||||
|
id = IDR_CEF_UTILITY_MANIFEST_OVERLAY;
|
||||||
|
if (id == -1)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
base::StringPiece manifest_contents =
|
||||||
|
ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
|
||||||
|
id, ui::ScaleFactor::SCALE_FACTOR_NONE);
|
||||||
|
return base::JSONReader::Read(manifest_contents);
|
||||||
|
}
|
||||||
|
|
||||||
void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||||
base::CommandLine* command_line, int child_process_id) {
|
base::CommandLine* command_line, int child_process_id) {
|
||||||
const base::CommandLine* browser_cmd =
|
const base::CommandLine* browser_cmd =
|
||||||
@ -660,7 +682,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
|||||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
||||||
arraysize(kSwitchNames));
|
arraysize(kSwitchNames));
|
||||||
|
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
if (!browser_cmd->HasSwitch(switches::kNoSandbox)) {
|
if (!browser_cmd->HasSwitch(switches::kNoSandbox)) {
|
||||||
// Pass the Widevine CDM path to the Zygote process. See comments in
|
// Pass the Widevine CDM path to the Zygote process. See comments in
|
||||||
// CefWidevineLoader::AddPepperPlugins.
|
// CefWidevineLoader::AddPepperPlugins.
|
||||||
|
@ -46,6 +46,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
bool IsHandledURL(const GURL& url) override;
|
bool IsHandledURL(const GURL& url) override;
|
||||||
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||||
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
||||||
|
std::unique_ptr<base::Value> GetServiceManifestOverlay(
|
||||||
|
const std::string& name) override;
|
||||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||||
int child_process_id) override;
|
int child_process_id) override;
|
||||||
content::QuotaPermissionContext*
|
content::QuotaPermissionContext*
|
||||||
@ -104,7 +106,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
const wchar_t* GetResourceDllName() override;
|
const wchar_t* GetResourceDllName();
|
||||||
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
|
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ void CefContext::OnContextInitialized() {
|
|||||||
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->
|
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->
|
||||||
OnContextInitialized();
|
OnContextInitialized();
|
||||||
|
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
CefWidevineLoader::GetInstance()->OnContextInitialized();
|
CefWidevineLoader::GetInstance()->OnContextInitialized();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class ResponseWriter : public net::URLFetcherResponseWriter {
|
|||||||
int Write(net::IOBuffer* buffer,
|
int Write(net::IOBuffer* buffer,
|
||||||
int num_bytes,
|
int num_bytes,
|
||||||
const net::CompletionCallback& callback) override;
|
const net::CompletionCallback& callback) override;
|
||||||
int Finish(const net::CompletionCallback& callback) override;
|
int Finish(int net_error, const net::CompletionCallback& callback) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
base::WeakPtr<CefDevToolsFrontend> shell_devtools_;
|
base::WeakPtr<CefDevToolsFrontend> shell_devtools_;
|
||||||
@ -89,7 +89,8 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
|
|||||||
return num_bytes;
|
return num_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ResponseWriter::Finish(const net::CompletionCallback& callback) {
|
int ResponseWriter::Finish(int net_error,
|
||||||
|
const net::CompletionCallback& callback) {
|
||||||
return net::OK;
|
return net::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,8 +195,10 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
|||||||
weak_ptr_factory_.GetWeakPtr(), callback));
|
weak_ptr_factory_.GetWeakPtr(), callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefJavaScriptDialogManager::CancelActiveAndPendingDialogs(
|
void CefJavaScriptDialogManager::CancelDialogs(
|
||||||
content::WebContents* web_contents) {
|
content::WebContents* web_contents,
|
||||||
|
bool suppress_callbacks,
|
||||||
|
bool reset_state) {
|
||||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
if (client.get()) {
|
if (client.get()) {
|
||||||
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();
|
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();
|
||||||
@ -212,10 +214,6 @@ void CefJavaScriptDialogManager::CancelActiveAndPendingDialogs(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefJavaScriptDialogManager::ResetDialogState(
|
|
||||||
content::WebContents* web_contents) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefJavaScriptDialogManager::DialogClosed(
|
void CefJavaScriptDialogManager::DialogClosed(
|
||||||
const DialogClosedCallback& callback,
|
const DialogClosedCallback& callback,
|
||||||
bool success,
|
bool success,
|
||||||
|
@ -41,10 +41,9 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
|||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
bool is_reload,
|
bool is_reload,
|
||||||
const DialogClosedCallback& callback) override;
|
const DialogClosedCallback& callback) override;
|
||||||
void CancelActiveAndPendingDialogs(
|
void CancelDialogs(content::WebContents* web_contents,
|
||||||
content::WebContents* web_contents) override;
|
bool suppress_callbacks,
|
||||||
void ResetDialogState(
|
bool reset_state) override;
|
||||||
content::WebContents* web_contents) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Method executed by the callback passed to CefJavaScriptDialogRunner::Run.
|
// Method executed by the callback passed to CefJavaScriptDialogRunner::Run.
|
||||||
|
@ -654,7 +654,8 @@ void CefMenuModelImpl::MenuWillShow() {
|
|||||||
delegate_->MenuWillShow(this);
|
delegate_->MenuWillShow(this);
|
||||||
if (menu_model_delegate_)
|
if (menu_model_delegate_)
|
||||||
menu_model_delegate_->MenuWillShow(this);
|
menu_model_delegate_->MenuWillShow(this);
|
||||||
FOR_EACH_OBSERVER(Observer, observers_, MenuWillShow(this));
|
for (auto& observer : observers_)
|
||||||
|
observer.MenuWillShow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefMenuModelImpl::MenuWillClose() {
|
void CefMenuModelImpl::MenuWillClose() {
|
||||||
@ -776,7 +777,8 @@ void CefMenuModelImpl::OnMenuClosed() {
|
|||||||
delegate_->MenuClosed(this);
|
delegate_->MenuClosed(this);
|
||||||
if (menu_model_delegate_)
|
if (menu_model_delegate_)
|
||||||
menu_model_delegate_->MenuClosed(this);
|
menu_model_delegate_->MenuClosed(this);
|
||||||
FOR_EACH_OBSERVER(Observer, observers_, MenuClosed(this));
|
for (auto& observer : observers_)
|
||||||
|
observer.MenuClosed(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefMenuModelImpl::VerifyContext() {
|
bool CefMenuModelImpl::VerifyContext() {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "content/public/browser/native_web_keyboard_event.h"
|
#include "content/public/browser/native_web_keyboard_event.h"
|
||||||
#include "content/public/browser/render_widget_host_view.h"
|
#include "content/public/browser/render_widget_host_view.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "third_party/WebKit/public/web/WebInputEvent.h"
|
#include "third_party/WebKit/public/platform/WebInputEvent.h"
|
||||||
#import "ui/base/cocoa/cocoa_base_utils.h"
|
#import "ui/base/cocoa/cocoa_base_utils.h"
|
||||||
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
|
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
|
||||||
#include "ui/events/keycodes/keyboard_codes_posix.h"
|
#include "ui/events/keycodes/keyboard_codes_posix.h"
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
#include "base/stl_util.h"
|
#include "base/stl_util.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
@ -404,7 +405,6 @@ CefNativeMenuWin::CefNativeMenuWin(ui::MenuModel* model, HWND system_menu_for)
|
|||||||
CefNativeMenuWin::~CefNativeMenuWin() {
|
CefNativeMenuWin::~CefNativeMenuWin() {
|
||||||
if (destroyed_flag_)
|
if (destroyed_flag_)
|
||||||
*destroyed_flag_ = true;
|
*destroyed_flag_ = true;
|
||||||
base::STLDeleteContainerPointers(items_.begin(), items_.end());
|
|
||||||
DestroyMenu(menu_);
|
DestroyMenu(menu_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ void CefNativeMenuWin::Rebuild(MenuInsertionDelegateWin* delegate) {
|
|||||||
void CefNativeMenuWin::UpdateStates() {
|
void CefNativeMenuWin::UpdateStates() {
|
||||||
// A depth-first walk of the menu items, updating states.
|
// A depth-first walk of the menu items, updating states.
|
||||||
int model_index = 0;
|
int model_index = 0;
|
||||||
std::vector<ItemData*>::const_iterator it;
|
ItemDataList::const_iterator it;
|
||||||
for (it = items_.begin(); it != items_.end(); ++it, ++model_index) {
|
for (it = items_.begin(); it != items_.end(); ++it, ++model_index) {
|
||||||
int menu_index = model_index + first_item_index_;
|
int menu_index = model_index + first_item_index_;
|
||||||
SetMenuItemState(menu_index, model_->IsEnabledAt(model_index),
|
SetMenuItemState(menu_index, model_->IsEnabledAt(model_index),
|
||||||
@ -567,7 +567,8 @@ LRESULT CALLBACK CefNativeMenuWin::MenuMessageHook(
|
|||||||
// The first time this hook is called, that means the menu has successfully
|
// The first time this hook is called, that means the menu has successfully
|
||||||
// opened, so call the callback function on all of our listeners.
|
// opened, so call the callback function on all of our listeners.
|
||||||
if (!this_ptr->listeners_called_) {
|
if (!this_ptr->listeners_called_) {
|
||||||
FOR_EACH_OBSERVER(MenuListener, this_ptr->listeners_, OnMenuOpened());
|
for (auto& observer : this_ptr->listeners_)
|
||||||
|
observer.OnMenuOpened();
|
||||||
this_ptr->listeners_called_ = true;
|
this_ptr->listeners_called_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,7 +623,7 @@ void CefNativeMenuWin::AddMenuItemAt(int menu_index, int model_index) {
|
|||||||
else
|
else
|
||||||
mii.fType = MFT_OWNERDRAW;
|
mii.fType = MFT_OWNERDRAW;
|
||||||
|
|
||||||
ItemData* item_data = new ItemData;
|
std::unique_ptr<ItemData> item_data = base::MakeUnique<ItemData>();
|
||||||
item_data->label = base::string16();
|
item_data->label = base::string16();
|
||||||
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
||||||
if (type == ui::MenuModel::TYPE_SUBMENU) {
|
if (type == ui::MenuModel::TYPE_SUBMENU) {
|
||||||
@ -637,8 +638,8 @@ void CefNativeMenuWin::AddMenuItemAt(int menu_index, int model_index) {
|
|||||||
}
|
}
|
||||||
item_data->native_menu_win = this;
|
item_data->native_menu_win = this;
|
||||||
item_data->model_index = model_index;
|
item_data->model_index = model_index;
|
||||||
items_.insert(items_.begin() + model_index, item_data);
|
mii.dwItemData = reinterpret_cast<ULONG_PTR>(item_data.get());
|
||||||
mii.dwItemData = reinterpret_cast<ULONG_PTR>(item_data);
|
items_.insert(items_.begin() + model_index, std::move(item_data));
|
||||||
UpdateMenuItemInfoForString(&mii, model_index,
|
UpdateMenuItemInfoForString(&mii, model_index,
|
||||||
model_->GetLabelAt(model_index));
|
model_->GetLabelAt(model_index));
|
||||||
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
||||||
@ -651,7 +652,7 @@ void CefNativeMenuWin::AddSeparatorItemAt(int menu_index, int model_index) {
|
|||||||
mii.fType = MFT_SEPARATOR;
|
mii.fType = MFT_SEPARATOR;
|
||||||
// Insert a dummy entry into our label list so we can index directly into it
|
// Insert a dummy entry into our label list so we can index directly into it
|
||||||
// using item indices if need be.
|
// using item indices if need be.
|
||||||
items_.insert(items_.begin() + model_index, new ItemData);
|
items_.insert(items_.begin() + model_index, base::MakeUnique<ItemData>());
|
||||||
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
InsertMenuItem(menu_, menu_index, TRUE, &mii);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#ifndef CEF_LIBCEF_BROWSER_NATIVE_NATIVE_MENU_WIN_H_
|
#ifndef CEF_LIBCEF_BROWSER_NATIVE_NATIVE_MENU_WIN_H_
|
||||||
#define CEF_LIBCEF_BROWSER_NATIVE_NATIVE_MENU_WIN_H_
|
#define CEF_LIBCEF_BROWSER_NATIVE_NATIVE_MENU_WIN_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "libcef/browser/native/menu_wrapper.h"
|
#include "libcef/browser/native/menu_wrapper.h"
|
||||||
@ -119,7 +120,8 @@ class CefNativeMenuWin : public MenuWrapper {
|
|||||||
// An object that collects all of the data associated with an individual menu
|
// An object that collects all of the data associated with an individual menu
|
||||||
// item.
|
// item.
|
||||||
struct ItemData;
|
struct ItemData;
|
||||||
std::vector<ItemData*> items_;
|
typedef std::vector<std::unique_ptr<ItemData>> ItemDataList;
|
||||||
|
ItemDataList items_;
|
||||||
|
|
||||||
// The window that receives notifications from the menu.
|
// The window that receives notifications from the menu.
|
||||||
class MenuHostWindow;
|
class MenuHostWindow;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "include/cef_urlrequest.h"
|
#include "include/cef_urlrequest.h"
|
||||||
#include "libcef/browser/browser_host_impl.h"
|
#include "libcef/browser/browser_host_impl.h"
|
||||||
#include "libcef/browser/net/response_filter_wrapper.h"
|
#include "libcef/browser/net/source_stream.h"
|
||||||
#include "libcef/browser/net/url_request_user_data.h"
|
#include "libcef/browser/net/url_request_user_data.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/request_impl.h"
|
#include "libcef/common/request_impl.h"
|
||||||
@ -23,16 +23,11 @@
|
|||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "net/filter/filter.h"
|
|
||||||
#include "net/http/http_util.h"
|
#include "net/http/http_util.h"
|
||||||
#include "net/url_request/url_request.h"
|
#include "net/url_request/url_request.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Buffer size allocated when filtering data.
|
|
||||||
// Should match the value in net/filter/filter.cc.
|
|
||||||
const int kFilterBufSize = 32 * 1024;
|
|
||||||
|
|
||||||
class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
|
||||||
public:
|
public:
|
||||||
typedef net::CompletionCallback CallbackType;
|
typedef net::CompletionCallback CallbackType;
|
||||||
@ -266,6 +261,41 @@ bool CefNetworkDelegate::AreStrictSecureCookiesEnabled() {
|
|||||||
base::CompareCase::INSENSITIVE_ASCII);
|
base::CompareCase::INSENSITIVE_ASCII);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<net::SourceStream> CefNetworkDelegate::CreateSourceStream(
|
||||||
|
net::URLRequest* request,
|
||||||
|
std::unique_ptr<net::SourceStream> upstream) {
|
||||||
|
CefRefPtr<CefResponseFilter> cef_filter;
|
||||||
|
|
||||||
|
CefRefPtr<CefBrowserHostImpl> browser =
|
||||||
|
CefBrowserHostImpl::GetBrowserForRequest(request);
|
||||||
|
if (browser.get()) {
|
||||||
|
CefRefPtr<CefClient> client = browser->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||||
|
if (handler.get()) {
|
||||||
|
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(request);
|
||||||
|
|
||||||
|
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
|
||||||
|
cefRequest->Set(request);
|
||||||
|
cefRequest->SetReadOnly(true);
|
||||||
|
|
||||||
|
CefRefPtr<CefResponseImpl> cefResponse = new CefResponseImpl();
|
||||||
|
cefResponse->Set(request);
|
||||||
|
cefResponse->SetReadOnly(true);
|
||||||
|
|
||||||
|
cef_filter = handler->GetResourceResponseFilter(browser.get(), frame,
|
||||||
|
cefRequest.get(),
|
||||||
|
cefResponse.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cef_filter && cef_filter->InitFilter())
|
||||||
|
return base::MakeUnique<CefSourceStream>(cef_filter, std::move(upstream));
|
||||||
|
|
||||||
|
return upstream;
|
||||||
|
}
|
||||||
|
|
||||||
int CefNetworkDelegate::OnBeforeURLRequest(
|
int CefNetworkDelegate::OnBeforeURLRequest(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
const net::CompletionCallback& callback,
|
||||||
@ -442,55 +472,3 @@ bool CefNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
|
|||||||
bool CefNetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
|
bool CefNetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
|
||||||
return AreStrictSecureCookiesEnabled();
|
return AreStrictSecureCookiesEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
net::Filter* CefNetworkDelegate::SetupFilter(net::URLRequest* request,
|
|
||||||
net::Filter* filter_list) {
|
|
||||||
CefRefPtr<CefResponseFilter> cef_filter;
|
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser =
|
|
||||||
CefBrowserHostImpl::GetBrowserForRequest(request);
|
|
||||||
if (browser.get()) {
|
|
||||||
CefRefPtr<CefClient> client = browser->GetClient();
|
|
||||||
if (client.get()) {
|
|
||||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
|
||||||
if (handler.get()) {
|
|
||||||
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(request);
|
|
||||||
|
|
||||||
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
|
|
||||||
cefRequest->Set(request);
|
|
||||||
cefRequest->SetReadOnly(true);
|
|
||||||
|
|
||||||
CefRefPtr<CefResponseImpl> cefResponse = new CefResponseImpl();
|
|
||||||
cefResponse->Set(request);
|
|
||||||
cefResponse->SetReadOnly(true);
|
|
||||||
|
|
||||||
cef_filter = handler->GetResourceResponseFilter(browser.get(), frame,
|
|
||||||
cefRequest.get(),
|
|
||||||
cefResponse.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cef_filter.get() && cef_filter->InitFilter()) {
|
|
||||||
std::unique_ptr<CefResponseFilterWrapper> wrapper(
|
|
||||||
new CefResponseFilterWrapper(cef_filter, filter_list != nullptr));
|
|
||||||
wrapper->InitBuffer(kFilterBufSize);
|
|
||||||
|
|
||||||
if (filter_list) {
|
|
||||||
// Install the wrapper at the end of the filter list.
|
|
||||||
net::Filter* last_filter = filter_list;
|
|
||||||
do {
|
|
||||||
if (!last_filter->next_filter_.get()) {
|
|
||||||
last_filter->next_filter_ = std::move(wrapper);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
last_filter = last_filter->next_filter_.get();
|
|
||||||
} while (last_filter);
|
|
||||||
} else {
|
|
||||||
// Only the wrapper exists.
|
|
||||||
filter_list = wrapper.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return filter_list;
|
|
||||||
}
|
|
||||||
|
@ -31,6 +31,9 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// net::NetworkDelegate methods.
|
// net::NetworkDelegate methods.
|
||||||
|
std::unique_ptr<net::SourceStream> CreateSourceStream(
|
||||||
|
net::URLRequest* request,
|
||||||
|
std::unique_ptr<net::SourceStream> upstream) override;
|
||||||
int OnBeforeURLRequest(net::URLRequest* request,
|
int OnBeforeURLRequest(net::URLRequest* request,
|
||||||
const net::CompletionCallback& callback,
|
const net::CompletionCallback& callback,
|
||||||
GURL* new_url) override;
|
GURL* new_url) override;
|
||||||
@ -44,8 +47,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
|||||||
const base::FilePath& path) const override;
|
const base::FilePath& path) const override;
|
||||||
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
||||||
bool OnAreStrictSecureCookiesEnabled() const override;
|
bool OnAreStrictSecureCookiesEnabled() const override;
|
||||||
net::Filter* SetupFilter(net::URLRequest* request,
|
|
||||||
net::Filter* filter_list) override;
|
|
||||||
|
|
||||||
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
|
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
|
||||||
BooleanPrefMember* force_google_safesearch_;
|
BooleanPrefMember* force_google_safesearch_;
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
// Copyright 2014 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/net/response_filter_wrapper.h"
|
|
||||||
|
|
||||||
#include "base/logging.h"
|
|
||||||
|
|
||||||
// FilterType is used for logging purposes only.
|
|
||||||
CefResponseFilterWrapper::CefResponseFilterWrapper(
|
|
||||||
CefRefPtr<CefResponseFilter> cef_filter,
|
|
||||||
bool has_other_filters)
|
|
||||||
: Filter(Filter::FILTER_TYPE_UNSUPPORTED),
|
|
||||||
cef_filter_(cef_filter),
|
|
||||||
has_other_filters_(has_other_filters) {
|
|
||||||
DCHECK(cef_filter_.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
CefResponseFilterWrapper::~CefResponseFilterWrapper() {
|
|
||||||
}
|
|
||||||
|
|
||||||
net::Filter::FilterStatus CefResponseFilterWrapper::ReadFilteredData(
|
|
||||||
char* dest_buffer,
|
|
||||||
int* dest_len) {
|
|
||||||
if (!dest_buffer || !dest_len || *dest_len <= 0)
|
|
||||||
return net::Filter::FILTER_ERROR;
|
|
||||||
|
|
||||||
size_t data_in_size = static_cast<size_t>(stream_data_len_);
|
|
||||||
size_t data_in_read = 0;
|
|
||||||
size_t data_out_size = static_cast<size_t>(*dest_len);
|
|
||||||
size_t data_out_write = 0;
|
|
||||||
|
|
||||||
cef_response_filter_status_t cef_status = cef_filter_->Filter(
|
|
||||||
next_stream_data_, data_in_size, data_in_read,
|
|
||||||
dest_buffer, data_out_size, data_out_write);
|
|
||||||
|
|
||||||
// Return early if there's an error.
|
|
||||||
if (cef_status == RESPONSE_FILTER_ERROR)
|
|
||||||
return net::Filter::FILTER_ERROR;
|
|
||||||
|
|
||||||
// Normalize the out values.
|
|
||||||
if (data_in_read > data_in_size) {
|
|
||||||
LOG(ERROR) <<
|
|
||||||
"potential buffer overflow; data_in_read exceeds data_in_size";
|
|
||||||
data_in_read = data_in_size;
|
|
||||||
}
|
|
||||||
if (data_out_write > data_out_size) {
|
|
||||||
LOG(ERROR) <<
|
|
||||||
"potential buffer overflow; data_out_write exceeds data_out_size";
|
|
||||||
data_out_write = data_out_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output the number of bytes written.
|
|
||||||
*dest_len = static_cast<int>(data_out_write);
|
|
||||||
|
|
||||||
if (data_in_size - data_in_read > 0U) {
|
|
||||||
// There are bytes left so adjust the stream pointer and return FILTER_OK.
|
|
||||||
next_stream_data_ += data_in_read;
|
|
||||||
stream_data_len_ -= static_cast<int>(data_in_read);
|
|
||||||
return Filter::FILTER_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No bytes left. Might need more data or might be done.
|
|
||||||
// If |has_other_filters_| is true then we must return FILTER_NEED_MORE_DATA
|
|
||||||
// or additional data will not be sent.
|
|
||||||
next_stream_data_ = nullptr;
|
|
||||||
stream_data_len_ = 0;
|
|
||||||
if (cef_status == RESPONSE_FILTER_NEED_MORE_DATA || has_other_filters_)
|
|
||||||
return Filter::FILTER_NEED_MORE_DATA;
|
|
||||||
return Filter::FILTER_DONE;
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
// Copyright 2015 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_NET_RESPONSE_FILTER_WRAPPER_H_
|
|
||||||
#define CEF_LIBCEF_BROWSER_NET_RESPONSE_FILTER_WRAPPER_H_
|
|
||||||
|
|
||||||
#include "include/cef_response_filter.h"
|
|
||||||
|
|
||||||
#include "base/macros.h"
|
|
||||||
#include "net/filter/filter.h"
|
|
||||||
|
|
||||||
class CefResponseFilterWrapper : public net::Filter {
|
|
||||||
public:
|
|
||||||
CefResponseFilterWrapper(CefRefPtr<CefResponseFilter> cef_filter,
|
|
||||||
bool has_other_filters);
|
|
||||||
~CefResponseFilterWrapper() override;
|
|
||||||
|
|
||||||
// Decodes the pre-filter data and writes the output into the dest_buffer
|
|
||||||
// passed in.
|
|
||||||
// The function returns FilterStatus. See filter.h for its description.
|
|
||||||
//
|
|
||||||
// Upon entry, *dest_len is the total size (in number of chars) of the
|
|
||||||
// destination buffer. Upon exit, *dest_len is the actual number of chars
|
|
||||||
// written into the destination buffer.
|
|
||||||
//
|
|
||||||
// This function will fail if there is no pre-filter data in the
|
|
||||||
// stream_buffer_. On the other hand, *dest_len can be 0 upon successful
|
|
||||||
// return. For example, the internal filter may process some pre-filter data
|
|
||||||
// but not produce output yet.
|
|
||||||
FilterStatus ReadFilteredData(char* dest_buffer, int* dest_len) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CefRefPtr<CefResponseFilter> cef_filter_;
|
|
||||||
const bool has_other_filters_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefResponseFilterWrapper);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_BROWSER_NET_RESPONSE_FILTER_WRAPPER_H_
|
|
@ -14,6 +14,7 @@
|
|||||||
#include "base/threading/sequenced_worker_pool.h"
|
#include "base/threading/sequenced_worker_pool.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
|
#include "net/net_features.h"
|
||||||
#include "net/url_request/data_protocol_handler.h"
|
#include "net/url_request/data_protocol_handler.h"
|
||||||
#include "net/url_request/file_protocol_handler.h"
|
#include "net/url_request/file_protocol_handler.h"
|
||||||
#include "net/url_request/ftp_protocol_handler.h"
|
#include "net/url_request/ftp_protocol_handler.h"
|
||||||
@ -26,7 +27,7 @@ void InstallInternalProtectedHandlers(
|
|||||||
net::URLRequestJobFactoryImpl* job_factory,
|
net::URLRequestJobFactoryImpl* job_factory,
|
||||||
CefURLRequestManager* request_manager,
|
CefURLRequestManager* request_manager,
|
||||||
content::ProtocolHandlerMap* protocol_handlers,
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
net::FtpTransactionFactory* ftp_transaction_factory) {
|
net::HostResolver* host_resolver) {
|
||||||
protocol_handlers->insert(
|
protocol_handlers->insert(
|
||||||
std::make_pair(url::kDataScheme,
|
std::make_pair(url::kDataScheme,
|
||||||
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
|
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
|
||||||
@ -38,11 +39,11 @@ void InstallInternalProtectedHandlers(
|
|||||||
content::BrowserThread::GetBlockingPool()->
|
content::BrowserThread::GetBlockingPool()->
|
||||||
GetTaskRunnerWithShutdownBehavior(
|
GetTaskRunnerWithShutdownBehavior(
|
||||||
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))));
|
base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))));
|
||||||
#if !defined(DISABLE_FTP_SUPPORT)
|
#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
|
||||||
protocol_handlers->insert(
|
protocol_handlers->insert(
|
||||||
std::make_pair(url::kFtpScheme,
|
std::make_pair(url::kFtpScheme,
|
||||||
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
|
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
|
||||||
new net::FtpProtocolHandler(ftp_transaction_factory))));
|
net::FtpProtocolHandler::Create(host_resolver).release())));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (content::ProtocolHandlerMap::iterator it =
|
for (content::ProtocolHandlerMap::iterator it =
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
namespace net {
|
namespace net {
|
||||||
class FtpTransactionFactory;
|
class HostResolver;
|
||||||
class URLRequestJobFactoryImpl;
|
class URLRequestJobFactoryImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ void InstallInternalProtectedHandlers(
|
|||||||
net::URLRequestJobFactoryImpl* job_factory,
|
net::URLRequestJobFactoryImpl* job_factory,
|
||||||
CefURLRequestManager* request_manager,
|
CefURLRequestManager* request_manager,
|
||||||
content::ProtocolHandlerMap* protocol_handlers,
|
content::ProtocolHandlerMap* protocol_handlers,
|
||||||
net::FtpTransactionFactory* ftp_transaction_factory);
|
net::HostResolver* host_resolver);
|
||||||
|
|
||||||
// Register the internal scheme handlers that can be overridden.
|
// Register the internal scheme handlers that can be overridden.
|
||||||
void RegisterInternalHandlers(CefURLRequestManager* request_manager);
|
void RegisterInternalHandlers(CefURLRequestManager* request_manager);
|
||||||
|
77
libcef/browser/net/source_stream.cc
Normal file
77
libcef/browser/net/source_stream.cc
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
// Copyright 2016 The Chromium Embedded Framework 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/net/source_stream.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "net/base/io_buffer.h"
|
||||||
|
|
||||||
|
// Use TYPE_INVALID so that URLRequestJob::NotifyHeadersComplete() doesn't
|
||||||
|
// assume that the "content-length" header is accurate.
|
||||||
|
CefSourceStream::CefSourceStream(
|
||||||
|
CefRefPtr<CefResponseFilter> cef_filter,
|
||||||
|
std::unique_ptr<net::SourceStream> upstream)
|
||||||
|
: net::FilterSourceStream(net::SourceStream::TYPE_INVALID,
|
||||||
|
std::move(upstream)),
|
||||||
|
cef_filter_(cef_filter) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int CefSourceStream::FilterData(net::IOBuffer* output_buffer,
|
||||||
|
int output_buffer_size,
|
||||||
|
net::IOBuffer* input_buffer,
|
||||||
|
int input_buffer_size,
|
||||||
|
int* consumed_bytes,
|
||||||
|
bool upstream_eof_reached) {
|
||||||
|
if (!output_buffer || output_buffer_size <= 0)
|
||||||
|
return net::ERR_CONTENT_DECODING_FAILED;
|
||||||
|
|
||||||
|
if (input_buffer_size == 0 && last_status_ == RESPONSE_FILTER_DONE) {
|
||||||
|
// No more input data. Respect the client's desire to be done with
|
||||||
|
// outputting data.
|
||||||
|
*consumed_bytes = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t data_in_size = static_cast<size_t>(input_buffer_size);
|
||||||
|
size_t data_in_read = 0;
|
||||||
|
size_t data_out_size = static_cast<size_t>(output_buffer_size);
|
||||||
|
size_t data_out_written = 0;
|
||||||
|
|
||||||
|
last_status_ = cef_filter_->Filter(
|
||||||
|
data_in_size > 0 ? input_buffer->data() : nullptr,
|
||||||
|
data_in_size, data_in_read,
|
||||||
|
output_buffer->data(), data_out_size, data_out_written);
|
||||||
|
|
||||||
|
// Return early if there's an error.
|
||||||
|
if (last_status_ == RESPONSE_FILTER_ERROR)
|
||||||
|
return net::ERR_CONTENT_DECODING_FAILED;
|
||||||
|
|
||||||
|
// Validate the out values.
|
||||||
|
if (data_in_read > data_in_size) {
|
||||||
|
LOG(ERROR) << "potential buffer overflow; data_in_read > data_in_size";
|
||||||
|
return net::ERR_CONTENT_DECODING_FAILED;
|
||||||
|
}
|
||||||
|
if (data_out_written > data_out_size) {
|
||||||
|
LOG(ERROR) << "potential buffer overflow; data_out_written > data_out_size";
|
||||||
|
return net::ERR_CONTENT_DECODING_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If FilterData() returns 0, *|consumed_bytes| must be equal to
|
||||||
|
// |input_buffer_size|.
|
||||||
|
if (data_out_written == 0 && data_in_read != data_in_size) {
|
||||||
|
LOG(ERROR) << "when no data is written all input must be consumed; "
|
||||||
|
"data_out_written == 0 && data_in_read != data_in_size";
|
||||||
|
return net::ERR_CONTENT_DECODING_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
*consumed_bytes = static_cast<int>(data_in_read);
|
||||||
|
|
||||||
|
// Output the number of bytes written.
|
||||||
|
return static_cast<int>(data_out_written);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CefSourceStream::GetTypeAsString() const {
|
||||||
|
return "cef_filter";
|
||||||
|
}
|
34
libcef/browser/net/source_stream.h
Normal file
34
libcef/browser/net/source_stream.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright 2016 The Chromium Embedded Framework 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_NET_SOURCE_STREAM_H_
|
||||||
|
#define CEF_LIBCEF_BROWSER_NET_SOURCE_STREAM_H_
|
||||||
|
|
||||||
|
#include "include/cef_response_filter.h"
|
||||||
|
|
||||||
|
#include "base/macros.h"
|
||||||
|
#include "net/filter/filter_source_stream.h"
|
||||||
|
|
||||||
|
class CefSourceStream : public net::FilterSourceStream {
|
||||||
|
public:
|
||||||
|
CefSourceStream(CefRefPtr<CefResponseFilter> cef_filter,
|
||||||
|
std::unique_ptr<net::SourceStream> upstream);
|
||||||
|
|
||||||
|
int FilterData(net::IOBuffer* output_buffer,
|
||||||
|
int output_buffer_size,
|
||||||
|
net::IOBuffer* input_buffer,
|
||||||
|
int input_buffer_size,
|
||||||
|
int* consumed_bytes,
|
||||||
|
bool upstream_eof_reached) override;
|
||||||
|
std::string GetTypeAsString() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CefRefPtr<CefResponseFilter> cef_filter_;
|
||||||
|
|
||||||
|
cef_response_filter_status_t last_status_ = RESPONSE_FILTER_NEED_MORE_DATA;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefSourceStream);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CEF_LIBCEF_BROWSER_NET_SOURCE_STREAM_H_
|
@ -322,20 +322,16 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||||||
std::move(main_backend),
|
std::move(main_backend),
|
||||||
true /* set_up_quic_server_info */)));
|
true /* set_up_quic_server_info */)));
|
||||||
|
|
||||||
#if !defined(DISABLE_FTP_SUPPORT)
|
|
||||||
ftp_transaction_factory_.reset(
|
|
||||||
new net::FtpNetworkLayer(network_session_params.host_resolver));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
||||||
new net::URLRequestJobFactoryImpl());
|
new net::URLRequestJobFactoryImpl());
|
||||||
url_request_manager_.reset(new CefURLRequestManager(job_factory.get()));
|
url_request_manager_.reset(new CefURLRequestManager(job_factory.get()));
|
||||||
|
|
||||||
// Install internal scheme handlers that cannot be overridden.
|
// Install internal scheme handlers that cannot be overridden.
|
||||||
scheme::InstallInternalProtectedHandlers(job_factory.get(),
|
scheme::InstallInternalProtectedHandlers(
|
||||||
url_request_manager_.get(),
|
job_factory.get(),
|
||||||
&protocol_handlers_,
|
url_request_manager_.get(),
|
||||||
ftp_transaction_factory_.get());
|
&protocol_handlers_,
|
||||||
|
network_session_params.host_resolver);
|
||||||
protocol_handlers_.clear();
|
protocol_handlers_.clear();
|
||||||
|
|
||||||
// Register internal scheme handlers that can be overridden.
|
// Register internal scheme handlers that can be overridden.
|
||||||
|
@ -105,7 +105,6 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
|||||||
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
|
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
|
||||||
std::unique_ptr<CefURLRequestContextImpl> url_request_context_;
|
std::unique_ptr<CefURLRequestContextImpl> url_request_context_;
|
||||||
std::unique_ptr<CefURLRequestManager> url_request_manager_;
|
std::unique_ptr<CefURLRequestManager> url_request_manager_;
|
||||||
std::unique_ptr<net::FtpTransactionFactory> ftp_transaction_factory_;
|
|
||||||
content::ProtocolHandlerMap protocol_handlers_;
|
content::ProtocolHandlerMap protocol_handlers_;
|
||||||
content::URLRequestInterceptorScopedVector request_interceptors_;
|
content::URLRequestInterceptorScopedVector request_interceptors_;
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "libcef/browser/osr/web_contents_view_osr.h"
|
#include "libcef/browser/osr/web_contents_view_osr.h"
|
||||||
#include "libcef/common/drag_data_impl.h"
|
#include "libcef/common/drag_data_impl.h"
|
||||||
|
|
||||||
|
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
|
||||||
|
#include "content/browser/web_contents/web_contents_impl.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
|
|
||||||
CefBrowserPlatformDelegateOsr::CefBrowserPlatformDelegateOsr(
|
CefBrowserPlatformDelegateOsr::CefBrowserPlatformDelegateOsr(
|
||||||
@ -247,52 +249,119 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
|||||||
CefRefPtr<CefDragData> drag_data,
|
CefRefPtr<CefDragData> drag_data,
|
||||||
const CefMouseEvent& event,
|
const CefMouseEvent& event,
|
||||||
cef_drag_operations_mask_t allowed_ops) {
|
cef_drag_operations_mask_t allowed_ops) {
|
||||||
content::RenderViewHost* rvh = browser_->web_contents()->GetRenderViewHost();
|
content::WebContentsImpl* web_contents =
|
||||||
if (!rvh)
|
static_cast<content::WebContentsImpl*>(browser_->web_contents());
|
||||||
|
if (!web_contents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (current_rvh_for_drag_)
|
||||||
|
DragTargetDragLeave();
|
||||||
|
|
||||||
|
const gfx::Point client_pt(event.x, event.y);
|
||||||
|
gfx::Point transformed_pt;
|
||||||
|
current_rwh_for_drag_ =
|
||||||
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||||
|
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||||
|
client_pt, &transformed_pt)->GetWeakPtr();
|
||||||
|
current_rvh_for_drag_ = web_contents->GetRenderViewHost();
|
||||||
|
|
||||||
drag_data_ = drag_data;
|
drag_data_ = drag_data;
|
||||||
|
drag_allowed_ops_ = allowed_ops;
|
||||||
|
|
||||||
CefDragDataImpl* data_impl = static_cast<CefDragDataImpl*>(drag_data.get());
|
CefDragDataImpl* data_impl = static_cast<CefDragDataImpl*>(drag_data.get());
|
||||||
base::AutoLock lock_scope(data_impl->lock());
|
base::AutoLock lock_scope(data_impl->lock());
|
||||||
content::DropData* drop_data = data_impl->drop_data();
|
content::DropData* drop_data = data_impl->drop_data();
|
||||||
const gfx::Point client_pt(event.x, event.y);
|
|
||||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||||
blink::WebDragOperationsMask ops =
|
blink::WebDragOperationsMask ops =
|
||||||
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
||||||
int modifiers = TranslateModifiers(event.modifiers);
|
int modifiers = TranslateModifiers(event.modifiers);
|
||||||
|
|
||||||
rvh->FilterDropData(drop_data);
|
current_rwh_for_drag_->FilterDropData(drop_data);
|
||||||
rvh->DragTargetDragEnter(*drop_data, client_pt, screen_pt, ops, modifiers);
|
|
||||||
|
// Give the delegate an opportunity to cancel the drag.
|
||||||
|
if (web_contents->GetDelegate() &&
|
||||||
|
!web_contents->GetDelegate()->CanDragEnter(
|
||||||
|
web_contents, *drop_data, ops)) {
|
||||||
|
drag_data_ = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
current_rwh_for_drag_->DragTargetDragEnter(
|
||||||
|
*drop_data, transformed_pt, screen_pt, ops, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||||
const CefMouseEvent& event,
|
const CefMouseEvent& event,
|
||||||
cef_drag_operations_mask_t allowed_ops) {
|
cef_drag_operations_mask_t allowed_ops) {
|
||||||
content::RenderViewHost* rvh = browser_->web_contents()->GetRenderViewHost();
|
if (!drag_data_)
|
||||||
if (!rvh)
|
return;
|
||||||
|
|
||||||
|
content::WebContentsImpl* web_contents =
|
||||||
|
static_cast<content::WebContentsImpl*>(browser_->web_contents());
|
||||||
|
if (!web_contents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const gfx::Point client_pt(event.x, event.y);
|
const gfx::Point client_pt(event.x, event.y);
|
||||||
|
gfx::Point transformed_pt;
|
||||||
|
content::RenderWidgetHostImpl* target_rwh =
|
||||||
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||||
|
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||||
|
client_pt, &transformed_pt);
|
||||||
|
|
||||||
|
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||||
|
if (current_rwh_for_drag_)
|
||||||
|
current_rwh_for_drag_->DragTargetDragLeave();
|
||||||
|
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!drag_data_)
|
||||||
|
return;
|
||||||
|
|
||||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||||
blink::WebDragOperationsMask ops =
|
blink::WebDragOperationsMask ops =
|
||||||
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
||||||
int modifiers = TranslateModifiers(event.modifiers);
|
int modifiers = TranslateModifiers(event.modifiers);
|
||||||
|
|
||||||
rvh->DragTargetDragOver(client_pt, screen_pt, ops, modifiers);
|
target_rwh->DragTargetDragOver(transformed_pt, screen_pt, ops, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||||
content::RenderViewHost* rvh = browser_->web_contents()->GetRenderViewHost();
|
if (current_rvh_for_drag_ != browser_->web_contents()->GetRenderViewHost() ||
|
||||||
if (!rvh)
|
!drag_data_) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
rvh->DragTargetDragLeave();
|
if (current_rwh_for_drag_) {
|
||||||
|
current_rwh_for_drag_->DragTargetDragLeave();
|
||||||
|
current_rwh_for_drag_.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
drag_data_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||||
content::RenderViewHost* rvh = browser_->web_contents()->GetRenderViewHost();
|
if (!drag_data_)
|
||||||
if (!rvh)
|
return;
|
||||||
|
|
||||||
|
content::WebContentsImpl* web_contents =
|
||||||
|
static_cast<content::WebContentsImpl*>(browser_->web_contents());
|
||||||
|
if (!web_contents)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gfx::Point client_pt(event.x, event.y);
|
||||||
|
gfx::Point transformed_pt;
|
||||||
|
content::RenderWidgetHostImpl* target_rwh =
|
||||||
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||||
|
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||||
|
client_pt, &transformed_pt);
|
||||||
|
|
||||||
|
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||||
|
if (current_rwh_for_drag_)
|
||||||
|
current_rwh_for_drag_->DragTargetDragLeave();
|
||||||
|
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!drag_data_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -300,35 +369,85 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
|||||||
static_cast<CefDragDataImpl*>(drag_data_.get());
|
static_cast<CefDragDataImpl*>(drag_data_.get());
|
||||||
base::AutoLock lock_scope(data_impl->lock());
|
base::AutoLock lock_scope(data_impl->lock());
|
||||||
content::DropData* drop_data = data_impl->drop_data();
|
content::DropData* drop_data = data_impl->drop_data();
|
||||||
const gfx::Point client_pt(event.x, event.y);
|
|
||||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||||
int modifiers = TranslateModifiers(event.modifiers);
|
int modifiers = TranslateModifiers(event.modifiers);
|
||||||
|
|
||||||
rvh->DragTargetDrop(*drop_data, client_pt, screen_pt, modifiers);
|
target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt,
|
||||||
|
modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
drag_data_ = nullptr;
|
drag_data_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserPlatformDelegateOsr::StartDragging(
|
||||||
|
const content::DropData& drop_data,
|
||||||
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
|
const gfx::ImageSkia& image,
|
||||||
|
const gfx::Vector2d& image_offset,
|
||||||
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh) {
|
||||||
|
drag_start_rwh_ = source_rwh->GetWeakPtr();
|
||||||
|
|
||||||
|
bool handled = false;
|
||||||
|
|
||||||
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
|
browser_->GetClient()->GetRenderHandler();
|
||||||
|
if (handler.get()) {
|
||||||
|
CefRefPtr<CefDragDataImpl> drag_data(new CefDragDataImpl(drop_data));
|
||||||
|
drag_data->SetReadOnly(true);
|
||||||
|
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||||
|
base::MessageLoop::current());
|
||||||
|
handled = handler->StartDragging(
|
||||||
|
browser_,
|
||||||
|
drag_data.get(),
|
||||||
|
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
|
||||||
|
event_info.event_location.x(),
|
||||||
|
event_info.event_location.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handled)
|
||||||
|
DragSourceSystemDragEnded();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefBrowserPlatformDelegateOsr::UpdateDragCursor(
|
||||||
|
blink::WebDragOperation operation) {
|
||||||
|
CefRefPtr<CefRenderHandler> handler =
|
||||||
|
browser_->GetClient()->GetRenderHandler();
|
||||||
|
if (handler.get()) {
|
||||||
|
handler->UpdateDragCursor(
|
||||||
|
browser_, static_cast<CefRenderHandler::DragOperation>(operation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
|
void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
|
||||||
int x, int y,
|
int x, int y,
|
||||||
cef_drag_operations_mask_t op) {
|
cef_drag_operations_mask_t op) {
|
||||||
content::RenderViewHost* rvh = browser_->web_contents()->GetRenderViewHost();
|
if (!drag_start_rwh_)
|
||||||
if (!rvh)
|
return;
|
||||||
|
|
||||||
|
content::WebContentsImpl* web_contents =
|
||||||
|
static_cast<content::WebContentsImpl*>(browser_->web_contents());
|
||||||
|
if (!web_contents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(x, y));
|
const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(x, y));
|
||||||
blink::WebDragOperation drag_op = static_cast<blink::WebDragOperation>(op);
|
blink::WebDragOperation drag_op = static_cast<blink::WebDragOperation>(op);
|
||||||
|
|
||||||
rvh->DragSourceEndedAt(x, y, screen_pt.x(), screen_pt.y(), drag_op);
|
web_contents->DragSourceEndedAt(x, y, screen_pt.x(), screen_pt.y(), drag_op,
|
||||||
|
drag_start_rwh_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
|
void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
|
||||||
content::RenderViewHost* rvh = browser_->web_contents()->GetRenderViewHost();
|
if (!drag_start_rwh_)
|
||||||
if (!rvh)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rvh->DragSourceSystemDragEnded();
|
content::WebContents* web_contents = browser_->web_contents();
|
||||||
|
if (!web_contents)
|
||||||
|
return;
|
||||||
|
|
||||||
|
web_contents->SystemDragEnded(drag_start_rwh_.get());
|
||||||
|
|
||||||
|
drag_start_rwh_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefWindowHandle CefBrowserPlatformDelegateOsr::GetParentWindowHandle() const {
|
CefWindowHandle CefBrowserPlatformDelegateOsr::GetParentWindowHandle() const {
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
class CefRenderWidgetHostViewOSR;
|
class CefRenderWidgetHostViewOSR;
|
||||||
class CefWebContentsViewOSR;
|
class CefWebContentsViewOSR;
|
||||||
|
|
||||||
|
namespace content {
|
||||||
|
class RenderWidgetHostImpl;
|
||||||
|
}
|
||||||
|
|
||||||
// Base implementation of windowless browser functionality.
|
// Base implementation of windowless browser functionality.
|
||||||
class CefBrowserPlatformDelegateOsr :
|
class CefBrowserPlatformDelegateOsr :
|
||||||
public CefBrowserPlatformDelegate,
|
public CefBrowserPlatformDelegate,
|
||||||
@ -72,6 +76,14 @@ class CefBrowserPlatformDelegateOsr :
|
|||||||
cef_drag_operations_mask_t allowed_ops) override;
|
cef_drag_operations_mask_t allowed_ops) override;
|
||||||
void DragTargetDragLeave() override;
|
void DragTargetDragLeave() override;
|
||||||
void DragTargetDrop(const CefMouseEvent& event) override;
|
void DragTargetDrop(const CefMouseEvent& event) override;
|
||||||
|
void StartDragging(
|
||||||
|
const content::DropData& drop_data,
|
||||||
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
|
const gfx::ImageSkia& image,
|
||||||
|
const gfx::Vector2d& image_offset,
|
||||||
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh) override;
|
||||||
|
void UpdateDragCursor(blink::WebDragOperation operation) override;
|
||||||
void DragSourceEndedAt(int x, int y,
|
void DragSourceEndedAt(int x, int y,
|
||||||
cef_drag_operations_mask_t op) override;
|
cef_drag_operations_mask_t op) override;
|
||||||
void DragSourceSystemDragEnded() override;
|
void DragSourceSystemDragEnded() override;
|
||||||
@ -95,6 +107,20 @@ class CefBrowserPlatformDelegateOsr :
|
|||||||
|
|
||||||
// Pending drag/drop data.
|
// Pending drag/drop data.
|
||||||
CefRefPtr<CefDragData> drag_data_;
|
CefRefPtr<CefDragData> drag_data_;
|
||||||
|
cef_drag_operations_mask_t drag_allowed_ops_;
|
||||||
|
|
||||||
|
// We keep track of the RenderWidgetHost we're dragging over. If it changes
|
||||||
|
// during a drag, we need to re-send the DragEnter message.
|
||||||
|
base::WeakPtr<content::RenderWidgetHostImpl> current_rwh_for_drag_;
|
||||||
|
|
||||||
|
// We also keep track of the RenderViewHost we're dragging over to avoid
|
||||||
|
// sending the drag exited message after leaving the current
|
||||||
|
// view. |current_rvh_for_drag_| should not be dereferenced.
|
||||||
|
void* current_rvh_for_drag_;
|
||||||
|
|
||||||
|
// We keep track of the RenderWidgetHost from which the current drag started,
|
||||||
|
// in order to properly route the drag end message to it.
|
||||||
|
base::WeakPtr<content::RenderWidgetHostImpl> drag_start_rwh_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_BROWSER_OSR_BROWSER_PLATFORM_DELEGATE_OSR_H_
|
#endif // CEF_LIBCEF_BROWSER_OSR_BROWSER_PLATFORM_DELEGATE_OSR_H_
|
||||||
|
@ -1090,10 +1090,6 @@ CefRenderWidgetHostViewOSR::DelegatedFrameHostSendReclaimCompositorResources(
|
|||||||
resources));
|
resources));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::DelegatedFrameHostOnLostCompositorResources() {
|
|
||||||
render_widget_host_->ScheduleComposite();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::SetBeginFrameSource(
|
void CefRenderWidgetHostViewOSR::SetBeginFrameSource(
|
||||||
cc::BeginFrameSource* source) {
|
cc::BeginFrameSource* source) {
|
||||||
// TODO(cef): Maybe we can use this method in combination with
|
// TODO(cef): Maybe we can use this method in combination with
|
||||||
|
@ -190,7 +190,6 @@ class CefRenderWidgetHostViewOSR
|
|||||||
int output_surface_id,
|
int output_surface_id,
|
||||||
bool is_swap_ack,
|
bool is_swap_ack,
|
||||||
const cc::ReturnedResourceArray& resources) override;
|
const cc::ReturnedResourceArray& resources) override;
|
||||||
void DelegatedFrameHostOnLostCompositorResources() override;
|
|
||||||
void SetBeginFrameSource(cc::BeginFrameSource* source) override;
|
void SetBeginFrameSource(cc::BeginFrameSource* source) override;
|
||||||
bool IsAutoResizeEnabled() const override;
|
bool IsAutoResizeEnabled() const override;
|
||||||
#endif // !defined(OS_MACOSX)
|
#endif // !defined(OS_MACOSX)
|
||||||
|
@ -58,10 +58,6 @@ class MacHelper :
|
|||||||
is_swap_ack, resources));
|
is_swap_ack, resources));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserCompositorMacOnLostCompositorResources() override {
|
|
||||||
view_->render_widget_host()->ScheduleComposite();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BrowserCompositorMacSendBeginFrame(
|
void BrowserCompositorMacSendBeginFrame(
|
||||||
const cc::BeginFrameArgs& args) override {
|
const cc::BeginFrameArgs& args) override {
|
||||||
view_->render_widget_host()->Send(
|
view_->render_widget_host()->Send(
|
||||||
|
@ -32,8 +32,6 @@ void CefSoftwareOutputDeviceOSR::Resize(const gfx::Size& viewport_pixel_size,
|
|||||||
float scale_factor) {
|
float scale_factor) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
scale_factor_ = scale_factor;
|
|
||||||
|
|
||||||
if (viewport_pixel_size_ == viewport_pixel_size)
|
if (viewport_pixel_size_ == viewport_pixel_size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -197,7 +197,8 @@ void CefWebContentsViewOSR::StartDragging(
|
|||||||
blink::WebDragOperationsMask allowed_ops,
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
const gfx::ImageSkia& image,
|
const gfx::ImageSkia& image,
|
||||||
const gfx::Vector2d& image_offset,
|
const gfx::Vector2d& image_offset,
|
||||||
const content::DragEventSourceInfo& event_info) {
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh) {
|
||||||
if (guest_) {
|
if (guest_) {
|
||||||
// Based on WebContentsViewGuest::StartDragging.
|
// Based on WebContentsViewGuest::StartDragging.
|
||||||
content::WebContentsImpl* embedder_web_contents =
|
content::WebContentsImpl* embedder_web_contents =
|
||||||
@ -213,36 +214,24 @@ void CefWebContentsViewOSR::StartDragging(
|
|||||||
content::RecordAction(
|
content::RecordAction(
|
||||||
base::UserMetricsAction("BrowserPlugin.Guest.StartDrag"));
|
base::UserMetricsAction("BrowserPlugin.Guest.StartDrag"));
|
||||||
view->StartDragging(drop_data, allowed_ops, image, image_offset,
|
view->StartDragging(drop_data, allowed_ops, image, image_offset,
|
||||||
event_info);
|
event_info, source_rwh);
|
||||||
} else {
|
} else {
|
||||||
embedder_web_contents->SystemDragEnded();
|
embedder_web_contents->SystemDragEnded(source_rwh);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser;
|
CefRefPtr<CefBrowserHostImpl> browser;
|
||||||
CefRefPtr<CefRenderHandler> handler;
|
|
||||||
bool handled = false;
|
|
||||||
CefRenderWidgetHostViewOSR* view =
|
CefRenderWidgetHostViewOSR* view =
|
||||||
static_cast<CefRenderWidgetHostViewOSR*>(view_);
|
static_cast<CefRenderWidgetHostViewOSR*>(view_);
|
||||||
if (view)
|
if (view)
|
||||||
browser = view->browser_impl();
|
browser = view->browser_impl();
|
||||||
if (browser.get())
|
if (browser.get()) {
|
||||||
handler = browser->GetClient()->GetRenderHandler();
|
browser->StartDragging(drop_data, allowed_ops, image, image_offset,
|
||||||
if (handler.get()) {
|
event_info, source_rwh);
|
||||||
CefRefPtr<CefDragDataImpl> drag_data(new CefDragDataImpl(drop_data));
|
} else if (web_contents_) {
|
||||||
drag_data->SetReadOnly(true);
|
web_contents_->SystemDragEnded(source_rwh);
|
||||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
|
||||||
base::MessageLoop::current());
|
|
||||||
handled = handler->StartDragging(
|
|
||||||
browser.get(),
|
|
||||||
drag_data.get(),
|
|
||||||
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
|
|
||||||
event_info.event_location.x(),
|
|
||||||
event_info.event_location.y());
|
|
||||||
}
|
}
|
||||||
if (!handled && web_contents_)
|
|
||||||
web_contents_->SystemDragEnded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::UpdateDragCursor(
|
void CefWebContentsViewOSR::UpdateDragCursor(
|
||||||
@ -261,16 +250,10 @@ void CefWebContentsViewOSR::UpdateDragCursor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser;
|
CefRefPtr<CefBrowserHostImpl> browser;
|
||||||
CefRefPtr<CefRenderHandler> handler;
|
|
||||||
CefRenderWidgetHostViewOSR* view =
|
CefRenderWidgetHostViewOSR* view =
|
||||||
static_cast<CefRenderWidgetHostViewOSR*>(view_);
|
static_cast<CefRenderWidgetHostViewOSR*>(view_);
|
||||||
if (view)
|
if (view)
|
||||||
browser = view->browser_impl();
|
browser = view->browser_impl();
|
||||||
if (browser.get())
|
if (browser.get())
|
||||||
handler = browser->GetClient()->GetRenderHandler();
|
browser->UpdateDragCursor(operation);
|
||||||
if (handler.get()) {
|
|
||||||
handler->UpdateDragCursor(
|
|
||||||
browser.get(),
|
|
||||||
static_cast<CefRenderHandler::DragOperation>(operation));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,8 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
|||||||
blink::WebDragOperationsMask allowed_ops,
|
blink::WebDragOperationsMask allowed_ops,
|
||||||
const gfx::ImageSkia& image,
|
const gfx::ImageSkia& image,
|
||||||
const gfx::Vector2d& image_offset,
|
const gfx::Vector2d& image_offset,
|
||||||
const content::DragEventSourceInfo& event_info) override;
|
const content::DragEventSourceInfo& event_info,
|
||||||
|
content::RenderWidgetHostImpl* source_rwh) override;
|
||||||
void UpdateDragCursor(blink::WebDragOperation operation) override;
|
void UpdateDragCursor(blink::WebDragOperation operation) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "chrome/browser/plugins/plugin_finder.h"
|
#include "chrome/browser/plugins/plugin_finder.h"
|
||||||
#include "chrome/browser/plugins/plugins_field_trial.h"
|
#include "chrome/browser/plugins/plugins_field_trial.h"
|
||||||
|
#include "chrome/common/features.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "components/content_settings/core/browser/content_settings_utils.h"
|
#include "components/content_settings/core/browser/content_settings_utils.h"
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
@ -60,18 +61,18 @@ bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
|
|||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
// Treat CDM invocations like JavaScript.
|
// Treat CDM invocations like JavaScript.
|
||||||
if (plugin.name == base::ASCIIToUTF16(kWidevineCdmDisplayName)) {
|
if (plugin.name == base::ASCIIToUTF16(kWidevineCdmDisplayName)) {
|
||||||
DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
|
DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_PEPPER_CDMS)
|
#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
enum PluginAvailabilityStatusForUMA {
|
enum PluginAvailabilityStatusForUMA {
|
||||||
PLUGIN_NOT_REGISTERED,
|
PLUGIN_NOT_REGISTERED,
|
||||||
@ -92,14 +93,14 @@ static void SendPluginAvailabilityUMA(const std::string& mime_type,
|
|||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(ENABLE_PEPPER_CDMS)
|
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
void ReportMetrics(const std::string& mime_type,
|
void ReportMetrics(const std::string& mime_type,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
const url::Origin& main_frame_origin) {
|
const url::Origin& main_frame_origin) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_EXTENSIONS)
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
// Returns whether a request from a plugin to load |resource| from a renderer
|
// Returns whether a request from a plugin to load |resource| from a renderer
|
||||||
// with process id |process_id| is a request for an internal resource by an app
|
// with process id |process_id| is a request for an internal resource by an app
|
||||||
// listed in |accessible_resources| in its manifest.
|
// listed in |accessible_resources| in its manifest.
|
||||||
@ -129,7 +130,7 @@ bool IsPluginLoadingAccessibleResourceInWebView(
|
|||||||
return renderer_state->GetOwnerInfo(process_id, nullptr, &owner_extension) &&
|
return renderer_state->GetOwnerInfo(process_id, nullptr, &owner_extension) &&
|
||||||
owner_extension == extension_id;
|
owner_extension == extension_id;
|
||||||
}
|
}
|
||||||
#endif // defined(ENABLE_EXTENSIONS)
|
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ CefPluginInfoMessageFilter::Context::Context(
|
|||||||
: render_process_id_(render_process_id),
|
: render_process_id_(render_process_id),
|
||||||
resource_context_(profile->GetResourceContext()),
|
resource_context_(profile->GetResourceContext()),
|
||||||
host_content_settings_map_(profile->GetHostContentSettingsMap()) {
|
host_content_settings_map_(profile->GetHostContentSettingsMap()) {
|
||||||
#if defined(ENABLE_EXTENSIONS)
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
if (extensions::ExtensionsEnabled())
|
if (extensions::ExtensionsEnabled())
|
||||||
extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
||||||
#endif
|
#endif
|
||||||
@ -174,7 +175,7 @@ bool CefPluginInfoMessageFilter::OnMessageReceived(
|
|||||||
IPC_BEGIN_MESSAGE_MAP(CefPluginInfoMessageFilter, message)
|
IPC_BEGIN_MESSAGE_MAP(CefPluginInfoMessageFilter, message)
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(CefViewHostMsg_GetPluginInfo,
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(CefViewHostMsg_GetPluginInfo,
|
||||||
OnGetPluginInfo)
|
OnGetPluginInfo)
|
||||||
#if defined(ENABLE_PEPPER_CDMS)
|
#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
IPC_MESSAGE_HANDLER(
|
IPC_MESSAGE_HANDLER(
|
||||||
CefViewHostMsg_IsInternalPluginAvailableForMimeType,
|
CefViewHostMsg_IsInternalPluginAvailableForMimeType,
|
||||||
OnIsInternalPluginAvailableForMimeType)
|
OnIsInternalPluginAvailableForMimeType)
|
||||||
@ -249,7 +250,7 @@ void CefPluginInfoMessageFilter::PluginsLoaded(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_PEPPER_CDMS)
|
#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
void CefPluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
|
void CefPluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
|
||||||
const std::string& mime_type,
|
const std::string& mime_type,
|
||||||
@ -285,7 +286,7 @@ void CefPluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
|
|||||||
mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED);
|
mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(ENABLE_PEPPER_CDMS)
|
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
||||||
const GetPluginInfo_Params& params,
|
const GetPluginInfo_Params& params,
|
||||||
@ -312,12 +313,13 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
|||||||
// TODO(tommycli): Remove once we deprecate the plugin ASK policy.
|
// TODO(tommycli): Remove once we deprecate the plugin ASK policy.
|
||||||
bool legacy_ask_user = plugin_setting == CONTENT_SETTING_ASK;
|
bool legacy_ask_user = plugin_setting == CONTENT_SETTING_ASK;
|
||||||
plugin_setting = PluginsFieldTrial::EffectiveContentSetting(
|
plugin_setting = PluginsFieldTrial::EffectiveContentSetting(
|
||||||
CONTENT_SETTINGS_TYPE_PLUGINS, plugin_setting);
|
host_content_settings_map_, CONTENT_SETTINGS_TYPE_PLUGINS,
|
||||||
|
plugin_setting);
|
||||||
|
|
||||||
DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
|
DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
|
||||||
DCHECK(plugin_setting != CONTENT_SETTING_ASK);
|
DCHECK(plugin_setting != CONTENT_SETTING_ASK);
|
||||||
|
|
||||||
#if defined(ENABLE_PLUGIN_INSTALLATION)
|
#if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION)
|
||||||
// Check if the plugin is outdated.
|
// Check if the plugin is outdated.
|
||||||
if (plugin_status == PluginMetadata::SECURITY_STATUS_OUT_OF_DATE &&
|
if (plugin_status == PluginMetadata::SECURITY_STATUS_OUT_OF_DATE &&
|
||||||
!allow_outdated_plugins_.GetValue()) {
|
!allow_outdated_plugins_.GetValue()) {
|
||||||
@ -339,7 +341,7 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_EXTENSIONS)
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
// If an app has explicitly made internal resources available by listing them
|
// If an app has explicitly made internal resources available by listing them
|
||||||
// in |accessible_resources| in the manifest, then allow them to be loaded by
|
// in |accessible_resources| in the manifest, then allow them to be loaded by
|
||||||
// plugins inside a guest-view.
|
// plugins inside a guest-view.
|
||||||
@ -350,7 +352,7 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
|||||||
extension_registry_, render_process_id_, params.url)) {
|
extension_registry_, render_process_id_, params.url)) {
|
||||||
plugin_setting = CONTENT_SETTING_ALLOW;
|
plugin_setting = CONTENT_SETTING_ALLOW;
|
||||||
}
|
}
|
||||||
#endif // defined(ENABLE_EXTENSIONS)
|
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
|
|
||||||
if (plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) {
|
if (plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) {
|
||||||
*status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
*status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||||
@ -362,7 +364,7 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
|||||||
: CefViewHostMsg_GetPluginInfo_Status::kBlocked;
|
: CefViewHostMsg_GetPluginInfo_Status::kBlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_EXTENSIONS)
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
// Allow an embedder of <webview> to block a plugin from being loaded inside
|
// Allow an embedder of <webview> to block a plugin from being loaded inside
|
||||||
// the guest. In order to do this, set the status to 'Unauthorized' here,
|
// the guest. In order to do this, set the status to 'Unauthorized' here,
|
||||||
// and update the status as appropriate depending on the response from the
|
// and update the status as appropriate depending on the response from the
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include "components/content_settings/core/common/content_settings.h"
|
#include "components/content_settings/core/common/content_settings.h"
|
||||||
#include "components/prefs/pref_member.h"
|
#include "components/prefs/pref_member.h"
|
||||||
#include "content/public/browser/browser_message_filter.h"
|
#include "content/public/browser/browser_message_filter.h"
|
||||||
|
#include "extensions/features/features.h"
|
||||||
|
#include "ppapi/features/features.h"
|
||||||
|
|
||||||
class CefBrowserContext;
|
class CefBrowserContext;
|
||||||
class CefRequestContextHandler;
|
class CefRequestContextHandler;
|
||||||
@ -74,7 +76,7 @@ class CefPluginInfoMessageFilter : public content::BrowserMessageFilter {
|
|||||||
private:
|
private:
|
||||||
int render_process_id_;
|
int render_process_id_;
|
||||||
content::ResourceContext* resource_context_;
|
content::ResourceContext* resource_context_;
|
||||||
#if defined(ENABLE_EXTENSIONS)
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
extensions::ExtensionRegistry* extension_registry_;
|
extensions::ExtensionRegistry* extension_registry_;
|
||||||
#endif
|
#endif
|
||||||
const HostContentSettingsMap* host_content_settings_map_;
|
const HostContentSettingsMap* host_content_settings_map_;
|
||||||
@ -109,7 +111,7 @@ class CefPluginInfoMessageFilter : public content::BrowserMessageFilter {
|
|||||||
IPC::Message* reply_msg,
|
IPC::Message* reply_msg,
|
||||||
const std::vector<content::WebPluginInfo>& plugins);
|
const std::vector<content::WebPluginInfo>& plugins);
|
||||||
|
|
||||||
#if defined(ENABLE_PEPPER_CDMS)
|
#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
// Returns whether any internal plugin supporting |mime_type| is registered
|
// Returns whether any internal plugin supporting |mime_type| is registered
|
||||||
// and enabled. Does not determine whether the plugin can actually be
|
// and enabled. Does not determine whether the plugin can actually be
|
||||||
// instantiated (e.g. whether it has all its dependencies).
|
// instantiated (e.g. whether it has all its dependencies).
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/values.h"
|
#include "base/values.h"
|
||||||
#include "chrome/browser/net/prediction_options.h"
|
#include "chrome/browser/net/prediction_options.h"
|
||||||
#include "chrome/browser/prefs/command_line_pref_store.h"
|
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
|
||||||
#include "chrome/browser/supervised_user/supervised_user_pref_store.h"
|
#include "chrome/browser/supervised_user/supervised_user_pref_store.h"
|
||||||
#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
|
#include "chrome/browser/supervised_user/supervised_user_settings_service.h"
|
||||||
#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
|
#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h"
|
||||||
@ -33,8 +33,8 @@
|
|||||||
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
|
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
|
||||||
#include "components/proxy_config/proxy_config_dictionary.h"
|
#include "components/proxy_config/proxy_config_dictionary.h"
|
||||||
#include "components/spellcheck/browser/pref_names.h"
|
#include "components/spellcheck/browser/pref_names.h"
|
||||||
#include "components/syncable_prefs/pref_service_syncable.h"
|
#include "components/sync_preferences/pref_service_syncable.h"
|
||||||
#include "components/syncable_prefs/pref_service_syncable_factory.h"
|
#include "components/sync_preferences/pref_service_syncable_factory.h"
|
||||||
#include "components/update_client/update_client.h"
|
#include "components/update_client/update_client.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "extensions/browser/extension_prefs.h"
|
#include "extensions/browser/extension_prefs.h"
|
||||||
@ -102,13 +102,13 @@ std::unique_ptr<PrefService> CreatePrefService(
|
|||||||
|
|
||||||
// Use of PrefServiceSyncable is required by Chrome code such as
|
// Use of PrefServiceSyncable is required by Chrome code such as
|
||||||
// HostContentSettingsMapFactory that calls PrefServiceSyncableFromProfile.
|
// HostContentSettingsMapFactory that calls PrefServiceSyncableFromProfile.
|
||||||
syncable_prefs::PrefServiceSyncableFactory factory;
|
sync_preferences::PrefServiceSyncableFactory factory;
|
||||||
|
|
||||||
// Used to store command-line preferences, most of which will be evaluated in
|
// Used to store command-line preferences, most of which will be evaluated in
|
||||||
// the CommandLinePrefStore constructor. Preferences set in this manner cannot
|
// the CommandLinePrefStore constructor. Preferences set in this manner cannot
|
||||||
// be overridden by the user.
|
// be overridden by the user.
|
||||||
scoped_refptr<CommandLinePrefStore> command_line_pref_store(
|
scoped_refptr<ChromeCommandLinePrefStore> command_line_pref_store(
|
||||||
new CommandLinePrefStore(command_line));
|
new ChromeCommandLinePrefStore(command_line));
|
||||||
renderer_prefs::SetCommandLinePrefDefaults(command_line_pref_store.get());
|
renderer_prefs::SetCommandLinePrefDefaults(command_line_pref_store.get());
|
||||||
factory.set_command_line_prefs(command_line_pref_store);
|
factory.set_command_line_prefs(command_line_pref_store);
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include "chrome/browser/defaults.h"
|
#include "chrome/browser/defaults.h"
|
||||||
#include "chrome/browser/extensions/extension_webkit_preferences.h"
|
#include "chrome/browser/extensions/extension_webkit_preferences.h"
|
||||||
#include "chrome/browser/font_family_cache.h"
|
#include "chrome/browser/font_family_cache.h"
|
||||||
#include "chrome/browser/prefs/command_line_pref_store.h"
|
|
||||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
|
#include "components/prefs/command_line_pref_store.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
#include "components/prefs/pref_store.h"
|
#include "components/prefs/pref_store.h"
|
||||||
#include "components/pref_registry/pref_registry_syncable.h"
|
#include "components/pref_registry/pref_registry_syncable.h"
|
||||||
@ -52,8 +52,6 @@ void SetDefaultPrefs(content::WebPreferences& web) {
|
|||||||
!command_line->HasSwitch(switches::kDisableJavascriptCloseWindows);
|
!command_line->HasSwitch(switches::kDisableJavascriptCloseWindows);
|
||||||
web.javascript_can_access_clipboard =
|
web.javascript_can_access_clipboard =
|
||||||
!command_line->HasSwitch(switches::kDisableJavascriptAccessClipboard);
|
!command_line->HasSwitch(switches::kDisableJavascriptAccessClipboard);
|
||||||
web.caret_browsing_enabled =
|
|
||||||
command_line->HasSwitch(switches::kEnableCaretBrowsing);
|
|
||||||
web.allow_universal_access_from_file_urls =
|
web.allow_universal_access_from_file_urls =
|
||||||
command_line->HasSwitch(switches::kAllowUniversalAccessFromFileUrls);
|
command_line->HasSwitch(switches::kAllowUniversalAccessFromFileUrls);
|
||||||
web.shrinks_standalone_images_to_fit =
|
web.shrinks_standalone_images_to_fit =
|
||||||
@ -247,7 +245,6 @@ void SetCefPrefs(const CefBrowserSettings& cef,
|
|||||||
SET_STATE(cef.javascript_access_clipboard,
|
SET_STATE(cef.javascript_access_clipboard,
|
||||||
web.javascript_can_access_clipboard);
|
web.javascript_can_access_clipboard);
|
||||||
SET_STATE(cef.javascript_dom_paste, web.dom_paste_enabled);
|
SET_STATE(cef.javascript_dom_paste, web.dom_paste_enabled);
|
||||||
SET_STATE(cef.caret_browsing, web.caret_browsing_enabled);
|
|
||||||
SET_STATE(cef.plugins, web.plugins_enabled);
|
SET_STATE(cef.plugins, web.plugins_enabled);
|
||||||
SET_STATE(cef.universal_access_from_file_urls,
|
SET_STATE(cef.universal_access_from_file_urls,
|
||||||
web.allow_universal_access_from_file_urls);
|
web.allow_universal_access_from_file_urls);
|
||||||
|
@ -5,20 +5,20 @@
|
|||||||
#include "include/internal/cef_types_wrappers.h"
|
#include "include/internal/cef_types_wrappers.h"
|
||||||
#include "libcef/browser/printing/print_view_manager.h"
|
#include "libcef/browser/printing/print_view_manager.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/lazy_instance.h"
|
#include "base/lazy_instance.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/memory/ref_counted_memory.h"
|
#include "base/memory/ref_counted_memory.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/printing/print_job_manager.h"
|
#include "chrome/browser/printing/print_job_manager.h"
|
||||||
#include "chrome/browser/printing/print_preview_dialog_controller.h"
|
|
||||||
#include "chrome/browser/printing/printer_query.h"
|
#include "chrome/browser/printing/printer_query.h"
|
||||||
#include "components/printing/common/print_messages.h"
|
#include "components/printing/common/print_messages.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
|
#include "content/public/browser/render_frame_host.h"
|
||||||
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "printing/pdf_metafile_skia.h"
|
#include "printing/pdf_metafile_skia.h"
|
||||||
|
|
||||||
@ -47,6 +47,7 @@ void FillInDictionaryFromPdfPrintSettings(
|
|||||||
print_settings.SetInteger(kSettingCopies, 1);
|
print_settings.SetInteger(kSettingCopies, 1);
|
||||||
print_settings.SetBoolean(kSettingCollate, false);
|
print_settings.SetBoolean(kSettingCollate, false);
|
||||||
print_settings.SetString(kSettingDeviceName, "");
|
print_settings.SetString(kSettingDeviceName, "");
|
||||||
|
print_settings.SetInteger(kSettingScaleFactor, 100);
|
||||||
print_settings.SetBoolean(kSettingGenerateDraftData, false);
|
print_settings.SetBoolean(kSettingGenerateDraftData, false);
|
||||||
print_settings.SetBoolean(kSettingPreviewModifiable, false);
|
print_settings.SetBoolean(kSettingPreviewModifiable, false);
|
||||||
|
|
||||||
@ -119,9 +120,9 @@ void StopWorker(int document_cookie) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<base::RefCountedBytes>
|
scoped_refptr<base::RefCountedBytes>
|
||||||
GetDataFromHandle(base::SharedMemoryHandle handle, uint32_t data_size) {
|
GetDataFromHandle(base::SharedMemoryHandle handle, uint32_t data_size) {
|
||||||
std::unique_ptr<base::SharedMemory> shared_buf(
|
std::unique_ptr<base::SharedMemory> shared_buf =
|
||||||
new base::SharedMemory(handle, true));
|
base::MakeUnique<base::SharedMemory>(handle, true);
|
||||||
|
|
||||||
if (!shared_buf->Map(data_size)) {
|
if (!shared_buf->Map(data_size)) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
@ -156,6 +157,13 @@ void SavePdfFile(scoped_refptr<base::RefCountedBytes> data,
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
struct CefPrintViewManager::PdfPrintState {
|
||||||
|
content::RenderFrameHost* printing_rfh_ = nullptr;
|
||||||
|
base::FilePath output_path_;
|
||||||
|
base::DictionaryValue settings_;
|
||||||
|
PdfPrintCallback callback_;
|
||||||
|
};
|
||||||
|
|
||||||
CefPrintViewManager::CefPrintViewManager(content::WebContents* web_contents)
|
CefPrintViewManager::CefPrintViewManager(content::WebContents* web_contents)
|
||||||
: CefPrintViewManagerBase(web_contents) {
|
: CefPrintViewManagerBase(web_contents) {
|
||||||
}
|
}
|
||||||
@ -164,15 +172,62 @@ CefPrintViewManager::~CefPrintViewManager() {
|
|||||||
TerminatePdfPrintJob();
|
TerminatePdfPrintJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_BASIC_PRINTING)
|
bool CefPrintViewManager::PrintToPDF(content::RenderFrameHost* rfh,
|
||||||
bool CefPrintViewManager::PrintForSystemDialogNow() {
|
const base::FilePath& path,
|
||||||
return PrintNowInternal(new PrintMsg_PrintForSystemDialog(routing_id()));
|
const CefPdfPrintSettings& settings,
|
||||||
}
|
const PdfPrintCallback& callback) {
|
||||||
#endif // ENABLE_BASIC_PRINTING
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
|
|
||||||
bool CefPrintViewManager::OnMessageReceived(const IPC::Message& message) {
|
// Don't start print again while printing is currently in progress.
|
||||||
|
if (pdf_print_state_)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Don't print interstitials or crashed tabs.
|
||||||
|
if (!web_contents() || web_contents()->ShowingInterstitialPage() ||
|
||||||
|
web_contents()->IsCrashed()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdf_print_state_.reset(new PdfPrintState);
|
||||||
|
pdf_print_state_->printing_rfh_ = rfh;
|
||||||
|
pdf_print_state_->output_path_ = path;
|
||||||
|
pdf_print_state_->callback_ = callback;
|
||||||
|
|
||||||
|
FillInDictionaryFromPdfPrintSettings(settings,
|
||||||
|
++next_pdf_request_id_,
|
||||||
|
pdf_print_state_->settings_);
|
||||||
|
|
||||||
|
rfh->Send(new PrintMsg_InitiatePrintPreview(rfh->GetRoutingID(),
|
||||||
|
!!settings.selection_only));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefPrintViewManager::RenderFrameDeleted(
|
||||||
|
content::RenderFrameHost* render_frame_host) {
|
||||||
|
if (pdf_print_state_ &&
|
||||||
|
render_frame_host == pdf_print_state_->printing_rfh_) {
|
||||||
|
TerminatePdfPrintJob();
|
||||||
|
}
|
||||||
|
CefPrintViewManagerBase::RenderFrameDeleted(render_frame_host);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefPrintViewManager::NavigationStopped() {
|
||||||
|
TerminatePdfPrintJob();
|
||||||
|
CefPrintViewManagerBase::NavigationStopped();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefPrintViewManager::RenderProcessGone(base::TerminationStatus status) {
|
||||||
|
TerminatePdfPrintJob();
|
||||||
|
CefPrintViewManagerBase::RenderProcessGone(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefPrintViewManager::OnMessageReceived(
|
||||||
|
const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* render_frame_host) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(CefPrintViewManager, message)
|
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(CefPrintViewManager, message,
|
||||||
|
render_frame_host)
|
||||||
IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog, OnDidShowPrintDialog)
|
IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog, OnDidShowPrintDialog)
|
||||||
IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview,
|
IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview,
|
||||||
OnRequestPrintPreview)
|
OnRequestPrintPreview)
|
||||||
@ -181,48 +236,22 @@ bool CefPrintViewManager::OnMessageReceived(const IPC::Message& message) {
|
|||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
IPC_END_MESSAGE_MAP()
|
IPC_END_MESSAGE_MAP()
|
||||||
|
|
||||||
return handled || CefPrintViewManagerBase::OnMessageReceived(message);
|
return handled ||
|
||||||
|
CefPrintViewManagerBase::OnMessageReceived(message, render_frame_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManager::NavigationStopped() {
|
void CefPrintViewManager::OnDidShowPrintDialog(content::RenderFrameHost* rfh) {
|
||||||
CefPrintViewManagerBase::NavigationStopped();
|
|
||||||
TerminatePdfPrintJob();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefPrintViewManager::RenderProcessGone(base::TerminationStatus status) {
|
|
||||||
CefPrintViewManagerBase::RenderProcessGone(status);
|
|
||||||
TerminatePdfPrintJob();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefPrintViewManager::PrintToPDF(const base::FilePath& path,
|
|
||||||
const CefPdfPrintSettings& settings,
|
|
||||||
const PdfPrintCallback& callback) {
|
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
||||||
if (!web_contents() || pdf_print_settings_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
pdf_output_path_ = path;
|
|
||||||
pdf_print_callback_ = callback;
|
|
||||||
|
|
||||||
pdf_print_settings_.reset(new base::DictionaryValue);
|
|
||||||
FillInDictionaryFromPdfPrintSettings(settings,
|
|
||||||
++next_pdf_request_id_,
|
|
||||||
*pdf_print_settings_);
|
|
||||||
|
|
||||||
Send(new PrintMsg_InitiatePrintPreview(routing_id(),
|
|
||||||
!!settings.selection_only));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefPrintViewManager::OnDidShowPrintDialog() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManager::OnRequestPrintPreview(
|
void CefPrintViewManager::OnRequestPrintPreview(
|
||||||
const PrintHostMsg_RequestPrintPreview_Params&) {
|
const PrintHostMsg_RequestPrintPreview_Params&) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
if (!web_contents() || !pdf_print_settings_)
|
if (!pdf_print_state_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Send(new PrintMsg_PrintPreview(routing_id(), *pdf_print_settings_));
|
pdf_print_state_->printing_rfh_->Send(new PrintMsg_PrintPreview(
|
||||||
|
pdf_print_state_->printing_rfh_->GetRoutingID(),
|
||||||
|
pdf_print_state_->settings_));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManager::OnMetafileReadyForPrinting(
|
void CefPrintViewManager::OnMetafileReadyForPrinting(
|
||||||
@ -230,6 +259,9 @@ void CefPrintViewManager::OnMetafileReadyForPrinting(
|
|||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
StopWorker(params.document_cookie);
|
StopWorker(params.document_cookie);
|
||||||
|
|
||||||
|
if (!pdf_print_state_)
|
||||||
|
return;
|
||||||
|
|
||||||
scoped_refptr<base::RefCountedBytes> data_bytes =
|
scoped_refptr<base::RefCountedBytes> data_bytes =
|
||||||
GetDataFromHandle(params.metafile_data_handle, params.data_size);
|
GetDataFromHandle(params.metafile_data_handle, params.data_size);
|
||||||
if (!data_bytes || !data_bytes->size()) {
|
if (!data_bytes || !data_bytes->size()) {
|
||||||
@ -237,37 +269,32 @@ void CefPrintViewManager::OnMetafileReadyForPrinting(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::FilePath pdf_output_path = pdf_output_path_;
|
const base::FilePath output_path = pdf_print_state_->output_path_;
|
||||||
PdfPrintCallback pdf_print_callback = pdf_print_callback_;
|
const PdfPrintCallback print_callback = pdf_print_state_->callback_;
|
||||||
|
|
||||||
// Reset state information.
|
// Reset state information.
|
||||||
pdf_output_path_.clear();
|
pdf_print_state_.reset();
|
||||||
pdf_print_callback_.Reset();
|
|
||||||
pdf_print_settings_.reset();
|
|
||||||
|
|
||||||
// Save the PDF file to disk and then execute the callback.
|
// Save the PDF file to disk and then execute the callback.
|
||||||
BrowserThread::PostTask(BrowserThread::FILE,
|
BrowserThread::PostTask(BrowserThread::FILE,
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(&SavePdfFile, data_bytes, pdf_output_path,
|
base::Bind(&SavePdfFile, data_bytes, output_path, print_callback));
|
||||||
pdf_print_callback));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManager::TerminatePdfPrintJob() {
|
void CefPrintViewManager::TerminatePdfPrintJob() {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
if (!pdf_print_settings_.get())
|
if (!pdf_print_state_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pdf_print_callback_.is_null()) {
|
if (!pdf_print_state_->callback_.is_null()) {
|
||||||
// Execute the callback.
|
// Execute the callback.
|
||||||
BrowserThread::PostTask(BrowserThread::UI,
|
BrowserThread::PostTask(BrowserThread::UI,
|
||||||
FROM_HERE,
|
FROM_HERE,
|
||||||
base::Bind(pdf_print_callback_, false));
|
base::Bind(pdf_print_state_->callback_, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset state information.
|
// Reset state information.
|
||||||
pdf_output_path_.clear();
|
pdf_print_state_.reset();
|
||||||
pdf_print_callback_.Reset();
|
|
||||||
pdf_print_settings_.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace printing
|
} // namespace printing
|
||||||
|
@ -10,13 +10,14 @@
|
|||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "content/public/browser/web_contents_user_data.h"
|
#include "content/public/browser/web_contents_user_data.h"
|
||||||
|
|
||||||
struct PrintHostMsg_DidPreviewDocument_Params;
|
|
||||||
struct PrintHostMsg_RequestPrintPreview_Params;
|
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
class RenderFrameHost;
|
||||||
class RenderProcessHost;
|
class RenderProcessHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct PrintHostMsg_DidPreviewDocument_Params;
|
||||||
|
struct PrintHostMsg_RequestPrintPreview_Params;
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
// Manages the print commands for a WebContents.
|
// Manages the print commands for a WebContents.
|
||||||
@ -26,35 +27,28 @@ class CefPrintViewManager :
|
|||||||
public:
|
public:
|
||||||
~CefPrintViewManager() override;
|
~CefPrintViewManager() override;
|
||||||
|
|
||||||
#if defined(ENABLE_BASIC_PRINTING)
|
|
||||||
// Same as PrintNow(), but for the case where a user prints with the system
|
|
||||||
// dialog from print preview.
|
|
||||||
bool PrintForSystemDialogNow();
|
|
||||||
#endif // ENABLE_BASIC_PRINTING
|
|
||||||
|
|
||||||
// content::WebContentsObserver implementation.
|
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
|
||||||
|
|
||||||
// content::WebContentsObserver implementation.
|
|
||||||
// Cancels the print job.
|
|
||||||
void NavigationStopped() override;
|
|
||||||
// Terminates or cancels the print job if one was pending.
|
|
||||||
void RenderProcessGone(base::TerminationStatus status) override;
|
|
||||||
|
|
||||||
// Callback executed on PDF printing completion.
|
// Callback executed on PDF printing completion.
|
||||||
typedef base::Callback<void(bool /*ok*/)> PdfPrintCallback;
|
typedef base::Callback<void(bool /*ok*/)> PdfPrintCallback;
|
||||||
|
|
||||||
// Print the current document to a PDF file. Execute |callback| on completion.
|
// Print the current document to a PDF file. Execute |callback| on completion.
|
||||||
void PrintToPDF(const base::FilePath& path,
|
bool PrintToPDF(content::RenderFrameHost* rfh,
|
||||||
|
const base::FilePath& path,
|
||||||
const CefPdfPrintSettings& settings,
|
const CefPdfPrintSettings& settings,
|
||||||
const PdfPrintCallback& callback);
|
const PdfPrintCallback& callback);
|
||||||
|
|
||||||
|
// content::WebContentsObserver implementation.
|
||||||
|
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||||
|
void NavigationStopped() override;
|
||||||
|
void RenderProcessGone(base::TerminationStatus status) override;
|
||||||
|
bool OnMessageReceived(const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* render_frame_host) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit CefPrintViewManager(content::WebContents* web_contents);
|
explicit CefPrintViewManager(content::WebContents* web_contents);
|
||||||
friend class content::WebContentsUserData<CefPrintViewManager>;
|
friend class content::WebContentsUserData<CefPrintViewManager>;
|
||||||
|
|
||||||
// IPC Message handlers.
|
// IPC Message handlers.
|
||||||
void OnDidShowPrintDialog();
|
void OnDidShowPrintDialog(content::RenderFrameHost* rfh);
|
||||||
void OnRequestPrintPreview(const PrintHostMsg_RequestPrintPreview_Params&);
|
void OnRequestPrintPreview(const PrintHostMsg_RequestPrintPreview_Params&);
|
||||||
void OnMetafileReadyForPrinting(
|
void OnMetafileReadyForPrinting(
|
||||||
const PrintHostMsg_DidPreviewDocument_Params&);
|
const PrintHostMsg_DidPreviewDocument_Params&);
|
||||||
@ -63,9 +57,8 @@ class CefPrintViewManager :
|
|||||||
|
|
||||||
// Used for printing to PDF. Only accessed on the browser process UI thread.
|
// Used for printing to PDF. Only accessed on the browser process UI thread.
|
||||||
int next_pdf_request_id_ = -1;
|
int next_pdf_request_id_ = -1;
|
||||||
base::FilePath pdf_output_path_;
|
struct PdfPrintState;
|
||||||
std::unique_ptr<base::DictionaryValue> pdf_print_settings_;
|
std::unique_ptr<PdfPrintState> pdf_print_state_;
|
||||||
PdfPrintCallback pdf_print_callback_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefPrintViewManager);
|
DISALLOW_COPY_AND_ASSIGN(CefPrintViewManager);
|
||||||
};
|
};
|
||||||
|
@ -4,23 +4,25 @@
|
|||||||
|
|
||||||
#include "libcef/browser/printing/print_view_manager_base.h"
|
#include "libcef/browser/printing/print_view_manager_base.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "libcef/browser/content_browser_client.h"
|
|
||||||
|
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/single_thread_task_runner.h"
|
#include "base/single_thread_task_runner.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "base/timer/timer.h"
|
#include "base/timer/timer.h"
|
||||||
|
#include "build/build_config.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/chrome_notification_types.h"
|
#include "chrome/browser/chrome_notification_types.h"
|
||||||
#include "chrome/browser/printing/print_job.h"
|
#include "chrome/browser/printing/print_job.h"
|
||||||
#include "chrome/browser/printing/print_job_manager.h"
|
#include "chrome/browser/printing/print_job_manager.h"
|
||||||
#include "chrome/browser/printing/printer_query.h"
|
#include "chrome/browser/printing/printer_query.h"
|
||||||
|
#include "chrome/browser/profiles/profile.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "chrome/grit/generated_resources.h"
|
#include "chrome/grit/generated_resources.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
@ -29,8 +31,10 @@
|
|||||||
#include "content/public/browser/notification_details.h"
|
#include "content/public/browser/notification_details.h"
|
||||||
#include "content/public/browser/notification_service.h"
|
#include "content/public/browser/notification_service.h"
|
||||||
#include "content/public/browser/notification_source.h"
|
#include "content/public/browser/notification_source.h"
|
||||||
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
|
#include "printing/features/features.h"
|
||||||
#include "printing/pdf_metafile_skia.h"
|
#include "printing/pdf_metafile_skia.h"
|
||||||
#include "printing/printed_document.h"
|
#include "printing/printed_document.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
@ -48,6 +52,7 @@ namespace printing {
|
|||||||
CefPrintViewManagerBase::CefPrintViewManagerBase(
|
CefPrintViewManagerBase::CefPrintViewManagerBase(
|
||||||
content::WebContents* web_contents)
|
content::WebContents* web_contents)
|
||||||
: PrintManager(web_contents),
|
: PrintManager(web_contents),
|
||||||
|
printing_rfh_(nullptr),
|
||||||
printing_succeeded_(false),
|
printing_succeeded_(false),
|
||||||
inside_inner_message_loop_(false),
|
inside_inner_message_loop_(false),
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
@ -55,13 +60,11 @@ CefPrintViewManagerBase::CefPrintViewManagerBase(
|
|||||||
#endif
|
#endif
|
||||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||||
DCHECK(queue_.get());
|
DCHECK(queue_.get());
|
||||||
PrefService* pref_service =
|
Profile* profile =
|
||||||
static_cast<CefBrowserContext*>(web_contents->GetBrowserContext())->
|
Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
||||||
GetPrefs();
|
|
||||||
printing_enabled_.Init(
|
printing_enabled_.Init(
|
||||||
prefs::kPrintingEnabled,
|
prefs::kPrintingEnabled, profile->GetPrefs(),
|
||||||
pref_service,
|
base::Bind(&CefPrintViewManagerBase::UpdatePrintingEnabled,
|
||||||
base::Bind(&CefPrintViewManagerBase::UpdateScriptedPrintingBlocked,
|
|
||||||
base::Unretained(this)));
|
base::Unretained(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,16 +73,20 @@ CefPrintViewManagerBase::~CefPrintViewManagerBase() {
|
|||||||
DisconnectFromCurrentPrintJob();
|
DisconnectFromCurrentPrintJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ENABLE_BASIC_PRINTING)
|
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
|
||||||
bool CefPrintViewManagerBase::PrintNow() {
|
bool CefPrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
||||||
return PrintNowInternal(new PrintMsg_PrintPages(routing_id()));
|
DisconnectFromCurrentPrintJob();
|
||||||
|
|
||||||
|
SetPrintingRFH(rfh);
|
||||||
|
int32_t id = rfh->GetRoutingID();
|
||||||
|
return PrintNowInternal(rfh, base::MakeUnique<PrintMsg_PrintPages>(id));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void CefPrintViewManagerBase::UpdateScriptedPrintingBlocked() {
|
void CefPrintViewManagerBase::UpdatePrintingEnabled() {
|
||||||
Send(new PrintMsg_SetScriptedPrintingBlocked(
|
web_contents()->ForEachFrame(
|
||||||
routing_id(),
|
base::Bind(&CefPrintViewManagerBase::SendPrintingEnabled,
|
||||||
!printing_enabled_.GetValue()));
|
base::Unretained(this), printing_enabled_.GetValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManagerBase::NavigationStopped() {
|
void CefPrintViewManagerBase::NavigationStopped() {
|
||||||
@ -87,23 +94,6 @@ void CefPrintViewManagerBase::NavigationStopped() {
|
|||||||
TerminatePrintJob(true);
|
TerminatePrintJob(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManagerBase::RenderProcessGone(
|
|
||||||
base::TerminationStatus status) {
|
|
||||||
PrintManager::RenderProcessGone(status);
|
|
||||||
ReleasePrinterQuery();
|
|
||||||
|
|
||||||
if (!print_job_.get())
|
|
||||||
return;
|
|
||||||
|
|
||||||
scoped_refptr<PrintedDocument> document(print_job_->document());
|
|
||||||
if (document.get()) {
|
|
||||||
// If IsComplete() returns false, the document isn't completely rendered.
|
|
||||||
// Since our renderer is gone, there's nothing to do, cancel it. Otherwise,
|
|
||||||
// the print job may finish without problem.
|
|
||||||
TerminatePrintJob(!document->IsComplete());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
base::string16 CefPrintViewManagerBase::RenderSourceName() {
|
base::string16 CefPrintViewManagerBase::RenderSourceName() {
|
||||||
base::string16 name(web_contents()->GetTitle());
|
base::string16 name(web_contents()->GetTitle());
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
@ -173,24 +163,24 @@ void CefPrintViewManagerBase::OnDidPrintPage(
|
|||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
print_job_->AppendPrintedPage(params.page_number);
|
print_job_->AppendPrintedPage(params.page_number);
|
||||||
if (metafile_must_be_valid) {
|
if (metafile_must_be_valid) {
|
||||||
|
// TODO(thestig): Figure out why rendering text with GDI results in random
|
||||||
|
// missing characters for some users. https://crbug.com/658606
|
||||||
bool print_text_with_gdi =
|
bool print_text_with_gdi =
|
||||||
document->settings().print_text_with_gdi() &&
|
document->settings().print_text_with_gdi() &&
|
||||||
!document->settings().printer_is_xps() &&
|
!document->settings().printer_is_xps() &&
|
||||||
!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
switches::GDITextPrintingEnabled();
|
||||||
switches::kDisableGDITextPrinting);
|
|
||||||
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
|
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
|
||||||
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
|
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
|
||||||
params.data_size);
|
params.data_size);
|
||||||
|
|
||||||
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
|
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
|
||||||
print_job_->StartPdfToEmfConversion(
|
print_job_->StartPdfToEmfConversion(
|
||||||
bytes, params.page_size, params.content_area, print_text_with_gdi);
|
bytes, params.page_size, params.content_area,
|
||||||
|
print_text_with_gdi);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Update the rendered document. It will send notifications to the listener.
|
// Update the rendered document. It will send notifications to the listener.
|
||||||
document->SetPage(params.page_number,
|
document->SetPage(params.page_number, std::move(metafile), params.page_size,
|
||||||
std::move(metafile),
|
|
||||||
params.page_size,
|
|
||||||
params.content_area);
|
params.content_area);
|
||||||
|
|
||||||
ShouldQuitFromInnerMessageLoop();
|
ShouldQuitFromInnerMessageLoop();
|
||||||
@ -212,18 +202,43 @@ void CefPrintViewManagerBase::OnShowInvalidPrinterSettingsError() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManagerBase::DidStartLoading() {
|
void CefPrintViewManagerBase::DidStartLoading() {
|
||||||
UpdateScriptedPrintingBlocked();
|
UpdatePrintingEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefPrintViewManagerBase::OnMessageReceived(const IPC::Message& message) {
|
void CefPrintViewManagerBase::RenderFrameDeleted(
|
||||||
|
content::RenderFrameHost* render_frame_host) {
|
||||||
|
// Terminates or cancels the print job if one was pending.
|
||||||
|
if (render_frame_host != printing_rfh_)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printing_rfh_ = nullptr;
|
||||||
|
|
||||||
|
PrintManager::PrintingRenderFrameDeleted();
|
||||||
|
ReleasePrinterQuery();
|
||||||
|
|
||||||
|
if (!print_job_.get())
|
||||||
|
return;
|
||||||
|
|
||||||
|
scoped_refptr<PrintedDocument> document(print_job_->document());
|
||||||
|
if (document.get()) {
|
||||||
|
// If IsComplete() returns false, the document isn't completely rendered.
|
||||||
|
// Since our renderer is gone, there's nothing to do, cancel it. Otherwise,
|
||||||
|
// the print job may finish without problem.
|
||||||
|
TerminatePrintJob(!document->IsComplete());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefPrintViewManagerBase::OnMessageReceived(
|
||||||
|
const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* render_frame_host) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(CefPrintViewManagerBase, message)
|
IPC_BEGIN_MESSAGE_MAP(CefPrintViewManagerBase, message)
|
||||||
IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage)
|
IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage)
|
||||||
IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError,
|
IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError,
|
||||||
OnShowInvalidPrinterSettingsError);
|
OnShowInvalidPrinterSettingsError)
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||||
IPC_END_MESSAGE_MAP()
|
IPC_END_MESSAGE_MAP()
|
||||||
return handled || PrintManager::OnMessageReceived(message);
|
return handled || PrintManager::OnMessageReceived(message, render_frame_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManagerBase::Observe(
|
void CefPrintViewManagerBase::Observe(
|
||||||
@ -335,7 +350,7 @@ void CefPrintViewManagerBase::ShouldQuitFromInnerMessageLoop() {
|
|||||||
bool CefPrintViewManagerBase::CreateNewPrintJob(PrintJobWorkerOwner* job) {
|
bool CefPrintViewManagerBase::CreateNewPrintJob(PrintJobWorkerOwner* job) {
|
||||||
DCHECK(!inside_inner_message_loop_);
|
DCHECK(!inside_inner_message_loop_);
|
||||||
|
|
||||||
// Disconnect the current print_job_.
|
// Disconnect the current |print_job_|.
|
||||||
DisconnectFromCurrentPrintJob();
|
DisconnectFromCurrentPrintJob();
|
||||||
|
|
||||||
// We can't print if there is no renderer.
|
// We can't print if there is no renderer.
|
||||||
@ -380,12 +395,6 @@ void CefPrintViewManagerBase::DisconnectFromCurrentPrintJob() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManagerBase::PrintingDone(bool success) {
|
|
||||||
if (!print_job_.get())
|
|
||||||
return;
|
|
||||||
Send(new PrintMsg_PrintingDone(routing_id(), success));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefPrintViewManagerBase::TerminatePrintJob(bool cancel) {
|
void CefPrintViewManagerBase::TerminatePrintJob(bool cancel) {
|
||||||
if (!print_job_.get())
|
if (!print_job_.get())
|
||||||
return;
|
return;
|
||||||
@ -407,16 +416,23 @@ void CefPrintViewManagerBase::TerminatePrintJob(bool cancel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManagerBase::ReleasePrintJob() {
|
void CefPrintViewManagerBase::ReleasePrintJob() {
|
||||||
|
content::RenderFrameHost* rfh = printing_rfh_;
|
||||||
|
printing_rfh_ = nullptr;
|
||||||
|
|
||||||
if (!print_job_.get())
|
if (!print_job_.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PrintingDone(printing_succeeded_);
|
if (rfh) {
|
||||||
|
auto msg = base::MakeUnique<PrintMsg_PrintingDone>(rfh->GetRoutingID(),
|
||||||
|
printing_succeeded_);
|
||||||
|
rfh->Send(msg.release());
|
||||||
|
}
|
||||||
|
|
||||||
registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
|
||||||
content::Source<PrintJob>(print_job_.get()));
|
content::Source<PrintJob>(print_job_.get()));
|
||||||
print_job_->DisconnectSource();
|
print_job_->DisconnectSource();
|
||||||
// Don't close the worker thread.
|
// Don't close the worker thread.
|
||||||
print_job_ = NULL;
|
print_job_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefPrintViewManagerBase::RunInnerMessageLoop() {
|
bool CefPrintViewManagerBase::RunInnerMessageLoop() {
|
||||||
@ -485,14 +501,18 @@ bool CefPrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefPrintViewManagerBase::PrintNowInternal(IPC::Message* message) {
|
bool CefPrintViewManagerBase::PrintNowInternal(
|
||||||
|
content::RenderFrameHost* rfh,
|
||||||
|
std::unique_ptr<IPC::Message> message) {
|
||||||
// Don't print / print preview interstitials or crashed tabs.
|
// Don't print / print preview interstitials or crashed tabs.
|
||||||
if (web_contents()->ShowingInterstitialPage() ||
|
if (web_contents()->ShowingInterstitialPage() || web_contents()->IsCrashed())
|
||||||
web_contents()->IsCrashed()) {
|
|
||||||
delete message;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
return rfh->Send(message.release());
|
||||||
return Send(message);
|
}
|
||||||
|
|
||||||
|
void CefPrintViewManagerBase::SetPrintingRFH(content::RenderFrameHost* rfh) {
|
||||||
|
DCHECK(!printing_rfh_);
|
||||||
|
printing_rfh_ = rfh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintViewManagerBase::ReleasePrinterQuery() {
|
void CefPrintViewManagerBase::ReleasePrinterQuery() {
|
||||||
@ -502,13 +522,12 @@ void CefPrintViewManagerBase::ReleasePrinterQuery() {
|
|||||||
int cookie = cookie_;
|
int cookie = cookie_;
|
||||||
cookie_ = 0;
|
cookie_ = 0;
|
||||||
|
|
||||||
printing::PrintJobManager* print_job_manager =
|
PrintJobManager* print_job_manager = g_browser_process->print_job_manager();
|
||||||
g_browser_process->print_job_manager();
|
|
||||||
// May be NULL in tests.
|
// May be NULL in tests.
|
||||||
if (!print_job_manager)
|
if (!print_job_manager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scoped_refptr<printing::PrinterQuery> printer_query;
|
scoped_refptr<PrinterQuery> printer_query;
|
||||||
printer_query = queue_->PopPrinterQuery(cookie);
|
printer_query = queue_->PopPrinterQuery(cookie);
|
||||||
if (!printer_query.get())
|
if (!printer_query.get())
|
||||||
return;
|
return;
|
||||||
@ -517,4 +536,10 @@ void CefPrintViewManagerBase::ReleasePrinterQuery() {
|
|||||||
base::Bind(&PrinterQuery::StopWorker, printer_query));
|
base::Bind(&PrinterQuery::StopWorker, printer_query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefPrintViewManagerBase::SendPrintingEnabled(
|
||||||
|
bool enabled,
|
||||||
|
content::RenderFrameHost* rfh) {
|
||||||
|
rfh->Send(new PrintMsg_SetPrintingEnabled(rfh->GetRoutingID(), enabled));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace printing
|
} // namespace printing
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#ifndef CEF_LIBCEF_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
#ifndef CEF_LIBCEF_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
||||||
#define CEF_LIBCEF_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
#define CEF_LIBCEF_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
@ -13,12 +15,13 @@
|
|||||||
#include "components/printing/browser/print_manager.h"
|
#include "components/printing/browser/print_manager.h"
|
||||||
#include "content/public/browser/notification_observer.h"
|
#include "content/public/browser/notification_observer.h"
|
||||||
#include "content/public/browser/notification_registrar.h"
|
#include "content/public/browser/notification_registrar.h"
|
||||||
|
#include "printing/features/features.h"
|
||||||
#include "printing/printed_pages_source.h"
|
#include "printing/printed_pages_source.h"
|
||||||
|
|
||||||
struct PrintHostMsg_DidPrintPage_Params;
|
struct PrintHostMsg_DidPrintPage_Params;
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
class RenderViewHost;
|
class RenderFrameHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
@ -36,15 +39,15 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
|||||||
public:
|
public:
|
||||||
~CefPrintViewManagerBase() override;
|
~CefPrintViewManagerBase() override;
|
||||||
|
|
||||||
#if defined(ENABLE_BASIC_PRINTING)
|
#if BUILDFLAG(ENABLE_BASIC_PRINTING)
|
||||||
// Prints the current document immediately. Since the rendering is
|
// Prints the current document immediately. Since the rendering is
|
||||||
// asynchronous, the actual printing will not be completed on the return of
|
// asynchronous, the actual printing will not be completed on the return of
|
||||||
// this function. Returns false if printing is impossible at the moment.
|
// this function. Returns false if printing is impossible at the moment.
|
||||||
virtual bool PrintNow();
|
virtual bool PrintNow(content::RenderFrameHost* rfh);
|
||||||
#endif // ENABLE_BASIC_PRINTING
|
#endif // ENABLE_BASIC_PRINTING
|
||||||
|
|
||||||
// Whether to block scripted printing for our tab or not.
|
// Whether printing is enabled or not.
|
||||||
void UpdateScriptedPrintingBlocked();
|
void UpdatePrintingEnabled();
|
||||||
|
|
||||||
// PrintedPagesSource implementation.
|
// PrintedPagesSource implementation.
|
||||||
base::string16 RenderSourceName() override;
|
base::string16 RenderSourceName() override;
|
||||||
@ -53,17 +56,19 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
|||||||
explicit CefPrintViewManagerBase(content::WebContents* web_contents);
|
explicit CefPrintViewManagerBase(content::WebContents* web_contents);
|
||||||
|
|
||||||
// Helper method for Print*Now().
|
// Helper method for Print*Now().
|
||||||
bool PrintNowInternal(IPC::Message* message);
|
bool PrintNowInternal(content::RenderFrameHost* rfh,
|
||||||
|
std::unique_ptr<IPC::Message> message);
|
||||||
|
|
||||||
|
void SetPrintingRFH(content::RenderFrameHost* rfh);
|
||||||
|
|
||||||
|
// content::WebContentsObserver implementation.
|
||||||
|
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
||||||
|
bool OnMessageReceived(const IPC::Message& message,
|
||||||
|
content::RenderFrameHost* render_frame_host) override;
|
||||||
|
|
||||||
// Cancels the print job.
|
// Cancels the print job.
|
||||||
void NavigationStopped() override;
|
void NavigationStopped() override;
|
||||||
|
|
||||||
// Terminates or cancels the print job if one was pending.
|
|
||||||
void RenderProcessGone(base::TerminationStatus status) override;
|
|
||||||
|
|
||||||
// content::WebContentsObserver implementation.
|
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// content::NotificationObserver implementation.
|
// content::NotificationObserver implementation.
|
||||||
void Observe(int type,
|
void Observe(int type,
|
||||||
@ -104,9 +109,6 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
|||||||
// disconnect from it.
|
// disconnect from it.
|
||||||
void DisconnectFromCurrentPrintJob();
|
void DisconnectFromCurrentPrintJob();
|
||||||
|
|
||||||
// Notify that the printing is done.
|
|
||||||
void PrintingDone(bool success);
|
|
||||||
|
|
||||||
// Terminates the print job. No-op if no print job has been created. If
|
// Terminates the print job. No-op if no print job has been created. If
|
||||||
// |cancel| is true, cancel it instead of waiting for the job to finish. Will
|
// |cancel| is true, cancel it instead of waiting for the job to finish. Will
|
||||||
// call ReleasePrintJob().
|
// call ReleasePrintJob().
|
||||||
@ -130,8 +132,14 @@ class CefPrintViewManagerBase : public content::NotificationObserver,
|
|||||||
// Release the PrinterQuery associated with our |cookie_|.
|
// Release the PrinterQuery associated with our |cookie_|.
|
||||||
void ReleasePrinterQuery();
|
void ReleasePrinterQuery();
|
||||||
|
|
||||||
|
// Helper method for UpdatePrintingEnabled().
|
||||||
|
void SendPrintingEnabled(bool enabled, content::RenderFrameHost* rfh);
|
||||||
|
|
||||||
content::NotificationRegistrar registrar_;
|
content::NotificationRegistrar registrar_;
|
||||||
|
|
||||||
|
// The current RFH that is printing with a system printing dialog.
|
||||||
|
content::RenderFrameHost* printing_rfh_;
|
||||||
|
|
||||||
// Manages the low-level talk to the printer.
|
// Manages the low-level talk to the printer.
|
||||||
scoped_refptr<PrintJob> print_job_;
|
scoped_refptr<PrintJob> print_job_;
|
||||||
|
|
||||||
|
@ -4,19 +4,25 @@
|
|||||||
|
|
||||||
#include "libcef/browser/printing/printing_message_filter.h"
|
#include "libcef/browser/printing/printing_message_filter.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
|
#include "build/build_config.h"
|
||||||
#include "chrome/browser/browser_process.h"
|
#include "chrome/browser/browser_process.h"
|
||||||
#include "chrome/browser/printing/print_job_manager.h"
|
#include "chrome/browser/printing/print_job_manager.h"
|
||||||
#include "chrome/browser/printing/printer_query.h"
|
#include "chrome/browser/printing/printer_query.h"
|
||||||
|
#include "chrome/browser/profiles/profile.h"
|
||||||
|
#include "chrome/common/pref_names.h"
|
||||||
|
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
|
||||||
#include "components/printing/browser/print_manager_utils.h"
|
#include "components/printing/browser/print_manager_utils.h"
|
||||||
#include "components/printing/common/print_messages.h"
|
#include "components/printing/common/print_messages.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/child_process_host.h"
|
#include "content/public/common/child_process_host.h"
|
||||||
|
#include "printing/features/features.h"
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||||
@ -26,24 +32,90 @@ using content::BrowserThread;
|
|||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
CefPrintingMessageFilter::CefPrintingMessageFilter(int render_process_id)
|
namespace {
|
||||||
|
|
||||||
|
// There's a race condition between deletion of the CefPrintingMessageFilter
|
||||||
|
// object on the UI thread and deletion of the PrefService (owned by Profile)
|
||||||
|
// on the UI thread. If the PrefService will be deleted first then
|
||||||
|
// PrefMember::Destroy() must be called from ShutdownOnUIThread() to avoid
|
||||||
|
// heap-use-after-free on CefPrintingMessageFilter destruction (due to
|
||||||
|
// ~PrefMember trying to access the already-deleted PrefService).
|
||||||
|
// ShutdownNotifierFactory makes sure that ShutdownOnUIThread() is called in
|
||||||
|
// this case.
|
||||||
|
class ShutdownNotifierFactory
|
||||||
|
: public BrowserContextKeyedServiceShutdownNotifierFactory {
|
||||||
|
public:
|
||||||
|
static ShutdownNotifierFactory* GetInstance();
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend struct base::DefaultLazyInstanceTraits<ShutdownNotifierFactory>;
|
||||||
|
|
||||||
|
ShutdownNotifierFactory()
|
||||||
|
: BrowserContextKeyedServiceShutdownNotifierFactory(
|
||||||
|
"CefPrintingMessageFilter") {
|
||||||
|
}
|
||||||
|
~ShutdownNotifierFactory() override {}
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory);
|
||||||
|
};
|
||||||
|
|
||||||
|
base::LazyInstance<ShutdownNotifierFactory>::Leaky
|
||||||
|
g_shutdown_notifier_factory = LAZY_INSTANCE_INITIALIZER;
|
||||||
|
|
||||||
|
// static
|
||||||
|
ShutdownNotifierFactory* ShutdownNotifierFactory::GetInstance() {
|
||||||
|
return g_shutdown_notifier_factory.Pointer();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
CefPrintingMessageFilter::CefPrintingMessageFilter(int render_process_id,
|
||||||
|
Profile* profile)
|
||||||
: content::BrowserMessageFilter(PrintMsgStart),
|
: content::BrowserMessageFilter(PrintMsgStart),
|
||||||
render_process_id_(render_process_id),
|
render_process_id_(render_process_id),
|
||||||
queue_(g_browser_process->print_job_manager()->queue()) {
|
queue_(g_browser_process->print_job_manager()->queue()) {
|
||||||
DCHECK(queue_.get());
|
DCHECK(queue_.get());
|
||||||
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
|
shutdown_notifier_ =
|
||||||
|
ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe(
|
||||||
|
base::Bind(&CefPrintingMessageFilter::ShutdownOnUIThread,
|
||||||
|
base::Unretained(this)));
|
||||||
|
|
||||||
|
is_printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs());
|
||||||
|
is_printing_enabled_.MoveToThread(
|
||||||
|
content::BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt() {
|
||||||
|
ShutdownNotifierFactory::GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
CefPrintingMessageFilter::~CefPrintingMessageFilter() {
|
CefPrintingMessageFilter::~CefPrintingMessageFilter() {
|
||||||
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefPrintingMessageFilter::ShutdownOnUIThread() {
|
||||||
|
is_printing_enabled_.Destroy();
|
||||||
|
shutdown_notifier_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintingMessageFilter::OverrideThreadForMessage(
|
void CefPrintingMessageFilter::OverrideThreadForMessage(
|
||||||
const IPC::Message& message, BrowserThread::ID* thread) {
|
const IPC::Message& message, BrowserThread::ID* thread) {
|
||||||
|
#if defined(OS_ANDROID)
|
||||||
|
if (message.type() == PrintHostMsg_AllocateTempFileForPrinting::ID ||
|
||||||
|
message.type() == PrintHostMsg_TempFileForPrintingWritten::ID) {
|
||||||
|
*thread = BrowserThread::UI;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefPrintingMessageFilter::OnDestruct() const {
|
||||||
|
BrowserThread::DeleteOnUIThread::Destruct(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefPrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
bool CefPrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
IPC_BEGIN_MESSAGE_MAP(CefPrintingMessageFilter, message)
|
IPC_BEGIN_MESSAGE_MAP(CefPrintingMessageFilter, message)
|
||||||
IPC_MESSAGE_HANDLER(PrintHostMsg_IsPrintingEnabled, OnIsPrintingEnabled)
|
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings,
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings,
|
||||||
OnGetDefaultPrintSettings)
|
OnGetDefaultPrintSettings)
|
||||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
|
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
|
||||||
@ -55,11 +127,6 @@ bool CefPrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPrintingMessageFilter::OnIsPrintingEnabled(bool* is_enabled) {
|
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
||||||
*is_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefPrintingMessageFilter::OnGetDefaultPrintSettings(
|
void CefPrintingMessageFilter::OnGetDefaultPrintSettings(
|
||||||
IPC::Message* reply_msg) {
|
IPC::Message* reply_msg) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||||
@ -70,6 +137,11 @@ void CefPrintingMessageFilter::OnGetDefaultPrintSettings(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
scoped_refptr<PrinterQuery> printer_query;
|
scoped_refptr<PrinterQuery> printer_query;
|
||||||
|
if (!is_printing_enabled_.GetValue()) {
|
||||||
|
// Reply with NULL query.
|
||||||
|
OnGetDefaultPrintSettingsReply(printer_query, reply_msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
printer_query = queue_->PopPrinterQuery(0);
|
printer_query = queue_->PopPrinterQuery(0);
|
||||||
if (!printer_query.get()) {
|
if (!printer_query.get()) {
|
||||||
printer_query =
|
printer_query =
|
||||||
@ -168,6 +240,11 @@ void CefPrintingMessageFilter::OnUpdatePrintSettings(
|
|||||||
std::unique_ptr<base::DictionaryValue> new_settings(job_settings.DeepCopy());
|
std::unique_ptr<base::DictionaryValue> new_settings(job_settings.DeepCopy());
|
||||||
|
|
||||||
scoped_refptr<PrinterQuery> printer_query;
|
scoped_refptr<PrinterQuery> printer_query;
|
||||||
|
if (!is_printing_enabled_.GetValue()) {
|
||||||
|
// Reply with NULL query.
|
||||||
|
OnUpdatePrintSettingsReply(printer_query, reply_msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
printer_query = queue_->PopPrinterQuery(document_cookie);
|
printer_query = queue_->PopPrinterQuery(document_cookie);
|
||||||
if (!printer_query.get()) {
|
if (!printer_query.get()) {
|
||||||
int host_id = render_process_id_;
|
int host_id = render_process_id_;
|
||||||
|
@ -7,31 +7,25 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
|
||||||
|
#include "components/prefs/pref_member.h"
|
||||||
#include "content/public/browser/browser_message_filter.h"
|
#include "content/public/browser/browser_message_filter.h"
|
||||||
|
#include "printing/features/features.h"
|
||||||
#if defined(OS_WIN)
|
|
||||||
#include "base/memory/shared_memory.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct PrintHostMsg_ScriptedPrint_Params;
|
struct PrintHostMsg_ScriptedPrint_Params;
|
||||||
|
class Profile;
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class DictionaryValue;
|
class DictionaryValue;
|
||||||
class FilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace content {
|
|
||||||
class WebContents;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace printing {
|
namespace printing {
|
||||||
|
|
||||||
class PrintJobManager;
|
|
||||||
class PrintQueriesQueue;
|
class PrintQueriesQueue;
|
||||||
class PrinterQuery;
|
class PrinterQuery;
|
||||||
|
|
||||||
@ -39,24 +33,23 @@ class PrinterQuery;
|
|||||||
// renderer process on the IPC thread.
|
// renderer process on the IPC thread.
|
||||||
class CefPrintingMessageFilter : public content::BrowserMessageFilter {
|
class CefPrintingMessageFilter : public content::BrowserMessageFilter {
|
||||||
public:
|
public:
|
||||||
explicit CefPrintingMessageFilter(int render_process_id);
|
CefPrintingMessageFilter(int render_process_id, Profile* profile);
|
||||||
|
|
||||||
|
static void EnsureShutdownNotifierFactoryBuilt();
|
||||||
|
|
||||||
// content::BrowserMessageFilter methods.
|
// content::BrowserMessageFilter methods.
|
||||||
void OverrideThreadForMessage(const IPC::Message& message,
|
void OverrideThreadForMessage(const IPC::Message& message,
|
||||||
content::BrowserThread::ID* thread) override;
|
content::BrowserThread::ID* thread) override;
|
||||||
|
void OnDestruct() const override;
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
bool OnMessageReceived(const IPC::Message& message) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend class base::DeleteHelper<CefPrintingMessageFilter>;
|
||||||
|
friend class content::BrowserThread;
|
||||||
|
|
||||||
~CefPrintingMessageFilter() override;
|
~CefPrintingMessageFilter() override;
|
||||||
|
|
||||||
// GetPrintSettingsForRenderView must be called via PostTask and
|
void ShutdownOnUIThread();
|
||||||
// base::Bind. Collapse the settings-specific params into a
|
|
||||||
// struct to avoid running into issues with too many params
|
|
||||||
// to base::Bind.
|
|
||||||
struct GetPrintSettingsForRenderViewParams;
|
|
||||||
|
|
||||||
// Checks if printing is enabled.
|
|
||||||
void OnIsPrintingEnabled(bool* is_enabled);
|
|
||||||
|
|
||||||
// Get the default print setting.
|
// Get the default print setting.
|
||||||
void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
|
void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
|
||||||
@ -80,14 +73,20 @@ class CefPrintingMessageFilter : public content::BrowserMessageFilter {
|
|||||||
void OnUpdatePrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
|
void OnUpdatePrintSettingsReply(scoped_refptr<PrinterQuery> printer_query,
|
||||||
IPC::Message* reply_msg);
|
IPC::Message* reply_msg);
|
||||||
|
|
||||||
|
// Check to see if print preview has been cancelled.
|
||||||
void OnCheckForCancel(int32_t preview_ui_id,
|
void OnCheckForCancel(int32_t preview_ui_id,
|
||||||
int preview_request_id,
|
int preview_request_id,
|
||||||
bool* cancel);
|
bool* cancel);
|
||||||
|
|
||||||
|
BooleanPrefMember is_printing_enabled_;
|
||||||
|
|
||||||
const int render_process_id_;
|
const int render_process_id_;
|
||||||
|
|
||||||
scoped_refptr<PrintQueriesQueue> queue_;
|
scoped_refptr<PrintQueriesQueue> queue_;
|
||||||
|
|
||||||
|
std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
|
||||||
|
shutdown_notifier_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefPrintingMessageFilter);
|
DISALLOW_COPY_AND_ASSIGN(CefPrintingMessageFilter);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,29 +81,12 @@ CefResourceDispatcherHostDelegate::~CefResourceDispatcherHostDelegate() {
|
|||||||
|
|
||||||
bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(
|
bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
int child_id,
|
content::ResourceRequestInfo* info) {
|
||||||
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
bool is_main_frame,
|
base::Bind(base::IgnoreResult(&CefResourceDispatcherHostDelegate::
|
||||||
ui::PageTransition page_transition,
|
HandleExternalProtocolOnUIThread),
|
||||||
bool has_user_gesture,
|
base::Unretained(this), url,
|
||||||
content::ResourceContext* resource_context) {
|
info->GetWebContentsGetterForRequest()));
|
||||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
|
||||||
CEF_POST_TASK(CEF_UIT,
|
|
||||||
base::Bind(base::IgnoreResult(&CefResourceDispatcherHostDelegate::
|
|
||||||
HandleExternalProtocol),
|
|
||||||
base::Unretained(this), url, child_id, web_contents_getter,
|
|
||||||
is_main_frame, page_transition, has_user_gesture,
|
|
||||||
resource_context));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
content::WebContents* web_contents = web_contents_getter.Run();
|
|
||||||
if (web_contents) {
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser =
|
|
||||||
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
|
||||||
if (browser.get())
|
|
||||||
browser->HandleExternalProtocol(url);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,3 +201,17 @@ std::unique_ptr<net::ClientCertStore>
|
|||||||
return static_cast<CefResourceContext*>(resource_context)->
|
return static_cast<CefResourceContext*>(resource_context)->
|
||||||
CreateClientCertStore();
|
CreateClientCertStore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefResourceDispatcherHostDelegate::HandleExternalProtocolOnUIThread(
|
||||||
|
const GURL& url,
|
||||||
|
const content::ResourceRequestInfo::WebContentsGetter&
|
||||||
|
web_contents_getter) {
|
||||||
|
CEF_REQUIRE_UIT();
|
||||||
|
content::WebContents* web_contents = web_contents_getter.Run();
|
||||||
|
if (web_contents) {
|
||||||
|
CefRefPtr<CefBrowserHostImpl> browser =
|
||||||
|
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||||
|
if (browser.get())
|
||||||
|
browser->HandleExternalProtocol(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,13 +23,7 @@ class CefResourceDispatcherHostDelegate
|
|||||||
// ResourceDispatcherHostDelegate methods.
|
// ResourceDispatcherHostDelegate methods.
|
||||||
bool HandleExternalProtocol(
|
bool HandleExternalProtocol(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
int child_id,
|
content::ResourceRequestInfo* info) override;
|
||||||
const content::ResourceRequestInfo::WebContentsGetter&
|
|
||||||
web_contents_getter,
|
|
||||||
bool is_main_frame,
|
|
||||||
ui::PageTransition page_transition,
|
|
||||||
bool has_user_gesture,
|
|
||||||
content::ResourceContext* resource_context) override;
|
|
||||||
bool ShouldInterceptResourceAsStream(net::URLRequest* request,
|
bool ShouldInterceptResourceAsStream(net::URLRequest* request,
|
||||||
const base::FilePath& plugin_path,
|
const base::FilePath& plugin_path,
|
||||||
const std::string& mime_type,
|
const std::string& mime_type,
|
||||||
@ -46,6 +40,11 @@ class CefResourceDispatcherHostDelegate
|
|||||||
content::ResourceContext* resource_context) override;
|
content::ResourceContext* resource_context) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void HandleExternalProtocolOnUIThread(
|
||||||
|
const GURL& url,
|
||||||
|
const content::ResourceRequestInfo::WebContentsGetter&
|
||||||
|
web_contents_getter);
|
||||||
|
|
||||||
struct StreamTargetInfo {
|
struct StreamTargetInfo {
|
||||||
std::string extension_id;
|
std::string extension_id;
|
||||||
std::string view_id;
|
std::string view_id;
|
||||||
|
@ -81,6 +81,10 @@ CefStoragePartitionProxy::GetBackgroundSyncContext() {
|
|||||||
return parent_->GetBackgroundSyncContext();
|
return parent_->GetBackgroundSyncContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::PaymentAppContext* CefStoragePartitionProxy::GetPaymentAppContext() {
|
||||||
|
return parent_->GetPaymentAppContext();
|
||||||
|
}
|
||||||
|
|
||||||
content::BroadcastChannelProvider*
|
content::BroadcastChannelProvider*
|
||||||
CefStoragePartitionProxy::GetBroadcastChannelProvider() {
|
CefStoragePartitionProxy::GetBroadcastChannelProvider() {
|
||||||
return parent_->GetBroadcastChannelProvider();
|
return parent_->GetBroadcastChannelProvider();
|
||||||
|
@ -37,6 +37,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
|||||||
content::PlatformNotificationContext* GetPlatformNotificationContext()
|
content::PlatformNotificationContext* GetPlatformNotificationContext()
|
||||||
override;
|
override;
|
||||||
content::BackgroundSyncContext* GetBackgroundSyncContext() override;
|
content::BackgroundSyncContext* GetBackgroundSyncContext() override;
|
||||||
|
content::PaymentAppContext* GetPaymentAppContext() override;
|
||||||
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
|
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
|
||||||
void ClearDataForOrigin(uint32_t remove_mask,
|
void ClearDataForOrigin(uint32_t remove_mask,
|
||||||
uint32_t quota_storage_remove_mask,
|
uint32_t quota_storage_remove_mask,
|
||||||
|
@ -30,7 +30,7 @@ void PluginsCallbackImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)) || \
|
#if !(defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)) || \
|
||||||
defined(OS_LINUX)
|
defined(OS_LINUX)
|
||||||
|
|
||||||
void DeliverWidevineCdmError(const std::string& error_message,
|
void DeliverWidevineCdmError(const std::string& error_message,
|
||||||
@ -171,7 +171,7 @@ void CefIsWebPluginUnstable(
|
|||||||
|
|
||||||
void CefRegisterWidevineCdm(const CefString& path,
|
void CefRegisterWidevineCdm(const CefString& path,
|
||||||
CefRefPtr<CefRegisterCdmCallback> callback) {
|
CefRefPtr<CefRegisterCdmCallback> callback) {
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
// Enforce the requirement that CefRegisterWidevineCdm() is called before
|
// Enforce the requirement that CefRegisterWidevineCdm() is called before
|
||||||
// CefInitialize() on Linux. See comments in
|
// CefInitialize() on Linux. See comments in
|
||||||
@ -187,5 +187,5 @@ void CefRegisterWidevineCdm(const CefString& path,
|
|||||||
CefWidevineLoader::GetInstance()->LoadWidevineCdm(path, callback);
|
CefWidevineLoader::GetInstance()->LoadWidevineCdm(path, callback);
|
||||||
#else
|
#else
|
||||||
DeliverWidevineCdmError("Widevine registration is not supported", callback);
|
DeliverWidevineCdmError("Widevine registration is not supported", callback);
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,6 @@ const char kDisableJavascriptAccessClipboard[] =
|
|||||||
// Disable DOM paste via JavaScript execCommand("paste").
|
// Disable DOM paste via JavaScript execCommand("paste").
|
||||||
const char kDisableJavascriptDomPaste[] = "disable-javascript-dom-paste";
|
const char kDisableJavascriptDomPaste[] = "disable-javascript-dom-paste";
|
||||||
|
|
||||||
// Enable caret browsing.
|
|
||||||
const char kEnableCaretBrowsing[] = "enable-caret-browsing";
|
|
||||||
|
|
||||||
// Allow universal access from file URLs.
|
// Allow universal access from file URLs.
|
||||||
const char kAllowUniversalAccessFromFileUrls[] =
|
const char kAllowUniversalAccessFromFileUrls[] =
|
||||||
"allow-universal-access-from-files";
|
"allow-universal-access-from-files";
|
||||||
|
@ -27,7 +27,6 @@ extern const char kDisableJavascriptOpenWindows[];
|
|||||||
extern const char kDisableJavascriptCloseWindows[];
|
extern const char kDisableJavascriptCloseWindows[];
|
||||||
extern const char kDisableJavascriptAccessClipboard[];
|
extern const char kDisableJavascriptAccessClipboard[];
|
||||||
extern const char kDisableJavascriptDomPaste[];
|
extern const char kDisableJavascriptDomPaste[];
|
||||||
extern const char kEnableCaretBrowsing[];
|
|
||||||
extern const char kAllowUniversalAccessFromFileUrls[];
|
extern const char kAllowUniversalAccessFromFileUrls[];
|
||||||
extern const char kDisableImageLoading[];
|
extern const char kDisableImageLoading[];
|
||||||
extern const char kImageShrinkStandaloneToFit[];
|
extern const char kImageShrinkStandaloneToFit[];
|
||||||
|
@ -206,7 +206,7 @@ void CefContentClient::AddPepperPlugins(
|
|||||||
AddPepperFlashFromCommandLine(plugins);
|
AddPepperFlashFromCommandLine(plugins);
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
CefWidevineLoader::AddPepperPlugins(plugins);
|
CefWidevineLoader::AddPepperPlugins(plugins);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# 2014 the Chromium Authors. All rights reserved. Use of this source code is
|
# 2014 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.
|
# governed by a BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import("//build/json_schema_api.gni")
|
|
||||||
import("//tools/json_schema_compiler/json_features.gni")
|
import("//tools/json_schema_compiler/json_features.gni")
|
||||||
|
#import("//tools/json_schema_compiler/json_schema_api.gni")
|
||||||
|
|
||||||
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See README.txt for
|
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See README.txt for
|
||||||
# details.
|
# details.
|
||||||
|
@ -10,20 +10,22 @@ To add a new extension API implemented only in CEF ***:
|
|||||||
API.
|
API.
|
||||||
2. Add <api>.idl or .json to the 'schema_sources' list in
|
2. Add <api>.idl or .json to the 'schema_sources' list in
|
||||||
libcef/common/extensions/api/BUILD.gn. Serialization code will be
|
libcef/common/extensions/api/BUILD.gn. Serialization code will be
|
||||||
generated based on this list in step 5.
|
generated based on this list in step 4.
|
||||||
3. Add an entry in the libcef/common/extensions/api/_*_features.json files if
|
3. Add libcef/browser/extensions/api/<api>/<api>_api.[h|cc] class implementation
|
||||||
necessary [1].
|
|
||||||
4. Add libcef/browser/extensions/api/<api>/<api>_api.[h|cc] class implementation
|
|
||||||
files and associated entries to the 'libcef_static' target in BUILD.gn.
|
files and associated entries to the 'libcef_static' target in BUILD.gn.
|
||||||
5. Run the cef_create_projects script and build to generate the
|
4. Run the cef_create_projects script and build to generate the
|
||||||
cef/libcef/common/extensions/api/<api>.h file and other serialization code
|
cef/libcef/common/extensions/api/<api>.h file and other serialization code
|
||||||
required by the extensions system.
|
required by the extensions system.
|
||||||
6. Call `<class>::GetInstance();` or `<class>Factory::GetFactoryInstance();` [2]
|
5. Add an entry in the libcef/common/extensions/api/_*_features.json files if
|
||||||
|
necessary [1].
|
||||||
|
6. Add an entry in the libcef/common/extensions/api/*_manifest_overlay.json
|
||||||
|
files if necessary [2].
|
||||||
|
7. Call `<class>::GetInstance();` or `<class>Factory::GetFactoryInstance();` [3]
|
||||||
from EnsureBrowserContextKeyedServiceFactoriesBuilt in
|
from EnsureBrowserContextKeyedServiceFactoriesBuilt in
|
||||||
libcef/browser/extensions/browser_context_keyed_service_factories.cc.
|
libcef/browser/extensions/browser_context_keyed_service_factories.cc.
|
||||||
7. Call `DependsOn(<class>Factory::GetInstance());` from
|
8. Call `DependsOn(<class>Factory::GetInstance());` from
|
||||||
CefExtensionSystemFactory::CefExtensionSystemFactory in
|
CefExtensionSystemFactory::CefExtensionSystemFactory in
|
||||||
libcef/browser/extensions/extension_system_factory.cc if necessary [2].
|
libcef/browser/extensions/extension_system_factory.cc if necessary [3].
|
||||||
|
|
||||||
*** Note that CEF does not currently expose its own Mojo APIs. Related code is
|
*** Note that CEF does not currently expose its own Mojo APIs. Related code is
|
||||||
commented out in:
|
commented out in:
|
||||||
@ -36,7 +38,7 @@ commented out in:
|
|||||||
To add a new extension API implemented in Chrome:
|
To add a new extension API implemented in Chrome:
|
||||||
|
|
||||||
1. Register the API in libcef/browser/extensions/chrome_api_registration.cc
|
1. Register the API in libcef/browser/extensions/chrome_api_registration.cc
|
||||||
2. Perform steps 3, 6 and 7 above.
|
2. Perform steps 5 through 8 above.
|
||||||
|
|
||||||
See https://www.chromium.org/developers/design-documents/mojo for more
|
See https://www.chromium.org/developers/design-documents/mojo for more
|
||||||
information.
|
information.
|
||||||
@ -46,7 +48,17 @@ information.
|
|||||||
additional details. For Chrome extensions this should match the definitions
|
additional details. For Chrome extensions this should match the definitions
|
||||||
in the chrome/common/extensions/api/_*_features.json files.
|
in the chrome/common/extensions/api/_*_features.json files.
|
||||||
|
|
||||||
[2] Some Mojo APIs use singleton Factory objects that create a one-to-one
|
[2] Service Manifest InterfaceProviderSpecs control interfaces exposed between
|
||||||
|
processes. Mojo interfaces exposed at the frame level are controlled by the
|
||||||
|
"navigation:frame" dictionary. Those exposed at the process level are
|
||||||
|
controlled by the "service_manager:connector" dictionary. Failure to specify
|
||||||
|
this correctly may result in a console error like the following:
|
||||||
|
|
||||||
|
InterfaceProviderSpec "navigation:frame" prevented service:
|
||||||
|
service:content_renderer from binding interface:
|
||||||
|
mojom::Foo exposed by: service:content_browser
|
||||||
|
|
||||||
|
[3] Some Mojo APIs use singleton Factory objects that create a one-to-one
|
||||||
relationship between a service and a BrowserContext. This is used primarily
|
relationship between a service and a BrowserContext. This is used primarily
|
||||||
to control shutdown/destruction order and implementors must explicitly state
|
to control shutdown/destruction order and implementors must explicitly state
|
||||||
which services are depended on. See comments in
|
which services are depended on. See comments in
|
||||||
|
14
libcef/common/extensions/api/browser_manifest_overlay.json
Normal file
14
libcef/common/extensions/api/browser_manifest_overlay.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "content_browser",
|
||||||
|
"display_name": "CEF",
|
||||||
|
"interface_provider_specs": {
|
||||||
|
"navigation:frame": {
|
||||||
|
"provides": {
|
||||||
|
"renderer": [
|
||||||
|
"extensions::KeepAlive",
|
||||||
|
"extensions::mime_handler::MimeHandlerService"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"display_name": "Chrome Render Process",
|
||||||
|
"interface_provider_specs": {
|
||||||
|
}
|
||||||
|
}
|
12
libcef/common/extensions/api/utility_manifest_overlay.json
Normal file
12
libcef/common/extensions/api/utility_manifest_overlay.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "content_utility",
|
||||||
|
"interface_provider_specs": {
|
||||||
|
"service_manager:connector": {
|
||||||
|
"provides": {
|
||||||
|
"browser": [
|
||||||
|
"net::interfaces::ProxyResolverFactory"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,10 +17,12 @@
|
|||||||
#include "cef/libcef/common/extensions/api/cef_behavior_features.h"
|
#include "cef/libcef/common/extensions/api/cef_behavior_features.h"
|
||||||
#include "cef/libcef/common/extensions/api/cef_manifest_features.h"
|
#include "cef/libcef/common/extensions/api/cef_manifest_features.h"
|
||||||
#include "cef/libcef/common/extensions/api/cef_permission_features.h"
|
#include "cef/libcef/common/extensions/api/cef_permission_features.h"
|
||||||
|
#include "chrome/common/extensions/chrome_aliases.h"
|
||||||
#include "chrome/common/extensions/chrome_manifest_handlers.h"
|
#include "chrome/common/extensions/chrome_manifest_handlers.h"
|
||||||
#include "chrome/grit/common_resources.h"
|
#include "chrome/grit/common_resources.h"
|
||||||
#include "extensions/common/api/generated_schemas.h"
|
#include "extensions/common/api/generated_schemas.h"
|
||||||
#include "extensions/common/common_manifest_handlers.h"
|
#include "extensions/common/common_manifest_handlers.h"
|
||||||
|
#include "extensions/common/extensions_aliases.h"
|
||||||
#include "extensions/common/extension_urls.h"
|
#include "extensions/common/extension_urls.h"
|
||||||
#include "extensions/common/features/api_feature.h"
|
#include "extensions/common/features/api_feature.h"
|
||||||
#include "extensions/common/features/behavior_feature.h"
|
#include "extensions/common/features/behavior_feature.h"
|
||||||
@ -59,8 +61,10 @@ void CefExtensionsClient::Initialize() {
|
|||||||
// TODO(jamescook): Do we need to whitelist any extensions?
|
// TODO(jamescook): Do we need to whitelist any extensions?
|
||||||
|
|
||||||
// Set up permissions.
|
// Set up permissions.
|
||||||
PermissionsInfo::GetInstance()->AddProvider(chrome_api_permissions_);
|
PermissionsInfo::GetInstance()->AddProvider(chrome_api_permissions_,
|
||||||
PermissionsInfo::GetInstance()->AddProvider(extensions_api_permissions_);
|
GetChromePermissionAliases());
|
||||||
|
PermissionsInfo::GetInstance()->AddProvider(extensions_api_permissions_,
|
||||||
|
GetExtensionsPermissionAliases());
|
||||||
}
|
}
|
||||||
|
|
||||||
const PermissionMessageProvider&
|
const PermissionMessageProvider&
|
||||||
@ -177,8 +181,10 @@ std::string CefExtensionsClient::GetWebstoreBaseURL() const {
|
|||||||
return extension_urls::kChromeWebstoreBaseURL;
|
return extension_urls::kChromeWebstoreBaseURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CefExtensionsClient::GetWebstoreUpdateURL() const {
|
const GURL& CefExtensionsClient::GetWebstoreUpdateURL() const {
|
||||||
return extension_urls::kChromeWebstoreUpdateURL;
|
if (webstore_update_url_.is_empty())
|
||||||
|
webstore_update_url_ = GURL(extension_urls::GetWebstoreUpdateUrl());
|
||||||
|
return webstore_update_url_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
|
bool CefExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
|
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
|
||||||
#include "extensions/common/extensions_client.h"
|
#include "extensions/common/extensions_client.h"
|
||||||
#include "extensions/common/permissions/extensions_api_permissions.h"
|
#include "extensions/common/permissions/extensions_api_permissions.h"
|
||||||
|
#include "url/gurl.h"
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ class CefExtensionsClient : public ExtensionsClient {
|
|||||||
bool ShouldSuppressFatalErrors() const override;
|
bool ShouldSuppressFatalErrors() const override;
|
||||||
void RecordDidSuppressFatalError() override;
|
void RecordDidSuppressFatalError() override;
|
||||||
std::string GetWebstoreBaseURL() const override;
|
std::string GetWebstoreBaseURL() const override;
|
||||||
std::string GetWebstoreUpdateURL() const override;
|
const GURL& GetWebstoreUpdateURL() const override;
|
||||||
bool IsBlacklistUpdateURL(const GURL& url) const override;
|
bool IsBlacklistUpdateURL(const GURL& url) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -54,6 +55,9 @@ class CefExtensionsClient : public ExtensionsClient {
|
|||||||
|
|
||||||
ScriptingWhitelist scripting_whitelist_;
|
ScriptingWhitelist scripting_whitelist_;
|
||||||
|
|
||||||
|
// Mutable to allow caching in a const method.
|
||||||
|
mutable GURL webstore_update_url_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionsClient);
|
DISALLOW_COPY_AND_ASSIGN(CefExtensionsClient);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "libcef/common/content_client.h"
|
#include "libcef/common/content_client.h"
|
||||||
|
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
|
#include "net/net_features.h"
|
||||||
#include "extensions/common/constants.h"
|
#include "extensions/common/constants.h"
|
||||||
#include "url/url_constants.h"
|
#include "url/url_constants.h"
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ bool IsInternalProtectedScheme(const std::string& scheme) {
|
|||||||
url::kDataScheme,
|
url::kDataScheme,
|
||||||
url::kFileScheme,
|
url::kFileScheme,
|
||||||
url::kFileSystemScheme,
|
url::kFileSystemScheme,
|
||||||
#if !defined(DISABLE_FTP_SUPPORT)
|
#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
|
||||||
url::kFtpScheme,
|
url::kFtpScheme,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -786,7 +786,7 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!first_party_for_cookies_.is_empty())
|
if (!first_party_for_cookies_.is_empty())
|
||||||
fetcher.SetInitiatorURL(first_party_for_cookies_);
|
fetcher.SetInitiator(url::Origin(first_party_for_cookies_));
|
||||||
|
|
||||||
if (flags_ & UR_FLAG_NO_RETRY_ON_5XX)
|
if (flags_ & UR_FLAG_NO_RETRY_ON_5XX)
|
||||||
fetcher.SetAutomaticallyRetryOn5xx(false);
|
fetcher.SetAutomaticallyRetryOn5xx(false);
|
||||||
|
@ -88,14 +88,8 @@ scoped_refptr<base::SequencedTaskRunner>
|
|||||||
if (id >= 0 && CefContentClient::Get() &&
|
if (id >= 0 && CefContentClient::Get() &&
|
||||||
CefContentClient::Get()->browser() &&
|
CefContentClient::Get()->browser() &&
|
||||||
BrowserThread::IsMessageLoopValid(static_cast<BrowserThread::ID>(id))) {
|
BrowserThread::IsMessageLoopValid(static_cast<BrowserThread::ID>(id))) {
|
||||||
// Don't use BrowserThread::GetTaskRunnerForThread because it returns
|
return BrowserThread::GetTaskRunnerForThread(
|
||||||
// a new MessageLoopProxy object for each call and makes pointer equality
|
static_cast<BrowserThread::ID>(id));
|
||||||
// testing impossible.
|
|
||||||
base::MessageLoop* message_loop =
|
|
||||||
BrowserThread::UnsafeGetMessageLoopForThread(
|
|
||||||
static_cast<BrowserThread::ID>(id));
|
|
||||||
if (message_loop)
|
|
||||||
return message_loop->task_runner();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -106,9 +100,19 @@ scoped_refptr<base::SequencedTaskRunner>
|
|||||||
CefTaskRunnerImpl::GetCurrentTaskRunner() {
|
CefTaskRunnerImpl::GetCurrentTaskRunner() {
|
||||||
scoped_refptr<base::SequencedTaskRunner> task_runner;
|
scoped_refptr<base::SequencedTaskRunner> task_runner;
|
||||||
|
|
||||||
// Check for a MessageLoopProxy. This covers all of the named browser and
|
// For named browser process threads return the same TaskRunner as
|
||||||
// render process threads, plus a few extra.
|
// GetTaskRunner(). Otherwise BelongsToThread() will return incorrect results.
|
||||||
task_runner = base::ThreadTaskRunnerHandle::Get();
|
BrowserThread::ID current_id;
|
||||||
|
if (BrowserThread::GetCurrentThreadIdentifier(¤t_id) &&
|
||||||
|
BrowserThread::IsMessageLoopValid(current_id)) {
|
||||||
|
task_runner = BrowserThread::GetTaskRunnerForThread(current_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!task_runner.get()) {
|
||||||
|
// Check for a MessageLoopProxy. This covers all of the named browser and
|
||||||
|
// render process threads, plus a few extra.
|
||||||
|
task_runner = base::ThreadTaskRunnerHandle::Get();
|
||||||
|
}
|
||||||
|
|
||||||
if (!task_runner.get()) {
|
if (!task_runner.get()) {
|
||||||
// Check for a WebWorker thread.
|
// Check for a WebWorker thread.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include "libcef/common/widevine_loader.h"
|
#include "libcef/common/widevine_loader.h"
|
||||||
|
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
@ -403,4 +403,4 @@ CefWidevineLoader::CefWidevineLoader() {
|
|||||||
CefWidevineLoader::~CefWidevineLoader() {
|
CefWidevineLoader::~CefWidevineLoader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
||||||
|
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -59,6 +59,6 @@ class CefWidevineLoader {
|
|||||||
~CefWidevineLoader();
|
~CefWidevineLoader();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
|
#endif // CEF_LIBCEF_COMMON_WIDEVINE_LOADER_H_
|
||||||
|
@ -68,7 +68,7 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::GetBrowserForMainFrame(
|
|||||||
|
|
||||||
CefRefPtr<CefBrowserHost> CefBrowserImpl::GetHost() {
|
CefRefPtr<CefBrowserHost> CefBrowserImpl::GetHost() {
|
||||||
NOTREACHED() << "GetHost cannot be called from the render process";
|
NOTREACHED() << "GetHost cannot be called from the render process";
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserImpl::CanGoBack() {
|
bool CefBrowserImpl::CanGoBack() {
|
||||||
@ -157,31 +157,31 @@ bool CefBrowserImpl::HasDocument() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrame> CefBrowserImpl::GetMainFrame() {
|
CefRefPtr<CefFrame> CefBrowserImpl::GetMainFrame() {
|
||||||
CEF_REQUIRE_RT_RETURN(NULL);
|
CEF_REQUIRE_RT_RETURN(nullptr);
|
||||||
|
|
||||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
||||||
return GetWebFrameImpl(render_view()->GetWebView()->mainFrame()).get();
|
return GetWebFrameImpl(render_view()->GetWebView()->mainFrame()).get();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrame> CefBrowserImpl::GetFocusedFrame() {
|
CefRefPtr<CefFrame> CefBrowserImpl::GetFocusedFrame() {
|
||||||
CEF_REQUIRE_RT_RETURN(NULL);
|
CEF_REQUIRE_RT_RETURN(nullptr);
|
||||||
|
|
||||||
if (render_view()->GetWebView() &&
|
if (render_view()->GetWebView() &&
|
||||||
render_view()->GetWebView()->focusedFrame()) {
|
render_view()->GetWebView()->focusedFrame()) {
|
||||||
return GetWebFrameImpl(render_view()->GetWebView()->focusedFrame()).get();
|
return GetWebFrameImpl(render_view()->GetWebView()->focusedFrame()).get();
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(int64 identifier) {
|
CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(int64 identifier) {
|
||||||
CEF_REQUIRE_RT_RETURN(NULL);
|
CEF_REQUIRE_RT_RETURN(nullptr);
|
||||||
|
|
||||||
return GetWebFrameImpl(identifier).get();
|
return GetWebFrameImpl(identifier).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
|
CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
|
||||||
CEF_REQUIRE_RT_RETURN(NULL);
|
CEF_REQUIRE_RT_RETURN(nullptr);
|
||||||
|
|
||||||
blink::WebView* web_view = render_view()->GetWebView();
|
blink::WebView* web_view = render_view()->GetWebView();
|
||||||
if (web_view) {
|
if (web_view) {
|
||||||
@ -198,7 +198,7 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
|
|||||||
return GetWebFrameImpl(frame).get();
|
return GetWebFrameImpl(frame).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CefBrowserImpl::GetFrameCount() {
|
size_t CefBrowserImpl::GetFrameCount() {
|
||||||
@ -207,13 +207,9 @@ size_t CefBrowserImpl::GetFrameCount() {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (render_view()->GetWebView()) {
|
if (render_view()->GetWebView()) {
|
||||||
WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
|
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||||
if (main_frame) {
|
frame = frame->traverseNext()) {
|
||||||
WebFrame* cur = main_frame;
|
count++;
|
||||||
do {
|
|
||||||
count++;
|
|
||||||
cur = cur->traverseNext(true);
|
|
||||||
} while (cur != main_frame);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,13 +223,9 @@ void CefBrowserImpl::GetFrameIdentifiers(std::vector<int64>& identifiers) {
|
|||||||
identifiers.clear();
|
identifiers.clear();
|
||||||
|
|
||||||
if (render_view()->GetWebView()) {
|
if (render_view()->GetWebView()) {
|
||||||
WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
|
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||||
if (main_frame) {
|
frame = frame->traverseNext()) {
|
||||||
WebFrame* cur = main_frame;
|
identifiers.push_back(webkit_glue::GetIdentifier(frame));
|
||||||
do {
|
|
||||||
identifiers.push_back(webkit_glue::GetIdentifier(cur));
|
|
||||||
cur = cur->traverseNext(true);
|
|
||||||
} while (cur != main_frame);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,13 +237,9 @@ void CefBrowserImpl::GetFrameNames(std::vector<CefString>& names) {
|
|||||||
names.clear();
|
names.clear();
|
||||||
|
|
||||||
if (render_view()->GetWebView()) {
|
if (render_view()->GetWebView()) {
|
||||||
WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
|
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||||
if (main_frame) {
|
frame = frame->traverseNext()) {
|
||||||
WebFrame* cur = main_frame;
|
names.push_back(CefString(frame->uniqueName().utf8()));
|
||||||
do {
|
|
||||||
names.push_back(CefString(cur->uniqueName().utf8()));
|
|
||||||
cur = cur->traverseNext(true);
|
|
||||||
} while (cur != main_frame);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,7 +335,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) {
|
|||||||
if (frame_id == webkit_glue::kInvalidFrameId) {
|
if (frame_id == webkit_glue::kInvalidFrameId) {
|
||||||
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame())
|
||||||
return GetWebFrameImpl(render_view()->GetWebView()->mainFrame());
|
return GetWebFrameImpl(render_view()->GetWebView()->mainFrame());
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we already know about the frame.
|
// Check if we already know about the frame.
|
||||||
@ -357,18 +345,14 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) {
|
|||||||
|
|
||||||
if (render_view()->GetWebView()) {
|
if (render_view()->GetWebView()) {
|
||||||
// Check if the frame exists but we don't know about it yet.
|
// Check if the frame exists but we don't know about it yet.
|
||||||
WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
|
for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
|
||||||
if (main_frame) {
|
frame = frame->traverseNext()) {
|
||||||
WebFrame* cur = main_frame;
|
if (webkit_glue::GetIdentifier(frame) == frame_id)
|
||||||
do {
|
return GetWebFrameImpl(frame);
|
||||||
if (webkit_glue::GetIdentifier(cur) == frame_id)
|
|
||||||
return GetWebFrameImpl(cur);
|
|
||||||
cur = cur->traverseNext(true);
|
|
||||||
} while (cur != main_frame);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::AddFrameObject(int64_t frame_id,
|
void CefBrowserImpl::AddFrameObject(int64_t frame_id,
|
||||||
@ -409,7 +393,7 @@ void CefBrowserImpl::OnDestruct() {
|
|||||||
handler->OnBrowserDestroyed(this);
|
handler->OnBrowserDestroyed(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
response_manager_.reset(NULL);
|
response_manager_.reset();
|
||||||
|
|
||||||
CefContentRendererClient::Get()->OnBrowserDestroyed(this);
|
CefContentRendererClient::Get()->OnBrowserDestroyed(this);
|
||||||
}
|
}
|
||||||
@ -552,7 +536,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
|
|||||||
false, true));
|
false, true));
|
||||||
success = handler->OnProcessMessageReceived(this, PID_BROWSER,
|
success = handler->OnProcessMessageReceived(this, PID_BROWSER,
|
||||||
message.get());
|
message.get());
|
||||||
message->Detach(NULL);
|
message->Detach(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (params.name == "execute-code") {
|
} else if (params.name == "execute-code") {
|
||||||
|
@ -106,6 +106,7 @@ class CefPrerenderingSupport : public blink::WebPrerenderingSupport {
|
|||||||
void add(const blink::WebPrerender& prerender) override {}
|
void add(const blink::WebPrerender& prerender) override {}
|
||||||
void cancel(const blink::WebPrerender& prerender) override {}
|
void cancel(const blink::WebPrerender& prerender) override {}
|
||||||
void abandon(const blink::WebPrerender& prerender) override {}
|
void abandon(const blink::WebPrerender& prerender) override {}
|
||||||
|
void prefetchFinished() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Stub implementation of blink::WebPrerendererClient.
|
// Stub implementation of blink::WebPrerendererClient.
|
||||||
@ -186,9 +187,8 @@ CefContentRendererClient::CefContentRendererClient()
|
|||||||
extensions::ExtensionsRendererClient::Set(
|
extensions::ExtensionsRendererClient::Set(
|
||||||
extensions_renderer_client_.get());
|
extensions_renderer_client_.get());
|
||||||
}
|
}
|
||||||
#if defined(ENABLE_PRINTING)
|
|
||||||
printing::SetAgent(CefContentClient::Get()->GetUserAgent());
|
printing::SetAgent(CefContentClient::Get()->GetUserAgent());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefContentRendererClient::~CefContentRendererClient() {
|
CefContentRendererClient::~CefContentRendererClient() {
|
||||||
@ -467,6 +467,9 @@ void CefContentRendererClient::RenderFrameCreated(
|
|||||||
content::RenderFrame* render_frame) {
|
content::RenderFrame* render_frame) {
|
||||||
new CefRenderFrameObserver(render_frame);
|
new CefRenderFrameObserver(render_frame);
|
||||||
new CefPepperHelper(render_frame);
|
new CefPepperHelper(render_frame);
|
||||||
|
new printing::PrintWebViewHelper(
|
||||||
|
render_frame,
|
||||||
|
base::WrapUnique(new extensions::CefPrintWebViewHelperDelegate()));
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled())
|
if (extensions::ExtensionsEnabled())
|
||||||
extensions_renderer_client_->RenderFrameCreated(render_frame);
|
extensions_renderer_client_->RenderFrameCreated(render_frame);
|
||||||
@ -477,9 +480,6 @@ void CefContentRendererClient::RenderFrameCreated(
|
|||||||
void CefContentRendererClient::RenderViewCreated(
|
void CefContentRendererClient::RenderViewCreated(
|
||||||
content::RenderView* render_view) {
|
content::RenderView* render_view) {
|
||||||
new CefPrerendererClient(render_view);
|
new CefPrerendererClient(render_view);
|
||||||
new printing::PrintWebViewHelper(
|
|
||||||
render_view,
|
|
||||||
base::WrapUnique(new extensions::CefPrintWebViewHelperDelegate()));
|
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled())
|
if (extensions::ExtensionsEnabled())
|
||||||
extensions_renderer_client_->RenderViewCreated(render_view);
|
extensions_renderer_client_->RenderViewCreated(render_view);
|
||||||
@ -598,8 +598,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
|||||||
bool CefContentRendererClient::WillSendRequest(
|
bool CefContentRendererClient::WillSendRequest(
|
||||||
blink::WebFrame* frame,
|
blink::WebFrame* frame,
|
||||||
ui::PageTransition transition_type,
|
ui::PageTransition transition_type,
|
||||||
const GURL& url,
|
const blink::WebURL& url,
|
||||||
const GURL& first_party_for_cookies,
|
|
||||||
GURL* new_url) {
|
GURL* new_url) {
|
||||||
if (extensions::ExtensionsEnabled()) {
|
if (extensions::ExtensionsEnabled()) {
|
||||||
return extensions_renderer_client_->WillSendRequest(frame, transition_type,
|
return extensions_renderer_client_->WillSendRequest(frame, transition_type,
|
||||||
|
@ -113,8 +113,7 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
|||||||
bool* send_referrer) override;
|
bool* send_referrer) override;
|
||||||
bool WillSendRequest(blink::WebFrame* frame,
|
bool WillSendRequest(blink::WebFrame* frame,
|
||||||
ui::PageTransition transition_type,
|
ui::PageTransition transition_type,
|
||||||
const GURL& url,
|
const blink::WebURL& url,
|
||||||
const GURL& first_party_for_cookies,
|
|
||||||
GURL* new_url) override;
|
GURL* new_url) override;
|
||||||
unsigned long long VisitedLinkHash(const char* canonical_url,
|
unsigned long long VisitedLinkHash(const char* canonical_url,
|
||||||
size_t length) override;
|
size_t length) override;
|
||||||
@ -176,6 +175,8 @@ class CefContentRendererClient : public content::ContentRendererClient,
|
|||||||
// Access must be protected by |single_process_cleanup_lock_|.
|
// Access must be protected by |single_process_cleanup_lock_|.
|
||||||
bool single_process_cleanup_complete_;
|
bool single_process_cleanup_complete_;
|
||||||
base::Lock single_process_cleanup_lock_;
|
base::Lock single_process_cleanup_lock_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefContentRendererClient);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_
|
#endif // CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_
|
||||||
|
@ -78,7 +78,7 @@ bool CefDOMNodeImpl::IsEditable() {
|
|||||||
|
|
||||||
if (node_.isElementNode()) {
|
if (node_.isElementNode()) {
|
||||||
const WebElement& element = node_.toConst<WebElement>();
|
const WebElement& element = node_.toConst<WebElement>();
|
||||||
if (element.isTextFormControlElement())
|
if (webkit_glue::IsTextControlElement(element))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Also return true if it has an ARIA role of 'textbox'.
|
// Also return true if it has an ARIA role of 'textbox'.
|
||||||
|
@ -170,18 +170,18 @@ bool CefExtensionsRendererClient::OverrideCreatePlugin(
|
|||||||
bool CefExtensionsRendererClient::WillSendRequest(
|
bool CefExtensionsRendererClient::WillSendRequest(
|
||||||
blink::WebFrame* frame,
|
blink::WebFrame* frame,
|
||||||
ui::PageTransition transition_type,
|
ui::PageTransition transition_type,
|
||||||
const GURL& url,
|
const blink::WebURL& url,
|
||||||
GURL* new_url) {
|
GURL* new_url) {
|
||||||
// Check whether the request should be allowed. If not allowed, we reset the
|
// Check whether the request should be allowed. If not allowed, we reset the
|
||||||
// URL to something invalid to prevent the request and cause an error.
|
// URL to something invalid to prevent the request and cause an error.
|
||||||
if (url.SchemeIs(extensions::kExtensionScheme) &&
|
if (url.protocolIs(extensions::kExtensionScheme) &&
|
||||||
!resource_request_policy_->CanRequestResource(url, frame,
|
!resource_request_policy_->CanRequestResource(GURL(url), frame,
|
||||||
transition_type)) {
|
transition_type)) {
|
||||||
*new_url = GURL(chrome::kExtensionInvalidRequestURL);
|
*new_url = GURL(chrome::kExtensionInvalidRequestURL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.SchemeIs(extensions::kExtensionResourceScheme) &&
|
if (url.protocolIs(extensions::kExtensionResourceScheme) &&
|
||||||
!resource_request_policy_->CanRequestExtensionResourceScheme(url,
|
!resource_request_policy_->CanRequestExtensionResourceScheme(url,
|
||||||
frame)) {
|
frame)) {
|
||||||
*new_url = GURL(chrome::kExtensionResourceInvalidRequestURL);
|
*new_url = GURL(chrome::kExtensionResourceInvalidRequestURL);
|
||||||
@ -239,7 +239,7 @@ bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
|||||||
// for subframes, so this check only makes sense for top-level frames.
|
// for subframes, so this check only makes sense for top-level frames.
|
||||||
// TODO(alexmos,nasko): Figure out how this check should work when reloading
|
// TODO(alexmos,nasko): Figure out how this check should work when reloading
|
||||||
// subframes in --site-per-process mode.
|
// subframes in --site-per-process mode.
|
||||||
if (!frame->parent() && frame->document().url() == url) {
|
if (!frame->parent() && GURL(frame->document().url()) == url) {
|
||||||
if (is_extension_url != IsStandaloneExtensionProcess())
|
if (is_extension_url != IsStandaloneExtensionProcess())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ namespace blink {
|
|||||||
class WebFrame;
|
class WebFrame;
|
||||||
class WebLocalFrame;
|
class WebLocalFrame;
|
||||||
struct WebPluginParams;
|
struct WebPluginParams;
|
||||||
|
class WebURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
@ -50,7 +51,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
|
|||||||
const blink::WebPluginParams& params);
|
const blink::WebPluginParams& params);
|
||||||
bool WillSendRequest(blink::WebFrame* frame,
|
bool WillSendRequest(blink::WebFrame* frame,
|
||||||
ui::PageTransition transition_type,
|
ui::PageTransition transition_type,
|
||||||
const GURL& url,
|
const blink::WebURL& url,
|
||||||
GURL* new_url);
|
GURL* new_url);
|
||||||
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame);
|
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame);
|
||||||
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame);
|
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame);
|
||||||
|
@ -22,7 +22,7 @@ CefPrintWebViewHelperDelegate::~CefPrintWebViewHelperDelegate(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefPrintWebViewHelperDelegate::CancelPrerender(
|
bool CefPrintWebViewHelperDelegate::CancelPrerender(
|
||||||
content::RenderView* render_view, int routing_id) {
|
content::RenderFrame* render_frame) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,7 @@ class CefPrintWebViewHelperDelegate
|
|||||||
public:
|
public:
|
||||||
~CefPrintWebViewHelperDelegate() override;
|
~CefPrintWebViewHelperDelegate() override;
|
||||||
|
|
||||||
bool CancelPrerender(content::RenderView* render_view,
|
bool CancelPrerender(content::RenderFrame* render_frame) override;
|
||||||
int routing_id) override;
|
|
||||||
blink::WebElement GetPdfElement(blink::WebLocalFrame* frame) override;
|
blink::WebElement GetPdfElement(blink::WebLocalFrame* frame) override;
|
||||||
bool IsPrintPreviewEnabled() override;
|
bool IsPrintPreviewEnabled() override;
|
||||||
bool OverridePrint(blink::WebLocalFrame* frame) override;
|
bool OverridePrint(blink::WebLocalFrame* frame) override;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "libcef/common/cef_messages.h"
|
#include "libcef/common/cef_messages.h"
|
||||||
#include "media/base/eme_constants.h"
|
#include "media/base/eme_constants.h"
|
||||||
#include "media/base/key_system_properties.h"
|
#include "media/base/key_system_properties.h"
|
||||||
|
#include "ppapi/features/features.h"
|
||||||
|
|
||||||
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ using media::SupportedCodecs;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if defined(ENABLE_PEPPER_CDMS)
|
#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
bool IsPepperCdmAvailable(
|
bool IsPepperCdmAvailable(
|
||||||
const std::string& pepper_type,
|
const std::string& pepper_type,
|
||||||
std::vector<base::string16>* additional_param_names,
|
std::vector<base::string16>* additional_param_names,
|
||||||
@ -135,15 +136,15 @@ void AddPepperBasedWidevine(
|
|||||||
media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier.
|
media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier.
|
||||||
}
|
}
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
#endif // defined(ENABLE_PEPPER_CDMS)
|
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void AddCefKeySystems(
|
void AddCefKeySystems(
|
||||||
std::vector<std::unique_ptr<KeySystemProperties>>* key_systems_properties) {
|
std::vector<std::unique_ptr<KeySystemProperties>>* key_systems_properties) {
|
||||||
#if defined(ENABLE_PEPPER_CDMS)
|
#if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
AddPepperBasedWidevine(key_systems_properties);
|
AddPepperBasedWidevine(key_systems_properties);
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
#endif // defined(ENABLE_PEPPER_CDMS)
|
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#include "content/public/renderer/render_thread.h"
|
#include "content/public/renderer/render_thread.h"
|
||||||
#include "gin/object_template_builder.h"
|
#include "gin/object_template_builder.h"
|
||||||
#include "third_party/WebKit/public/platform/URLConversion.h"
|
#include "third_party/WebKit/public/platform/URLConversion.h"
|
||||||
|
#include "third_party/WebKit/public/platform/WebInputEvent.h"
|
||||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||||
#include "third_party/WebKit/public/web/WebInputEvent.h"
|
|
||||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||||
#include "third_party/WebKit/public/web/WebScriptSource.h"
|
#include "third_party/WebKit/public/web/WebScriptSource.h"
|
||||||
#include "third_party/WebKit/public/web/WebView.h"
|
#include "third_party/WebKit/public/web/WebView.h"
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "components/visitedlink/renderer/visitedlink_slave.h"
|
#include "components/visitedlink/renderer/visitedlink_slave.h"
|
||||||
#include "content/public/renderer/render_thread.h"
|
#include "content/public/renderer/render_thread.h"
|
||||||
#include "net/base/net_module.h"
|
#include "net/base/net_module.h"
|
||||||
#include "services/shell/public/cpp/interface_registry.h"
|
#include "services/service_manager/public/cpp/interface_registry.h"
|
||||||
#include "third_party/WebKit/public/platform/WebString.h"
|
#include "third_party/WebKit/public/platform/WebString.h"
|
||||||
#include "third_party/WebKit/public/platform/WebURL.h"
|
#include "third_party/WebKit/public/platform/WebURL.h"
|
||||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||||
|
@ -186,6 +186,11 @@ v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
|
|||||||
return func_rv;
|
return func_rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsTextControlElement(const blink::WebElement& element) {
|
||||||
|
const blink::Element* web_element = element.constUnwrap<blink::Element>();
|
||||||
|
return web_element->isTextControl();
|
||||||
|
}
|
||||||
|
|
||||||
v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
|
v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
|
||||||
const blink::WebString& source,
|
const blink::WebString& source,
|
||||||
const blink::WebString& source_url,
|
const blink::WebString& source_url,
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "v8/include/v8.h"
|
#include "v8/include/v8.h"
|
||||||
|
|
||||||
namespace blink {
|
namespace blink {
|
||||||
|
class WebElement;
|
||||||
class WebFrame;
|
class WebFrame;
|
||||||
class WebNode;
|
class WebNode;
|
||||||
class WebString;
|
class WebString;
|
||||||
@ -46,6 +47,8 @@ int64_t GetIdentifier(blink::WebFrame* frame);
|
|||||||
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name,
|
||||||
blink::WebFrame* relative_to_frame);
|
blink::WebFrame* relative_to_frame);
|
||||||
|
|
||||||
|
bool IsTextControlElement(const blink::WebElement& element);
|
||||||
|
|
||||||
v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
|
v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
|
||||||
v8::Local<v8::Function> function,
|
v8::Local<v8::Function> function,
|
||||||
v8::Local<v8::Object> receiver,
|
v8::Local<v8::Object> receiver,
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
|
|
||||||
<!-- Extension features supported by CEF. -->
|
<!-- Extension features supported by CEF. -->
|
||||||
<include name="IDR_CEF_EXTENSION_API_FEATURES" file="..\common\extensions\api\_api_features.json" type="BINDATA" />
|
<include name="IDR_CEF_EXTENSION_API_FEATURES" file="..\common\extensions\api\_api_features.json" type="BINDATA" />
|
||||||
|
<include name="IDR_CEF_BROWSER_MANIFEST_OVERLAY" file="..\common\extensions\api\browser_manifest_overlay.json" type="BINDATA" />
|
||||||
|
<include name="IDR_CEF_RENDERER_MANIFEST_OVERLAY" file="..\common\extensions\api\renderer_manifest_overlay.json" type="BINDATA" />
|
||||||
|
<include name="IDR_CEF_UTILITY_MANIFEST_OVERLAY" file="..\common\extensions\api\utility_manifest_overlay.json" type="BINDATA" />
|
||||||
</includes>
|
</includes>
|
||||||
</release>
|
</release>
|
||||||
</grit>
|
</grit>
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
#include "chrome/utility/utility_message_handler.h"
|
#include "chrome/utility/utility_message_handler.h"
|
||||||
#include "mojo/public/cpp/bindings/strong_binding.h"
|
#include "mojo/public/cpp/bindings/strong_binding.h"
|
||||||
#include "net/proxy/mojo_proxy_resolver_factory_impl.h"
|
#include "net/proxy/mojo_proxy_resolver_factory_impl.h"
|
||||||
#include "services/shell/public/cpp/interface_registry.h"
|
#include "services/service_manager/public/cpp/interface_registry.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "libcef/utility/printing_handler.h"
|
#include "chrome/utility/printing_handler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -30,7 +30,7 @@ void CreateProxyResolverFactory(
|
|||||||
|
|
||||||
CefContentUtilityClient::CefContentUtilityClient() {
|
CefContentUtilityClient::CefContentUtilityClient() {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
handlers_.push_back(new PrintingHandler());
|
handlers_.push_back(new printing::PrintingHandler());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ bool CefContentUtilityClient::OnMessageReceived(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefContentUtilityClient::ExposeInterfacesToBrowser(
|
void CefContentUtilityClient::ExposeInterfacesToBrowser(
|
||||||
shell::InterfaceRegistry* registry) {
|
service_manager::InterfaceRegistry* registry) {
|
||||||
registry->AddInterface<net::interfaces::ProxyResolverFactory>(
|
registry->AddInterface<net::interfaces::ProxyResolverFactory>(
|
||||||
base::Bind(CreateProxyResolverFactory));
|
base::Bind(CreateProxyResolverFactory));
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@ class CefContentUtilityClient : public content::ContentUtilityClient {
|
|||||||
~CefContentUtilityClient() override;
|
~CefContentUtilityClient() override;
|
||||||
|
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
bool OnMessageReceived(const IPC::Message& message) override;
|
||||||
void ExposeInterfacesToBrowser(shell::InterfaceRegistry* registry) override;
|
void ExposeInterfacesToBrowser(
|
||||||
|
service_manager::InterfaceRegistry* registry) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef ScopedVector<UtilityMessageHandler> Handlers;
|
typedef ScopedVector<UtilityMessageHandler> Handlers;
|
||||||
|
@ -1,163 +0,0 @@
|
|||||||
// Copyright 2014 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/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"
|
|
||||||
#include "printing/page_range.h"
|
|
||||||
#include "printing/pdf_render_settings.h"
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
#include "base/win/iat_patch_function.h"
|
|
||||||
#include "printing/emf_win.h"
|
|
||||||
#include "ui/gfx/gdi_util.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
bool Send(IPC::Message* message) {
|
|
||||||
return content::UtilityThread::Get()->Send(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReleaseProcessIfNeeded() {
|
|
||||||
content::UtilityThread::Get()->ReleaseProcessIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
void PreCacheFontCharacters(const LOGFONT* logfont,
|
|
||||||
const wchar_t* text,
|
|
||||||
size_t text_length) {
|
|
||||||
Send(new ChromeUtilityHostMsg_PreCacheFontCharacters(
|
|
||||||
*logfont, base::string16(text, text_length)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
PrintingHandler::PrintingHandler() {
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
chrome_pdf::SetPDFEnsureTypefaceCharactersAccessible(PreCacheFontCharacters);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
PrintingHandler::~PrintingHandler() {}
|
|
||||||
|
|
||||||
bool PrintingHandler::OnMessageReceived(const IPC::Message& message) {
|
|
||||||
bool handled = true;
|
|
||||||
IPC_BEGIN_MESSAGE_MAP(PrintingHandler, message)
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
|
|
||||||
OnRenderPDFPagesToMetafile)
|
|
||||||
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_GetPage,
|
|
||||||
OnRenderPDFPagesToMetafileGetPage)
|
|
||||||
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop,
|
|
||||||
OnRenderPDFPagesToMetafileStop)
|
|
||||||
#endif // OS_WIN
|
|
||||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
|
||||||
IPC_END_MESSAGE_MAP()
|
|
||||||
return handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
void PrintingHandler::OnRenderPDFPagesToMetafile(
|
|
||||||
IPC::PlatformFileForTransit pdf_transit,
|
|
||||||
const printing::PdfRenderSettings& settings,
|
|
||||||
bool print_text_with_gdi) {
|
|
||||||
pdf_rendering_settings_ = settings;
|
|
||||||
chrome_pdf::SetPDFUseGDIPrinting(print_text_with_gdi);
|
|
||||||
base::File pdf_file = IPC::PlatformFileForTransitToFile(pdf_transit);
|
|
||||||
int page_count = LoadPDF(std::move(pdf_file));
|
|
||||||
Send(
|
|
||||||
new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount(page_count));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintingHandler::OnRenderPDFPagesToMetafileGetPage(
|
|
||||||
int page_number,
|
|
||||||
IPC::PlatformFileForTransit output_file) {
|
|
||||||
base::File emf_file = IPC::PlatformFileForTransitToFile(output_file);
|
|
||||||
double scale_factor = 1.0;
|
|
||||||
bool success =
|
|
||||||
RenderPdfPageToMetafile(page_number, std::move(emf_file), &scale_factor);
|
|
||||||
Send(new ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone(
|
|
||||||
success, scale_factor));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PrintingHandler::OnRenderPDFPagesToMetafileStop() {
|
|
||||||
ReleaseProcessIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
int PrintingHandler::LoadPDF(base::File pdf_file) {
|
|
||||||
int64_t length = pdf_file.GetLength();
|
|
||||||
if (length < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pdf_data_.resize(length);
|
|
||||||
if (length != pdf_file.Read(0, pdf_data_.data(), pdf_data_.size()))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int total_page_count = 0;
|
|
||||||
if (!chrome_pdf::GetPDFDocInfo(
|
|
||||||
&pdf_data_.front(), pdf_data_.size(), &total_page_count, NULL)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return total_page_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PrintingHandler::RenderPdfPageToMetafile(int page_number,
|
|
||||||
base::File output_file,
|
|
||||||
double* scale_factor) {
|
|
||||||
printing::Emf metafile;
|
|
||||||
metafile.Init();
|
|
||||||
|
|
||||||
// We need to scale down DC to fit an entire page into DC available area.
|
|
||||||
// Current metafile is based on screen DC and have current screen size.
|
|
||||||
// Writing outside of those boundaries will result in the cut-off output.
|
|
||||||
// On metafiles (this is the case here), scaling down will still record
|
|
||||||
// original coordinates and we'll be able to print in full resolution.
|
|
||||||
// Before playback we'll need to counter the scaling up that will happen
|
|
||||||
// in the service (print_system_win.cc).
|
|
||||||
*scale_factor =
|
|
||||||
gfx::CalculatePageScale(metafile.context(),
|
|
||||||
pdf_rendering_settings_.area().right(),
|
|
||||||
pdf_rendering_settings_.area().bottom());
|
|
||||||
gfx::ScaleDC(metafile.context(), *scale_factor);
|
|
||||||
|
|
||||||
// The underlying metafile is of type Emf and ignores the arguments passed
|
|
||||||
// to StartPage.
|
|
||||||
metafile.StartPage(gfx::Size(), gfx::Rect(), 1);
|
|
||||||
if (!chrome_pdf::RenderPDFPageToDC(
|
|
||||||
&pdf_data_.front(),
|
|
||||||
pdf_data_.size(),
|
|
||||||
page_number,
|
|
||||||
metafile.context(),
|
|
||||||
pdf_rendering_settings_.dpi(),
|
|
||||||
pdf_rendering_settings_.area().x(),
|
|
||||||
pdf_rendering_settings_.area().y(),
|
|
||||||
pdf_rendering_settings_.area().width(),
|
|
||||||
pdf_rendering_settings_.area().height(),
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
pdf_rendering_settings_.autorotate())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
metafile.FinishPage();
|
|
||||||
metafile.FinishDocument();
|
|
||||||
return metafile.SaveTo(&output_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // OS_WIN
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
// Copyright 2014 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 LIBCEF_UTILITY_PRINTING_HANDLER_H_
|
|
||||||
#define LIBCEF_UTILITY_PRINTING_HANDLER_H_
|
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
|
||||||
#include "base/macros.h"
|
|
||||||
#include "chrome/utility/utility_message_handler.h"
|
|
||||||
#include "ipc/ipc_platform_file.h"
|
|
||||||
#include "pdf/pdf.h"
|
|
||||||
#include "printing/pdf_render_settings.h"
|
|
||||||
|
|
||||||
#if !defined(OS_WIN)
|
|
||||||
#error "Must be building on Windows."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace printing {
|
|
||||||
class PdfRenderSettings;
|
|
||||||
struct PwgRasterSettings;
|
|
||||||
struct PageRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dispatches IPCs for printing.
|
|
||||||
class PrintingHandler : public UtilityMessageHandler {
|
|
||||||
public:
|
|
||||||
PrintingHandler();
|
|
||||||
~PrintingHandler() override;
|
|
||||||
|
|
||||||
// IPC::Listener:
|
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// IPC message handlers.
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
void OnRenderPDFPagesToMetafile(IPC::PlatformFileForTransit pdf_transit,
|
|
||||||
const printing::PdfRenderSettings& settings,
|
|
||||||
bool print_text_with_gdi);
|
|
||||||
void OnRenderPDFPagesToMetafileGetPage(
|
|
||||||
int page_number,
|
|
||||||
IPC::PlatformFileForTransit output_file);
|
|
||||||
void OnRenderPDFPagesToMetafileStop();
|
|
||||||
|
|
||||||
int LoadPDF(base::File pdf_file);
|
|
||||||
bool RenderPdfPageToMetafile(int page_number,
|
|
||||||
base::File output_file,
|
|
||||||
double* scale_factor);
|
|
||||||
|
|
||||||
std::vector<char> pdf_data_;
|
|
||||||
printing::PdfRenderSettings pdf_rendering_settings_;
|
|
||||||
#endif // defined(OS_WIN)
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(PrintingHandler);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LIBCEF_UTILITY_PRINTING_HANDLER_H_
|
|
@ -209,7 +209,7 @@ patches = [
|
|||||||
# Enable support for filtering resource responses.
|
# Enable support for filtering resource responses.
|
||||||
# https://bitbucket.org/chromiumembedded/cef/issues/515
|
# https://bitbucket.org/chromiumembedded/cef/issues/515
|
||||||
'name': 'net_filter_515',
|
'name': 'net_filter_515',
|
||||||
'path': '../net/',
|
'path': '../',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
# Modify views::View to extend SupportsUserData.
|
# Modify views::View to extend SupportsUserData.
|
||||||
@ -288,4 +288,10 @@ patches = [
|
|||||||
'name': 'net_security_expiration_1994',
|
'name': 'net_security_expiration_1994',
|
||||||
'path': '../',
|
'path': '../',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
# Remove DCHECK hit during latency reporting when using OSR.
|
||||||
|
# https://bitbucket.org/chromiumembedded/cef/issues/2060
|
||||||
|
'name': 'render_widget_latency_2060',
|
||||||
|
'path': '../',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h
|
diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h
|
||||||
index 4b8d5bc..6a1b374 100644
|
index 865b29f..ef44e27 100644
|
||||||
--- content/browser/renderer_host/browser_compositor_view_mac.h
|
--- content/browser/renderer_host/browser_compositor_view_mac.h
|
||||||
+++ content/browser/renderer_host/browser_compositor_view_mac.h
|
+++ content/browser/renderer_host/browser_compositor_view_mac.h
|
||||||
@@ -56,9 +56,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver,
|
@@ -55,9 +55,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver,
|
||||||
|
|
||||||
// These will not return nullptr until Destroy is called.
|
// These will not return nullptr until Destroy is called.
|
||||||
DelegatedFrameHost* GetDelegatedFrameHost();
|
DelegatedFrameHost* GetDelegatedFrameHost();
|
||||||
@ -15,10 +15,10 @@ index 4b8d5bc..6a1b374 100644
|
|||||||
|
|
||||||
void SwapCompositorFrame(uint32_t compositor_frame_sink_id,
|
void SwapCompositorFrame(uint32_t compositor_frame_sink_id,
|
||||||
diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm
|
diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||||
index 3ec7423..14d5add 100644
|
index 4ff716d..aaf17b2 100644
|
||||||
--- content/browser/renderer_host/browser_compositor_view_mac.mm
|
--- content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||||
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
|
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
|
||||||
@@ -200,6 +200,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
|
@@ -199,6 +199,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
|
||||||
g_spare_recyclable_compositors.Get().clear();
|
g_spare_recyclable_compositors.Get().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ index 3ec7423..14d5add 100644
|
|||||||
ui::AcceleratedWidgetMac* BrowserCompositorMac::GetAcceleratedWidgetMac() {
|
ui::AcceleratedWidgetMac* BrowserCompositorMac::GetAcceleratedWidgetMac() {
|
||||||
if (recyclable_compositor_)
|
if (recyclable_compositor_)
|
||||||
return recyclable_compositor_->accelerated_widget_mac();
|
return recyclable_compositor_->accelerated_widget_mac();
|
||||||
@@ -417,8 +423,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor(
|
@@ -416,8 +422,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor(
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Size BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP() const {
|
gfx::Size BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP() const {
|
||||||
|
@ -1,14 +1,22 @@
|
|||||||
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
|
diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc
|
||||||
index 7122187..19dec1a 100644
|
index c628e20..3c4e008d 100644
|
||||||
--- render_widget_host_view_guest.cc
|
--- render_widget_host_view_guest.cc
|
||||||
+++ render_widget_host_view_guest.cc
|
+++ render_widget_host_view_guest.cc
|
||||||
@@ -253,6 +253,9 @@ void RenderWidgetHostViewGuest::Destroy() {
|
@@ -253,13 +253,14 @@ void RenderWidgetHostViewGuest::Destroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const {
|
gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const {
|
||||||
+ RenderWidgetHostViewBase* rwhv = GetOwnerRenderWidgetHostView();
|
+ RenderWidgetHostViewBase* rwhv = GetOwnerRenderWidgetHostView();
|
||||||
+ if (rwhv)
|
+ if (rwhv)
|
||||||
+ return rwhv->GetPhysicalBackingSize();
|
+ return rwhv->GetPhysicalBackingSize();
|
||||||
return RenderWidgetHostViewBase::GetPhysicalBackingSize();
|
// We obtain the reference to native view from the owner RenderWidgetHostView.
|
||||||
|
// If the guest is embedded inside a cross-process frame, it is possible to
|
||||||
|
// reach here after the frame is detached in which case there will be no owner
|
||||||
|
// view.
|
||||||
|
- if (!GetOwnerRenderWidgetHostView())
|
||||||
|
- return gfx::Size();
|
||||||
|
- return RenderWidgetHostViewBase::GetPhysicalBackingSize();
|
||||||
|
+ return gfx::Size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::string16 RenderWidgetHostViewGuest::GetSelectedText() {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
|
diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc
|
||||||
index 2dc039f..66e45e2 100644
|
index d4d4f14..977e24e 100644
|
||||||
--- browser/browser_plugin/browser_plugin_guest.cc
|
--- browser/browser_plugin/browser_plugin_guest.cc
|
||||||
+++ browser/browser_plugin/browser_plugin_guest.cc
|
+++ browser/browser_plugin/browser_plugin_guest.cc
|
||||||
@@ -28,7 +28,7 @@
|
@@ -29,7 +29,7 @@
|
||||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||||
#include "content/browser/web_contents/web_contents_impl.h"
|
#include "content/browser/web_contents/web_contents_impl.h"
|
||||||
@ -11,7 +11,7 @@ index 2dc039f..66e45e2 100644
|
|||||||
#include "content/common/browser_plugin/browser_plugin_constants.h"
|
#include "content/common/browser_plugin/browser_plugin_constants.h"
|
||||||
#include "content/common/browser_plugin/browser_plugin_messages.h"
|
#include "content/common/browser_plugin/browser_plugin_messages.h"
|
||||||
#include "content/common/content_constants_internal.h"
|
#include "content/common/content_constants_internal.h"
|
||||||
@@ -293,20 +293,19 @@ void BrowserPluginGuest::InitInternal(
|
@@ -310,20 +310,19 @@ void BrowserPluginGuest::InitInternal(
|
||||||
guest_window_rect_ = params.view_rect;
|
guest_window_rect_ = params.view_rect;
|
||||||
|
|
||||||
if (owner_web_contents_ != owner_web_contents) {
|
if (owner_web_contents_ != owner_web_contents) {
|
||||||
@ -36,7 +36,7 @@ index 2dc039f..66e45e2 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
RendererPreferences* renderer_prefs =
|
RendererPreferences* renderer_prefs =
|
||||||
@@ -758,11 +757,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
@@ -796,11 +795,10 @@ void BrowserPluginGuest::OnWillAttachComplete(
|
||||||
->GetWidget()
|
->GetWidget()
|
||||||
->Init();
|
->Init();
|
||||||
GetWebContents()->GetMainFrame()->Init();
|
GetWebContents()->GetMainFrame()->Init();
|
||||||
@ -52,7 +52,7 @@ index 2dc039f..66e45e2 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git public/browser/browser_plugin_guest_delegate.cc public/browser/browser_plugin_guest_delegate.cc
|
diff --git public/browser/browser_plugin_guest_delegate.cc public/browser/browser_plugin_guest_delegate.cc
|
||||||
index 732df23..25dbc62 100644
|
index 8d691ef..eb13b5d 100644
|
||||||
--- public/browser/browser_plugin_guest_delegate.cc
|
--- public/browser/browser_plugin_guest_delegate.cc
|
||||||
+++ public/browser/browser_plugin_guest_delegate.cc
|
+++ public/browser/browser_plugin_guest_delegate.cc
|
||||||
@@ -4,6 +4,8 @@
|
@@ -4,6 +4,8 @@
|
||||||
@ -64,8 +64,8 @@ index 732df23..25dbc62 100644
|
|||||||
namespace content {
|
namespace content {
|
||||||
|
|
||||||
bool BrowserPluginGuestDelegate::CanRunInDetachedState() const {
|
bool BrowserPluginGuestDelegate::CanRunInDetachedState() const {
|
||||||
@@ -36,4 +38,23 @@ bool BrowserPluginGuestDelegate::CanUseCrossProcessFrames() {
|
@@ -48,4 +50,23 @@ SiteInstance* BrowserPluginGuestDelegate::GetOwnerSiteInstance() {
|
||||||
return true;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
+void BrowserPluginGuestDelegate::OnGuestAttached(
|
+void BrowserPluginGuestDelegate::OnGuestAttached(
|
||||||
@ -89,19 +89,18 @@ index 732df23..25dbc62 100644
|
|||||||
+
|
+
|
||||||
} // namespace content
|
} // namespace content
|
||||||
diff --git public/browser/browser_plugin_guest_delegate.h public/browser/browser_plugin_guest_delegate.h
|
diff --git public/browser/browser_plugin_guest_delegate.h public/browser/browser_plugin_guest_delegate.h
|
||||||
index 0f805651..fe0385d 100644
|
index a32205c..1d93d7b 100644
|
||||||
--- public/browser/browser_plugin_guest_delegate.h
|
--- public/browser/browser_plugin_guest_delegate.h
|
||||||
+++ public/browser/browser_plugin_guest_delegate.h
|
+++ public/browser/browser_plugin_guest_delegate.h
|
||||||
@@ -21,6 +21,8 @@ class Size;
|
@@ -19,6 +19,7 @@ namespace content {
|
||||||
namespace content {
|
|
||||||
|
|
||||||
class GuestHost;
|
class GuestHost;
|
||||||
+class RenderWidgetHost;
|
class RenderWidgetHost;
|
||||||
|
class SiteInstance;
|
||||||
+class WebContentsView;
|
+class WebContentsView;
|
||||||
|
|
||||||
// Objects implement this interface to get notified about changes in the guest
|
// Objects implement this interface to get notified about changes in the guest
|
||||||
// WebContents and to provide necessary functionality.
|
// WebContents and to provide necessary functionality.
|
||||||
@@ -87,6 +89,17 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
|
@@ -85,6 +86,17 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
|
||||||
// content module.
|
// content module.
|
||||||
virtual void SetGuestHost(GuestHost* guest_host) {}
|
virtual void SetGuestHost(GuestHost* guest_host) {}
|
||||||
|
|
||||||
@ -118,4 +117,4 @@ index 0f805651..fe0385d 100644
|
|||||||
+
|
+
|
||||||
// Sets the position of the context menu for the guest contents. The value
|
// Sets the position of the context menu for the guest contents. The value
|
||||||
// reported from the guest renderer should be ignored. The reported value
|
// reported from the guest renderer should be ignored. The reported value
|
||||||
// fromt he guest renderer is incorrect in situations where BrowserPlugin is
|
// from the guest renderer is incorrect in situations where BrowserPlugin is
|
||||||
|
@ -63,10 +63,10 @@ index 4b43013..169ca47 100644
|
|||||||
content::BrowserContext* GetBrowserContextRedirectedInIncognito(
|
content::BrowserContext* GetBrowserContextRedirectedInIncognito(
|
||||||
content::BrowserContext* context);
|
content::BrowserContext* context);
|
||||||
diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h
|
diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h
|
||||||
index ba156c5..0ed578b 100644
|
index f715370..fb38098 100644
|
||||||
--- chrome/browser/profiles/profile_manager.h
|
--- chrome/browser/profiles/profile_manager.h
|
||||||
+++ chrome/browser/profiles/profile_manager.h
|
+++ chrome/browser/profiles/profile_manager.h
|
||||||
@@ -89,7 +89,7 @@ class ProfileManager : public base::NonThreadSafe,
|
@@ -90,7 +90,7 @@ class ProfileManager : public base::NonThreadSafe,
|
||||||
// acceptable. Returns null if creation of the new profile fails.
|
// acceptable. Returns null if creation of the new profile fails.
|
||||||
// TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then
|
// TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then
|
||||||
// make this method private.
|
// make this method private.
|
||||||
@ -75,7 +75,7 @@ index ba156c5..0ed578b 100644
|
|||||||
|
|
||||||
// Returns total number of profiles available on this machine.
|
// Returns total number of profiles available on this machine.
|
||||||
size_t GetNumberOfProfiles();
|
size_t GetNumberOfProfiles();
|
||||||
@@ -117,7 +117,7 @@ class ProfileManager : public base::NonThreadSafe,
|
@@ -118,7 +118,7 @@ class ProfileManager : public base::NonThreadSafe,
|
||||||
|
|
||||||
// Returns true if the profile pointer is known to point to an existing
|
// Returns true if the profile pointer is known to point to an existing
|
||||||
// profile.
|
// profile.
|
||||||
@ -84,7 +84,7 @@ index ba156c5..0ed578b 100644
|
|||||||
|
|
||||||
// Returns the directory where the first created profile is stored,
|
// Returns the directory where the first created profile is stored,
|
||||||
// relative to the user data directory currently in use.
|
// relative to the user data directory currently in use.
|
||||||
@@ -126,7 +126,7 @@ class ProfileManager : public base::NonThreadSafe,
|
@@ -127,7 +127,7 @@ class ProfileManager : public base::NonThreadSafe,
|
||||||
// Get the Profile last used (the Profile to which owns the most recently
|
// Get the Profile last used (the Profile to which owns the most recently
|
||||||
// focused window) with this Chrome build. If no signed profile has been
|
// focused window) with this Chrome build. If no signed profile has been
|
||||||
// stored in Local State, hand back the Default profile.
|
// stored in Local State, hand back the Default profile.
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
diff --git chrome/common/chrome_content_client.cc chrome/common/chrome_content_client.cc
|
diff --git chrome/common/chrome_content_client.cc chrome/common/chrome_content_client.cc
|
||||||
index 616c9b1..cf1c881 100644
|
index bb7757b..532f036 100644
|
||||||
--- chrome/common/chrome_content_client.cc
|
--- chrome/common/chrome_content_client.cc
|
||||||
+++ chrome/common/chrome_content_client.cc
|
+++ chrome/common/chrome_content_client.cc
|
||||||
@@ -77,7 +77,7 @@
|
@@ -78,7 +78,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
|
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && \
|
||||||
- !defined(WIDEVINE_CDM_IS_COMPONENT)
|
- !defined(WIDEVINE_CDM_IS_COMPONENT)
|
||||||
+ !defined(WIDEVINE_CDM_IS_COMPONENT) && defined(WIDEVINE_CDM_VERSION_STRING)
|
+ !defined(WIDEVINE_CDM_IS_COMPONENT) && defined(WIDEVINE_CDM_VERSION_STRING)
|
||||||
#define WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT
|
#define WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
|
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
|
||||||
index 73ee42f..b30dc83 100644
|
index 7d1cf0c..a806826 100644
|
||||||
--- content/browser/compositor/gpu_process_transport_factory.cc
|
--- content/browser/compositor/gpu_process_transport_factory.cc
|
||||||
+++ content/browser/compositor/gpu_process_transport_factory.cc
|
+++ content/browser/compositor/gpu_process_transport_factory.cc
|
||||||
@@ -196,6 +196,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() {
|
@@ -196,6 +196,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() {
|
||||||
@ -14,10 +14,10 @@ index 73ee42f..b30dc83 100644
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
if (shell::ShellIsRemote()) {
|
if (service_manager::ServiceManagerIsRemote()) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
diff --git ui/compositor/compositor.h ui/compositor/compositor.h
|
diff --git ui/compositor/compositor.h ui/compositor/compositor.h
|
||||||
index 6a6b423..4a0d9e4 100644
|
index 76f8f38..0fdc07b 100644
|
||||||
--- ui/compositor/compositor.h
|
--- ui/compositor/compositor.h
|
||||||
+++ ui/compositor/compositor.h
|
+++ ui/compositor/compositor.h
|
||||||
@@ -18,6 +18,7 @@
|
@@ -18,6 +18,7 @@
|
||||||
@ -28,7 +28,7 @@ index 6a6b423..4a0d9e4 100644
|
|||||||
#include "cc/surfaces/surface_sequence.h"
|
#include "cc/surfaces/surface_sequence.h"
|
||||||
#include "cc/trees/layer_tree_host_client.h"
|
#include "cc/trees/layer_tree_host_client.h"
|
||||||
#include "cc/trees/layer_tree_host_single_thread_client.h"
|
#include "cc/trees/layer_tree_host_single_thread_client.h"
|
||||||
@@ -195,6 +196,17 @@ class COMPOSITOR_EXPORT CompositorLock
|
@@ -188,6 +189,17 @@ class COMPOSITOR_EXPORT CompositorLock
|
||||||
DISALLOW_COPY_AND_ASSIGN(CompositorLock);
|
DISALLOW_COPY_AND_ASSIGN(CompositorLock);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ index 6a6b423..4a0d9e4 100644
|
|||||||
// Compositor object to take care of GPU painting.
|
// Compositor object to take care of GPU painting.
|
||||||
// A Browser compositor object is responsible for generating the final
|
// A Browser compositor object is responsible for generating the final
|
||||||
// displayable form of pixels comprising a single widget's contents. It draws an
|
// displayable form of pixels comprising a single widget's contents. It draws an
|
||||||
@@ -218,6 +230,9 @@ class COMPOSITOR_EXPORT Compositor
|
@@ -211,6 +223,9 @@ class COMPOSITOR_EXPORT Compositor
|
||||||
// Schedules a redraw of the layer tree associated with this compositor.
|
// Schedules a redraw of the layer tree associated with this compositor.
|
||||||
void ScheduleDraw();
|
void ScheduleDraw();
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ index 6a6b423..4a0d9e4 100644
|
|||||||
// Sets the root of the layer tree drawn by this Compositor. The root layer
|
// Sets the root of the layer tree drawn by this Compositor. The root layer
|
||||||
// must have no parent. The compositor's root layer is reset if the root layer
|
// must have no parent. The compositor's root layer is reset if the root layer
|
||||||
// is destroyed. NULL can be passed to reset the root layer, in which case the
|
// is destroyed. NULL can be passed to reset the root layer, in which case the
|
||||||
@@ -400,6 +415,8 @@ class COMPOSITOR_EXPORT Compositor
|
@@ -393,6 +408,8 @@ class COMPOSITOR_EXPORT Compositor
|
||||||
|
|
||||||
ui::ContextFactory* context_factory_;
|
ui::ContextFactory* context_factory_;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc
|
diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc
|
||||||
index bb040a6..c801841 100644
|
index 642521f..8fb647f 100644
|
||||||
--- public/renderer/content_renderer_client.cc
|
--- public/renderer/content_renderer_client.cc
|
||||||
+++ public/renderer/content_renderer_client.cc
|
+++ public/renderer/content_renderer_client.cc
|
||||||
@@ -100,7 +100,6 @@ bool ContentRendererClient::AllowPopup() {
|
@@ -100,7 +100,6 @@ bool ContentRendererClient::AllowPopup() {
|
||||||
@ -19,10 +19,10 @@ index bb040a6..c801841 100644
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h
|
diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h
|
||||||
index 14d8550..92e5b21 100644
|
index f2a854f..913e30c 100644
|
||||||
--- public/renderer/content_renderer_client.h
|
--- public/renderer/content_renderer_client.h
|
||||||
+++ public/renderer/content_renderer_client.h
|
+++ public/renderer/content_renderer_client.h
|
||||||
@@ -208,7 +208,6 @@ class CONTENT_EXPORT ContentRendererClient {
|
@@ -204,7 +204,6 @@ class CONTENT_EXPORT ContentRendererClient {
|
||||||
// Returns true if a popup window should be allowed.
|
// Returns true if a popup window should be allowed.
|
||||||
virtual bool AllowPopup();
|
virtual bool AllowPopup();
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ index 14d8550..92e5b21 100644
|
|||||||
// TODO(sgurun) This callback is deprecated and will be removed as soon
|
// TODO(sgurun) This callback is deprecated and will be removed as soon
|
||||||
// as android webview completes implementation of a resource throttle based
|
// as android webview completes implementation of a resource throttle based
|
||||||
// shouldoverrideurl implementation. See crbug.com/325351
|
// shouldoverrideurl implementation. See crbug.com/325351
|
||||||
@@ -224,6 +223,7 @@ class CONTENT_EXPORT ContentRendererClient {
|
@@ -220,6 +219,7 @@ class CONTENT_EXPORT ContentRendererClient {
|
||||||
blink::WebNavigationPolicy default_policy,
|
blink::WebNavigationPolicy default_policy,
|
||||||
bool is_redirect);
|
bool is_redirect);
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ index 14d8550..92e5b21 100644
|
|||||||
// built in media player for the given |url|. Defaults to false.
|
// built in media player for the given |url|. Defaults to false.
|
||||||
virtual bool ShouldUseMediaPlayerForURL(const GURL& url);
|
virtual bool ShouldUseMediaPlayerForURL(const GURL& url);
|
||||||
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
|
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
|
||||||
index 8880b8d..cab954b 100644
|
index 2f79ac0..7e0c73b 100644
|
||||||
--- renderer/render_frame_impl.cc
|
--- renderer/render_frame_impl.cc
|
||||||
+++ renderer/render_frame_impl.cc
|
+++ renderer/render_frame_impl.cc
|
||||||
@@ -5008,7 +5008,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
@@ -5112,7 +5112,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||||
(pending_navigation_params_ &&
|
(pending_navigation_params_ &&
|
||||||
!pending_navigation_params_->request_params.redirects.empty());
|
!pending_navigation_params_->request_params.redirects.empty());
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ index 8880b8d..cab954b 100644
|
|||||||
// The handlenavigation API is deprecated and will be removed once
|
// The handlenavigation API is deprecated and will be removed once
|
||||||
// crbug.com/325351 is resolved.
|
// crbug.com/325351 is resolved.
|
||||||
if (GetContentClient()->renderer()->HandleNavigation(
|
if (GetContentClient()->renderer()->HandleNavigation(
|
||||||
@@ -5017,7 +5016,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
@@ -5121,7 +5120,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||||
is_redirect)) {
|
is_redirect)) {
|
||||||
return blink::WebNavigationPolicyIgnore;
|
return blink::WebNavigationPolicyIgnore;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
diff --git .gn .gn
|
diff --git .gn .gn
|
||||||
index 585f0d8..9f60467 100644
|
index e4b474a..38a41be 100644
|
||||||
--- .gn
|
--- .gn
|
||||||
+++ .gn
|
+++ .gn
|
||||||
@@ -237,6 +237,7 @@ exec_script_whitelist = [
|
@@ -241,6 +241,7 @@ exec_script_whitelist = [
|
||||||
"//build/toolchain/win/BUILD.gn",
|
"//build/toolchain/win/BUILD.gn",
|
||||||
"//build/util/branding.gni",
|
"//build/util/branding.gni",
|
||||||
"//build/util/version.gni",
|
"//build/util/version.gni",
|
||||||
@ -11,10 +11,10 @@ index 585f0d8..9f60467 100644
|
|||||||
|
|
||||||
# TODO(dgn): Layer violation but breaks the build otherwise, see
|
# TODO(dgn): Layer violation but breaks the build otherwise, see
|
||||||
diff --git BUILD.gn BUILD.gn
|
diff --git BUILD.gn BUILD.gn
|
||||||
index 93699f0..3346d3e 100644
|
index 43c7b3d..df225a1 100644
|
||||||
--- BUILD.gn
|
--- BUILD.gn
|
||||||
+++ BUILD.gn
|
+++ BUILD.gn
|
||||||
@@ -280,6 +280,7 @@ group("both_gn_and_gyp") {
|
@@ -282,6 +282,7 @@ group("both_gn_and_gyp") {
|
||||||
# and whether there should be other targets that are iOS-only and missing.
|
# and whether there should be other targets that are iOS-only and missing.
|
||||||
deps += [
|
deps += [
|
||||||
"//cc:cc_unittests",
|
"//cc:cc_unittests",
|
||||||
@ -23,11 +23,11 @@ index 93699f0..3346d3e 100644
|
|||||||
"//chrome/test:unit_tests",
|
"//chrome/test:unit_tests",
|
||||||
"//components:components_browsertests",
|
"//components:components_browsertests",
|
||||||
diff --git build/config/win/visual_studio_version.gni build/config/win/visual_studio_version.gni
|
diff --git build/config/win/visual_studio_version.gni build/config/win/visual_studio_version.gni
|
||||||
index 5bfa9a7..5e6e05d 100644
|
index 982fbe8..e757be46 100644
|
||||||
--- build/config/win/visual_studio_version.gni
|
--- build/config/win/visual_studio_version.gni
|
||||||
+++ build/config/win/visual_studio_version.gni
|
+++ build/config/win/visual_studio_version.gni
|
||||||
@@ -12,9 +12,8 @@ declare_args() {
|
@@ -12,9 +12,8 @@ declare_args() {
|
||||||
# Use "2013" for Visual Studio 2013, or "2013e" for the Express version.
|
# Currently always "2015".
|
||||||
visual_studio_version = ""
|
visual_studio_version = ""
|
||||||
|
|
||||||
- # Directory of the Windows driver kit. If visual_studio_path is empty, this
|
- # Directory of the Windows driver kit. If visual_studio_path is empty, this
|
||||||
@ -80,7 +80,7 @@ index fbc201e..299156d 100644
|
|||||||
|
|
||||||
|
|
||||||
diff --git build/vs_toolchain.py build/vs_toolchain.py
|
diff --git build/vs_toolchain.py build/vs_toolchain.py
|
||||||
index 9c55984..d44d116 100755
|
index c768a8a..bb91777 100755
|
||||||
--- build/vs_toolchain.py
|
--- build/vs_toolchain.py
|
||||||
+++ build/vs_toolchain.py
|
+++ build/vs_toolchain.py
|
||||||
@@ -74,11 +74,18 @@ def SetEnvironmentAndGetRuntimeDllDirs():
|
@@ -74,11 +74,18 @@ def SetEnvironmentAndGetRuntimeDllDirs():
|
||||||
@ -103,10 +103,10 @@ index 9c55984..d44d116 100755
|
|||||||
# directory in order to run binaries locally, but they are needed in order
|
# directory in order to run binaries locally, but they are needed in order
|
||||||
# to create isolates or the mini_installer. Copying them to the output
|
# to create isolates or the mini_installer. Copying them to the output
|
||||||
diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni
|
diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni
|
||||||
index 3e93269..9821a4b 100644
|
index c3ac484..13ae760 100644
|
||||||
--- chrome/chrome_paks.gni
|
--- chrome/chrome_paks.gni
|
||||||
+++ chrome/chrome_paks.gni
|
+++ chrome/chrome_paks.gni
|
||||||
@@ -233,7 +233,7 @@ template("chrome_paks") {
|
@@ -235,7 +235,7 @@ template("chrome_paks") {
|
||||||
additional_source_patterns = invoker.additional_locale_source_patterns
|
additional_source_patterns = invoker.additional_locale_source_patterns
|
||||||
}
|
}
|
||||||
input_locales = locales
|
input_locales = locales
|
||||||
@ -116,10 +116,10 @@ index 3e93269..9821a4b 100644
|
|||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
output_locales = locales_as_mac_outputs
|
output_locales = locales_as_mac_outputs
|
||||||
diff --git chrome/installer/mini_installer/BUILD.gn chrome/installer/mini_installer/BUILD.gn
|
diff --git chrome/installer/mini_installer/BUILD.gn chrome/installer/mini_installer/BUILD.gn
|
||||||
index 6994618..4ed3f85 100644
|
index 0f37e54..7b81cde 100644
|
||||||
--- chrome/installer/mini_installer/BUILD.gn
|
--- chrome/installer/mini_installer/BUILD.gn
|
||||||
+++ chrome/installer/mini_installer/BUILD.gn
|
+++ chrome/installer/mini_installer/BUILD.gn
|
||||||
@@ -125,7 +125,7 @@ template("generate_mini_installer") {
|
@@ -124,7 +124,7 @@ template("generate_mini_installer") {
|
||||||
inputs = [
|
inputs = [
|
||||||
"$chrome_dll_file",
|
"$chrome_dll_file",
|
||||||
"$root_out_dir/chrome.exe",
|
"$root_out_dir/chrome.exe",
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
diff --git resource_ids resource_ids
|
diff --git resource_ids resource_ids
|
||||||
index 82347ce..8e09968 100644
|
index c500512..0ac0e98 100644
|
||||||
--- resource_ids
|
--- resource_ids
|
||||||
+++ resource_ids
|
+++ resource_ids
|
||||||
@@ -14,6 +14,12 @@
|
@@ -358,5 +358,12 @@
|
||||||
{
|
# Thinking about appending to the end?
|
||||||
"SRCDIR": "../..",
|
# Please read the header and find the right section above instead.
|
||||||
|
|
||||||
+ "cef/libcef/resources/cef_resources.grd": {
|
+ "cef/libcef/resources/cef_resources.grd": {
|
||||||
+ "includes": [31500],
|
+ "includes": [31500],
|
||||||
@ -12,6 +12,6 @@ index 82347ce..8e09968 100644
|
|||||||
+ "cef/libcef/resources/cef_strings.grd": {
|
+ "cef/libcef/resources/cef_strings.grd": {
|
||||||
+ "messages": [32000],
|
+ "messages": [32000],
|
||||||
+ },
|
+ },
|
||||||
"chrome/browser/browser_resources.grd": {
|
+
|
||||||
"includes": [400],
|
# Resource ids starting at 31000 are reserved for projects built on Chromium.
|
||||||
"structures": [850],
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
diff --git input_method_win.cc input_method_win.cc
|
diff --git input_method_win.cc input_method_win.cc
|
||||||
index 8975069..858bc9b 100644
|
index 49efa46..c9eb806 100644
|
||||||
--- input_method_win.cc
|
--- input_method_win.cc
|
||||||
+++ input_method_win.cc
|
+++ input_method_win.cc
|
||||||
@@ -642,8 +642,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
|
@@ -664,8 +664,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
|
||||||
// receiving keyboard input as long as it is an active window. This works well
|
// receiving keyboard input as long as it is an active window. This works well
|
||||||
// even when the |attached_window_handle| becomes active but has not received
|
// even when the |attached_window_handle| becomes active but has not received
|
||||||
// WM_FOCUS yet.
|
// WM_FOCUS yet.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
diff --git message_loop.cc message_loop.cc
|
diff --git message_loop.cc message_loop.cc
|
||||||
index 74287b1..7309e88 100644
|
index 1581f6c..ecb3149 100644
|
||||||
--- message_loop.cc
|
--- message_loop.cc
|
||||||
+++ message_loop.cc
|
+++ message_loop.cc
|
||||||
@@ -96,12 +96,6 @@ MessageLoop::~MessageLoop() {
|
@@ -96,12 +96,6 @@ MessageLoop::~MessageLoop() {
|
||||||
@ -15,7 +15,7 @@ index 74287b1..7309e88 100644
|
|||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
if (in_high_res_mode_)
|
if (in_high_res_mode_)
|
||||||
Time::ActivateHighResolutionTimer(false);
|
Time::ActivateHighResolutionTimer(false);
|
||||||
@@ -313,6 +307,9 @@ MessageLoop::MessageLoop(Type type, MessagePumpFactoryCallback pump_factory)
|
@@ -319,6 +313,9 @@ MessageLoop::MessageLoop(Type type, MessagePumpFactoryCallback pump_factory)
|
||||||
in_high_res_mode_(false),
|
in_high_res_mode_(false),
|
||||||
#endif
|
#endif
|
||||||
nestable_tasks_allowed_(true),
|
nestable_tasks_allowed_(true),
|
||||||
@ -26,7 +26,7 @@ index 74287b1..7309e88 100644
|
|||||||
run_loop_(NULL),
|
run_loop_(NULL),
|
||||||
incoming_task_queue_(new internal::IncomingTaskQueue(this)),
|
incoming_task_queue_(new internal::IncomingTaskQueue(this)),
|
||||||
diff --git message_loop.h message_loop.h
|
diff --git message_loop.h message_loop.h
|
||||||
index 5b1728e..79c4c58 100644
|
index ac7a303..b39018b 100644
|
||||||
--- message_loop.h
|
--- message_loop.h
|
||||||
+++ message_loop.h
|
+++ message_loop.h
|
||||||
@@ -299,6 +299,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
|
@@ -299,6 +299,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
|
||||||
@ -46,7 +46,7 @@ index 5b1728e..79c4c58 100644
|
|||||||
// Can only be called from the thread that owns the MessageLoop.
|
// Can only be called from the thread that owns the MessageLoop.
|
||||||
bool is_running() const;
|
bool is_running() const;
|
||||||
|
|
||||||
@@ -437,6 +447,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
|
@@ -436,6 +446,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
|
||||||
// insider a (accidentally induced?) nested message pump.
|
// insider a (accidentally induced?) nested message pump.
|
||||||
bool nestable_tasks_allowed_;
|
bool nestable_tasks_allowed_;
|
||||||
|
|
||||||
@ -60,10 +60,10 @@ index 5b1728e..79c4c58 100644
|
|||||||
// if type_ is TYPE_CUSTOM and pump_ is null.
|
// if type_ is TYPE_CUSTOM and pump_ is null.
|
||||||
MessagePumpFactoryCallback pump_factory_;
|
MessagePumpFactoryCallback pump_factory_;
|
||||||
diff --git message_pump_win.cc message_pump_win.cc
|
diff --git message_pump_win.cc message_pump_win.cc
|
||||||
index b9b2c84..9abef7e 100644
|
index f1ec727..4b859c0 100644
|
||||||
--- message_pump_win.cc
|
--- message_pump_win.cc
|
||||||
+++ message_pump_win.cc
|
+++ message_pump_win.cc
|
||||||
@@ -478,20 +478,28 @@ bool MessagePumpForUI::ProcessMessageHelper(const MSG& msg) {
|
@@ -366,20 +366,28 @@ bool MessagePumpForUI::ProcessMessageHelper(const MSG& msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessagePumpForUI::ProcessPumpReplacementMessage() {
|
bool MessagePumpForUI::ProcessPumpReplacementMessage() {
|
||||||
@ -88,7 +88,7 @@ index b9b2c84..9abef7e 100644
|
|||||||
+ bool have_message = false;
|
+ bool have_message = false;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
- const bool have_message =
|
- const bool have_message =
|
||||||
- g_peek_message(&msg, nullptr, 0, 0, PM_REMOVE) != FALSE;
|
- PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE) != FALSE;
|
||||||
+ // We should not process all window messages if we are in the context of an
|
+ // We should not process all window messages if we are in the context of an
|
||||||
+ // OS modal loop, i.e. in the context of a windows API call like MessageBox.
|
+ // OS modal loop, i.e. in the context of a windows API call like MessageBox.
|
||||||
+ // This is to ensure that these messages are peeked out by the OS modal loop.
|
+ // This is to ensure that these messages are peeked out by the OS modal loop.
|
||||||
@ -102,5 +102,5 @@ index b9b2c84..9abef7e 100644
|
|||||||
|
|
||||||
- // Expect no message or a message different than kMsgHaveWork.
|
- // Expect no message or a message different than kMsgHaveWork.
|
||||||
DCHECK(!have_message || kMsgHaveWork != msg.message ||
|
DCHECK(!have_message || kMsgHaveWork != msg.message ||
|
||||||
msg.hwnd != message_hwnd_);
|
msg.hwnd != message_window_.hwnd());
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user