Minimum fixes needed for chromium_src

This commit is contained in:
Brian R. Bondy 2016-04-29 09:15:04 -04:00 committed by Cheng Zhao
parent 02d72c81af
commit ce7c1023d5
10 changed files with 28 additions and 36 deletions

View file

@ -71,10 +71,6 @@ void RenderParamsFromPrintSettings(const PrintSettings& settings,
params->margin_top = settings.page_setup_device_units().content_area().y(); params->margin_top = settings.page_setup_device_units().content_area().y();
params->margin_left = settings.page_setup_device_units().content_area().x(); params->margin_left = settings.page_setup_device_units().content_area().x();
params->dpi = settings.dpi(); params->dpi = settings.dpi();
// Currently hardcoded at 1.25. See PrintSettings' constructor.
params->min_shrink = settings.min_shrink();
// Currently hardcoded at 2.0. See PrintSettings' constructor.
params->max_shrink = settings.max_shrink();
// Currently hardcoded at 72dpi. See PrintSettings' constructor. // Currently hardcoded at 72dpi. See PrintSettings' constructor.
params->desired_dpi = settings.desired_dpi(); params->desired_dpi = settings.desired_dpi();
// Always use an invalid cookie. // Always use an invalid cookie.

View file

@ -79,7 +79,7 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "net/base/net_util.h" #include "net/base/network_interfaces.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) && !defined(OS_CHROMEOS) #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) && !defined(OS_CHROMEOS)

View file

@ -4,6 +4,8 @@
#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h" #include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h"
#include <stddef.h>
#include "base/pickle.h" #include "base/pickle.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
@ -48,10 +50,10 @@ ui::ClipboardType ConvertClipboardType(uint32_t type) {
// clipboard interface for custom data. // clipboard interface for custom data.
bool JumpToFormatInPickle(const base::string16& format, bool JumpToFormatInPickle(const base::string16& format,
base::PickleIterator* iter) { base::PickleIterator* iter) {
size_t size = 0; uint32_t size = 0;
if (!iter->ReadSizeT(&size)) if (!iter->ReadUInt32(&size))
return false; return false;
for (size_t i = 0; i < size; ++i) { for (uint32_t i = 0; i < size; ++i) {
base::string16 stored_format; base::string16 stored_format;
if (!iter->ReadString16(&stored_format)) if (!iter->ReadString16(&stored_format))
return false; return false;
@ -83,7 +85,7 @@ std::string ReadDataFromPickle(const base::string16& format,
bool WriteDataToPickle(const std::map<base::string16, std::string>& data, bool WriteDataToPickle(const std::map<base::string16, std::string>& data,
base::Pickle* pickle) { base::Pickle* pickle) {
pickle->WriteSizeT(data.size()); pickle->WriteUInt32(data.size());
for (std::map<base::string16, std::string>::const_iterator it = data.begin(); for (std::map<base::string16, std::string>::const_iterator it = data.begin();
it != data.end(); it != data.end();
++it) { ++it) {

View file

@ -21,7 +21,7 @@
#include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/common/pepper_plugin_info.h" #include "content/public/common/pepper_plugin_info.h"
#include "net/base/net_util.h" #include "net/base/network_interfaces.h"
#include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_errors.h"
#include "ppapi/host/dispatch_host_message.h" #include "ppapi/host/dispatch_host_message.h"
#include "ppapi/host/host_message_context.h" #include "ppapi/host/host_message_context.h"

View file

@ -124,7 +124,7 @@ static void AddPepperBasedWidevine(
} }
cdm::AddWidevineWithCodecs( cdm::AddWidevineWithCodecs(
cdm::WIDEVINE, supported_codecs, supported_codecs,
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
media::EmeRobustness::HW_SECURE_ALL, // Maximum audio robustness. media::EmeRobustness::HW_SECURE_ALL, // Maximum audio robustness.
media::EmeRobustness::HW_SECURE_ALL, // Maximim video robustness. media::EmeRobustness::HW_SECURE_ALL, // Maximim video robustness.

View file

@ -39,6 +39,7 @@
#include "third_party/WebKit/public/web/WebSettings.h" #include "third_party/WebKit/public/web/WebSettings.h"
#include "third_party/WebKit/public/web/WebView.h" #include "third_party/WebKit/public/web/WebView.h"
#include "third_party/WebKit/public/web/WebViewClient.h" #include "third_party/WebKit/public/web/WebViewClient.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
using content::WebPreferences; using content::WebPreferences;
@ -62,9 +63,9 @@ int GetDPI(const PrintMsg_Print_Params* print_params) {
bool PrintMsg_Print_Params_IsValid(const PrintMsg_Print_Params& params) { bool PrintMsg_Print_Params_IsValid(const PrintMsg_Print_Params& params) {
return !params.content_size.IsEmpty() && !params.page_size.IsEmpty() && return !params.content_size.IsEmpty() && !params.page_size.IsEmpty() &&
!params.printable_area.IsEmpty() && params.document_cookie && !params.printable_area.IsEmpty() && params.document_cookie &&
params.desired_dpi && params.max_shrink && params.min_shrink && params.desired_dpi && params.dpi && params.margin_top >= 0 &&
params.dpi && (params.margin_top >= 0) && (params.margin_left >= 0) && params.margin_left >= 0 && params.dpi > kMinDpi &&
params.dpi > kMinDpi && params.document_cookie != 0; params.document_cookie != 0;
} }
PrintMsg_Print_Params GetCssPrintParams( PrintMsg_Print_Params GetCssPrintParams(
@ -425,8 +426,9 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
blink::WebLocalFrame* parent, blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope, blink::WebTreeScopeType scope,
const blink::WebString& name, const blink::WebString& name,
blink::WebSandboxFlags sandboxFlags, const blink::WebString& unique_name,
const blink::WebFrameOwnerProperties& frameOwnerProperties) override; blink::WebSandboxFlags sandbox_flags,
const blink::WebFrameOwnerProperties& frame_owner_properties) override;
void frameDetached(blink::WebFrame* frame, DetachType type) override; void frameDetached(blink::WebFrame* frame, DetachType type) override;
private: private:
@ -491,6 +493,7 @@ void PrepareFrameAndViewForPrint::ResizeForPrinting() {
// think the page is 125% larger so the size of the page is correct for // think the page is 125% larger so the size of the page is correct for
// minimum (default) scaling. // minimum (default) scaling.
// This is important for sites that try to fill the page. // This is important for sites that try to fill the page.
// The 1.25 value is |printingMinimumShrinkFactor|.
gfx::Size print_layout_size(web_print_params_.printContentArea.width, gfx::Size print_layout_size(web_print_params_.printContentArea.width,
web_print_params_.printContentArea.height); web_print_params_.printContentArea.height);
print_layout_size.set_height( print_layout_size.set_height(
@ -573,8 +576,9 @@ blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
blink::WebLocalFrame* parent, blink::WebLocalFrame* parent,
blink::WebTreeScopeType scope, blink::WebTreeScopeType scope,
const blink::WebString& name, const blink::WebString& name,
blink::WebSandboxFlags sandboxFlags, const blink::WebString& unique_name,
const blink::WebFrameOwnerProperties& frameOwnerProperties) { blink::WebSandboxFlags sandbox_flags,
const blink::WebFrameOwnerProperties& frame_owner_properties) {
blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this); blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this);
parent->appendChild(frame); parent->appendChild(frame);
return frame; return frame;
@ -1263,11 +1267,7 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument(
} }
metafile_.reset(new PdfMetafileSkia); metafile_.reset(new PdfMetafileSkia);
if (!metafile_->Init()) { CHECK(metafile_->Init());
set_error(PREVIEW_ERROR_METAFILE_INIT_FAILED);
LOG(ERROR) << "PdfMetafileSkia Init failed";
return false;
}
current_page_index_ = 0; current_page_index_ = 0;
pages_to_render_ = pages; pages_to_render_ = pages;

View file

@ -83,9 +83,9 @@ class PrintWebViewHelper
PREVIEW_ERROR_NONE, // Always first. PREVIEW_ERROR_NONE, // Always first.
PREVIEW_ERROR_BAD_SETTING, PREVIEW_ERROR_BAD_SETTING,
PREVIEW_ERROR_METAFILE_COPY_FAILED, PREVIEW_ERROR_METAFILE_COPY_FAILED,
PREVIEW_ERROR_METAFILE_INIT_FAILED, PREVIEW_ERROR_METAFILE_INIT_FAILED_DEPRECATED,
PREVIEW_ERROR_ZERO_PAGES, PREVIEW_ERROR_ZERO_PAGES,
PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED, PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED_DEPRECATED,
PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE, PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE,
PREVIEW_ERROR_INVALID_PRINTER_SETTINGS, PREVIEW_ERROR_INVALID_PRINTER_SETTINGS,
PREVIEW_ERROR_LAST_ENUM // Always last. PREVIEW_ERROR_LAST_ENUM // Always last.

View file

@ -12,9 +12,9 @@
#include "chrome/common/print_messages.h" #include "chrome/common/print_messages.h"
#include "printing/metafile_skia_wrapper.h" #include "printing/metafile_skia_wrapper.h"
#include "printing/page_size_margins.h" #include "printing/page_size_margins.h"
#include "skia/ext/platform_device.h"
#include "third_party/WebKit/public/platform/WebCanvas.h" #include "third_party/WebKit/public/platform/WebCanvas.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace printing { namespace printing {
@ -24,8 +24,7 @@ void PrintWebViewHelper::PrintPageInternal(
const PrintMsg_PrintPage_Params& params, const PrintMsg_PrintPage_Params& params,
WebFrame* frame) { WebFrame* frame) {
PdfMetafileSkia metafile; PdfMetafileSkia metafile;
if (!metafile.Init()) CHECK(metafile.Init());
return;
int page_number = params.page_number; int page_number = params.page_number;
gfx::Size page_size_in_dpi; gfx::Size page_size_in_dpi;
@ -63,12 +62,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
if (render_to_draft) { if (render_to_draft) {
draft_metafile.reset(new PdfMetafileSkia()); draft_metafile.reset(new PdfMetafileSkia());
if (!draft_metafile->Init()) { CHECK(draft_metafile->Init());
print_preview_context_.set_error(
PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED);
LOG(ERROR) << "Draft PdfMetafileSkia Init failed";
return false;
}
initial_render_metafile = draft_metafile.get(); initial_render_metafile = draft_metafile.get();
} }

View file

@ -27,7 +27,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "net/base/ip_endpoint.h" #include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "net/base/net_util.h" #include "net/base/network_interfaces.h"
#include "net/base/sockaddr_storage.h" #include "net/base/sockaddr_storage.h"
#include "net/socket/socket_descriptor.h" #include "net/socket/socket_descriptor.h"

View file

@ -22,7 +22,7 @@
#include "base/sys_byteorder.h" #include "base/sys_byteorder.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "net/base/net_util.h" #include "net/base/network_interfaces.h"
#include "net/base/winsock_init.h" #include "net/base/winsock_init.h"
#include "net/socket/socket_descriptor.h" #include "net/socket/socket_descriptor.h"