format previously missed chromium_src .cc files
This commit is contained in:
parent
8cc81509d7
commit
f7d4437b3f
58 changed files with 688 additions and 898 deletions
|
@ -44,9 +44,7 @@ static bool IsPepperCdmAvailable(
|
|||
bool is_available = false;
|
||||
content::RenderThread::Get()->Send(
|
||||
new ChromeViewHostMsg_IsInternalPluginAvailableForMimeType(
|
||||
pepper_type,
|
||||
&is_available,
|
||||
additional_param_names,
|
||||
pepper_type, &is_available, additional_param_names,
|
||||
additional_param_values));
|
||||
|
||||
return is_available;
|
||||
|
@ -181,8 +179,7 @@ void GetSupportedCodecsForPepperCdm(
|
|||
base::ASCIIToUTF16(kCdmSupportedCodecsParamName)) {
|
||||
const base::string16& codecs_string16 = additional_param_values[i];
|
||||
std::string codecs_string;
|
||||
if (!base::UTF16ToUTF8(codecs_string16.c_str(),
|
||||
codecs_string16.length(),
|
||||
if (!base::UTF16ToUTF8(codecs_string16.c_str(), codecs_string16.length(),
|
||||
&codecs_string)) {
|
||||
DLOG(WARNING) << "Non-UTF-8 codecs string.";
|
||||
// Continue using the best effort conversion.
|
||||
|
@ -206,8 +203,7 @@ static void AddPepperBasedWidevine(
|
|||
|
||||
std::vector<base::string16> additional_param_names;
|
||||
std::vector<base::string16> additional_param_values;
|
||||
if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType,
|
||||
&additional_param_names,
|
||||
if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType, &additional_param_names,
|
||||
&additional_param_values)) {
|
||||
DVLOG(1) << "Widevine CDM is not currently available.";
|
||||
return;
|
||||
|
@ -215,8 +211,7 @@ static void AddPepperBasedWidevine(
|
|||
|
||||
std::vector<std::string> codecs;
|
||||
GetSupportedCodecsForPepperCdm(additional_param_names,
|
||||
additional_param_values,
|
||||
&codecs);
|
||||
additional_param_values, &codecs);
|
||||
|
||||
SupportedCodecs supported_codecs = media::EME_CODEC_NONE;
|
||||
|
||||
|
@ -254,15 +249,15 @@ static void AddPepperBasedWidevine(
|
|||
NOT_SUPPORTED, // Persistent-release-message.
|
||||
media::EmeFeatureSupport::REQUESTABLE, // Persistent state.
|
||||
media::EmeFeatureSupport::REQUESTABLE)); // Distinctive identifier.
|
||||
#else // (Desktop)
|
||||
Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
|
||||
Robustness::SW_SECURE_DECODE, // Maximum video robustness.
|
||||
#else // (Desktop)
|
||||
Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
|
||||
Robustness::SW_SECURE_DECODE, // Maximum video robustness.
|
||||
media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.
|
||||
media::EmeSessionTypeSupport::
|
||||
NOT_SUPPORTED, // persistent-release-message.
|
||||
media::EmeFeatureSupport::REQUESTABLE, // Persistent state.
|
||||
media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier.
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
#endif // defined(OS_CHROMEOS)
|
||||
}
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
|
|
@ -28,7 +28,8 @@ ChromeRendererPepperHostFactory::ChromeRendererPepperHostFactory(
|
|||
|
||||
ChromeRendererPepperHostFactory::~ChromeRendererPepperHostFactory() {}
|
||||
|
||||
std::unique_ptr<ResourceHost> ChromeRendererPepperHostFactory::CreateResourceHost(
|
||||
std::unique_ptr<ResourceHost>
|
||||
ChromeRendererPepperHostFactory::CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
|
|
|
@ -32,10 +32,8 @@ PepperFlashFontFileHost::PepperFlashFontFileHost(
|
|||
fd_.reset(content::MatchFontWithFallback(
|
||||
description.face.c_str(),
|
||||
description.weight >= PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD,
|
||||
description.italic,
|
||||
charset,
|
||||
PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT));
|
||||
#elif defined(OS_WIN) // defined(OS_LINUX) || defined(OS_OPENBSD)
|
||||
description.italic, charset, PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT));
|
||||
#elif defined(OS_WIN) // defined(OS_LINUX) || defined(OS_OPENBSD)
|
||||
int weight = description.weight;
|
||||
if (weight == FW_DONTCARE)
|
||||
weight = SkFontStyle::kNormal_Weight;
|
||||
|
@ -45,7 +43,7 @@ PepperFlashFontFileHost::PepperFlashFontFileHost(
|
|||
sk_sp<SkFontMgr> font_mgr(SkFontMgr::RefDefault());
|
||||
typeface_ = sk_sp<SkTypeface>(
|
||||
font_mgr->matchFamilyStyle(description.face.c_str(), style));
|
||||
#endif // defined(OS_WIN)
|
||||
#endif // defined(OS_WIN)
|
||||
}
|
||||
|
||||
PepperFlashFontFileHost::~PepperFlashFontFileHost() {}
|
||||
|
@ -67,7 +65,7 @@ bool PepperFlashFontFileHost::GetFontData(uint32_t table,
|
|||
int fd = fd_.get();
|
||||
if (fd != -1)
|
||||
result = content::GetFontTable(fd, table, 0 /* offset */,
|
||||
reinterpret_cast<uint8_t*>(buffer), length);
|
||||
reinterpret_cast<uint8_t*>(buffer), length);
|
||||
#elif defined(OS_WIN)
|
||||
if (typeface_) {
|
||||
table = base::ByteSwap(table);
|
||||
|
@ -92,14 +90,14 @@ int32_t PepperFlashFontFileHost::OnGetFontTable(
|
|||
int32_t result = PP_ERROR_FAILED;
|
||||
size_t length = 0;
|
||||
if (GetFontData(table, NULL, &length)) {
|
||||
contents.resize(length);
|
||||
uint8_t* contents_ptr =
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(contents.c_str()));
|
||||
if (GetFontData(table, contents_ptr, &length)) {
|
||||
result = PP_OK;
|
||||
} else {
|
||||
contents.clear();
|
||||
}
|
||||
contents.resize(length);
|
||||
uint8_t* contents_ptr =
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(contents.c_str()));
|
||||
if (GetFontData(table, contents_ptr, &length)) {
|
||||
result = PP_OK;
|
||||
} else {
|
||||
contents.clear();
|
||||
}
|
||||
}
|
||||
|
||||
context->reply_msg = PpapiPluginMsg_FlashFontFile_GetFontTableReply(contents);
|
||||
|
|
|
@ -26,8 +26,7 @@ int32_t PepperFlashFullscreenHost::OnResourceMessageReceived(
|
|||
ppapi::host::HostMessageContext* context) {
|
||||
PPAPI_BEGIN_MESSAGE_MAP(PepperFlashFullscreenHost, msg)
|
||||
PPAPI_DISPATCH_HOST_RESOURCE_CALL(
|
||||
PpapiHostMsg_FlashFullscreen_SetFullscreen,
|
||||
OnSetFullscreen)
|
||||
PpapiHostMsg_FlashFullscreen_SetFullscreen, OnSetFullscreen)
|
||||
PPAPI_END_MESSAGE_MAP()
|
||||
return PP_ERROR_FAILED;
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ bool ConvertMenuData(const PP_Flash_Menu* in_menu,
|
|||
item.enabled = PP_ToBool(in_menu->items[i].enabled);
|
||||
item.checked = PP_ToBool(in_menu->items[i].checked);
|
||||
if (type == PP_FLASH_MENUITEM_TYPE_SUBMENU) {
|
||||
if (!ConvertMenuData(
|
||||
in_menu->items[i].submenu, depth + 1, &item.submenu, menu_id_map))
|
||||
if (!ConvertMenuData(in_menu->items[i].submenu, depth + 1, &item.submenu,
|
||||
menu_id_map))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,7 @@ void PepperFlashMenuHost::OnMenuClosed(int request_id) {
|
|||
|
||||
void PepperFlashMenuHost::SendMenuReply(int32_t result, int action) {
|
||||
ppapi::host::ReplyMessageContext reply_context(
|
||||
ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0),
|
||||
NULL,
|
||||
ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0), NULL,
|
||||
MSG_ROUTING_NONE);
|
||||
reply_context.params.set_result(result);
|
||||
host()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(action));
|
||||
|
|
|
@ -97,7 +97,7 @@ enum FlashNavigateUsage {
|
|||
FLASH_NAVIGATE_USAGE_ENUM_COUNT
|
||||
};
|
||||
|
||||
static base::LazyInstance<std::map<std::string, FlashNavigateUsage> >::
|
||||
static base::LazyInstance<std::map<std::string, FlashNavigateUsage>>::
|
||||
DestructorAtExit g_rejected_headers = LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
bool IsSimpleHeader(const std::string& lower_case_header_name,
|
||||
|
@ -112,11 +112,8 @@ bool IsSimpleHeader(const std::string& lower_case_header_name,
|
|||
std::string lower_case_mime_type;
|
||||
std::string lower_case_charset;
|
||||
bool had_charset = false;
|
||||
net::HttpUtil::ParseContentType(header_value,
|
||||
&lower_case_mime_type,
|
||||
&lower_case_charset,
|
||||
&had_charset,
|
||||
NULL);
|
||||
net::HttpUtil::ParseContentType(header_value, &lower_case_mime_type,
|
||||
&lower_case_charset, &had_charset, NULL);
|
||||
return lower_case_mime_type == "application/x-www-form-urlencoded" ||
|
||||
lower_case_mime_type == "multipart/form-data" ||
|
||||
lower_case_mime_type == "text/plain";
|
||||
|
@ -127,8 +124,8 @@ bool IsSimpleHeader(const std::string& lower_case_header_name,
|
|||
|
||||
void RecordFlashNavigateUsage(FlashNavigateUsage usage) {
|
||||
DCHECK_NE(FLASH_NAVIGATE_USAGE_ENUM_COUNT, usage);
|
||||
UMA_HISTOGRAM_ENUMERATION(
|
||||
"Plugin.FlashNavigateUsage", usage, FLASH_NAVIGATE_USAGE_ENUM_COUNT);
|
||||
UMA_HISTOGRAM_ENUMERATION("Plugin.FlashNavigateUsage", usage,
|
||||
FLASH_NAVIGATE_USAGE_ENUM_COUNT);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -277,8 +274,8 @@ int32_t PepperFlashRendererHost::OnDrawGlyphs(
|
|||
y += SkFloatToScalar(params.glyph_advances[i].y);
|
||||
}
|
||||
|
||||
canvas->drawPosText(
|
||||
¶ms.glyph_indices[0], glyph_count * 2, sk_positions, paint);
|
||||
canvas->drawPosText(¶ms.glyph_indices[0], glyph_count * 2, sk_positions,
|
||||
paint);
|
||||
}
|
||||
|
||||
if (needs_unmapping)
|
||||
|
@ -310,12 +307,11 @@ int32_t PepperFlashRendererHost::OnNavigate(
|
|||
static_cast<FlashNavigateUsage>(i);
|
||||
}
|
||||
|
||||
net::HttpUtil::HeadersIterator header_iter(
|
||||
data.headers.begin(), data.headers.end(), "\n\r");
|
||||
net::HttpUtil::HeadersIterator header_iter(data.headers.begin(),
|
||||
data.headers.end(), "\n\r");
|
||||
bool rejected = false;
|
||||
while (header_iter.GetNext()) {
|
||||
std::string lower_case_header_name =
|
||||
base::ToLowerASCII(header_iter.name());
|
||||
std::string lower_case_header_name = base::ToLowerASCII(header_iter.name());
|
||||
if (!IsSimpleHeader(lower_case_header_name, header_iter.values())) {
|
||||
rejected = true;
|
||||
|
||||
|
|
|
@ -83,30 +83,26 @@ PrintMsg_Print_Params GetCssPrintParams(
|
|||
int margin_top_in_pixels =
|
||||
ConvertUnit(page_params.margin_top, dpi, kPixelsPerInch);
|
||||
int margin_right_in_pixels = ConvertUnit(
|
||||
page_params.page_size.width() -
|
||||
page_params.content_size.width() - page_params.margin_left,
|
||||
page_params.page_size.width() - page_params.content_size.width() -
|
||||
page_params.margin_left,
|
||||
dpi, kPixelsPerInch);
|
||||
int margin_bottom_in_pixels = ConvertUnit(
|
||||
page_params.page_size.height() -
|
||||
page_params.content_size.height() - page_params.margin_top,
|
||||
dpi, kPixelsPerInch);
|
||||
int margin_left_in_pixels = ConvertUnit(
|
||||
page_params.margin_left,
|
||||
page_params.page_size.height() - page_params.content_size.height() -
|
||||
page_params.margin_top,
|
||||
dpi, kPixelsPerInch);
|
||||
int margin_left_in_pixels =
|
||||
ConvertUnit(page_params.margin_left, dpi, kPixelsPerInch);
|
||||
|
||||
if (frame) {
|
||||
frame->PageSizeAndMarginsInPixels(page_index,
|
||||
page_size_in_pixels,
|
||||
margin_top_in_pixels,
|
||||
margin_right_in_pixels,
|
||||
margin_bottom_in_pixels,
|
||||
margin_left_in_pixels);
|
||||
frame->PageSizeAndMarginsInPixels(
|
||||
page_index, page_size_in_pixels, margin_top_in_pixels,
|
||||
margin_right_in_pixels, margin_bottom_in_pixels, margin_left_in_pixels);
|
||||
}
|
||||
|
||||
double new_content_width = page_size_in_pixels.Width() -
|
||||
margin_left_in_pixels - margin_right_in_pixels;
|
||||
margin_left_in_pixels - margin_right_in_pixels;
|
||||
double new_content_height = page_size_in_pixels.Height() -
|
||||
margin_top_in_pixels - margin_bottom_in_pixels;
|
||||
margin_top_in_pixels - margin_bottom_in_pixels;
|
||||
|
||||
// Invalid page size and/or margins. We just use the default setting.
|
||||
if (new_content_width < 1 || new_content_height < 1) {
|
||||
|
@ -120,7 +116,7 @@ PrintMsg_Print_Params GetCssPrintParams(
|
|||
ConvertUnit(page_size_in_pixels.Height(), kPixelsPerInch, dpi));
|
||||
page_css_params.content_size =
|
||||
gfx::Size(ConvertUnit(new_content_width, kPixelsPerInch, dpi),
|
||||
ConvertUnit(new_content_height, kPixelsPerInch, dpi));
|
||||
ConvertUnit(new_content_height, kPixelsPerInch, dpi));
|
||||
|
||||
page_css_params.margin_top =
|
||||
ConvertUnit(margin_top_in_pixels, kPixelsPerInch, dpi);
|
||||
|
@ -160,8 +156,8 @@ double FitPrintParamsToPage(const PrintMsg_Print_Params& page_params,
|
|||
params_to_fit->margin_left = static_cast<int>(
|
||||
(default_page_size_width - css_page_size_width * scale_factor) / 2 +
|
||||
(params_to_fit->margin_left * scale_factor));
|
||||
params_to_fit->content_size = gfx::Size(
|
||||
static_cast<int>(content_width), static_cast<int>(content_height));
|
||||
params_to_fit->content_size = gfx::Size(static_cast<int>(content_width),
|
||||
static_cast<int>(content_height));
|
||||
params_to_fit->page_size = page_params.page_size;
|
||||
return scale_factor;
|
||||
}
|
||||
|
@ -173,10 +169,10 @@ void CalculatePageLayoutFromPrintParams(
|
|||
int content_width = params.content_size.width();
|
||||
int content_height = params.content_size.height();
|
||||
|
||||
int margin_bottom = params.page_size.height() -
|
||||
content_height - params.margin_top;
|
||||
int margin_right = params.page_size.width() -
|
||||
content_width - params.margin_left;
|
||||
int margin_bottom =
|
||||
params.page_size.height() - content_height - params.margin_top;
|
||||
int margin_right =
|
||||
params.page_size.width() - content_width - params.margin_left;
|
||||
|
||||
page_layout_in_points->content_width =
|
||||
ConvertUnit(content_width, dpi, kPointsPerInch);
|
||||
|
@ -237,8 +233,9 @@ void ComputeWebKitPrintParamsInDesiredDpi(
|
|||
}
|
||||
|
||||
blink::WebPlugin* GetPlugin(const blink::WebLocalFrame* frame) {
|
||||
return frame->GetDocument().IsPluginDocument() ?
|
||||
frame->GetDocument().To<blink::WebPluginDocument>().Plugin() : nullptr;
|
||||
return frame->GetDocument().IsPluginDocument()
|
||||
? frame->GetDocument().To<blink::WebPluginDocument>().Plugin()
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame,
|
||||
|
@ -264,8 +261,8 @@ PrintMsg_Print_Params CalculatePrintParamsForCss(
|
|||
bool ignore_css_margins,
|
||||
bool fit_to_page,
|
||||
double* scale_factor) {
|
||||
PrintMsg_Print_Params css_params = GetCssPrintParams(frame, page_index,
|
||||
page_params);
|
||||
PrintMsg_Print_Params css_params =
|
||||
GetCssPrintParams(frame, page_index, page_params);
|
||||
|
||||
PrintMsg_Print_Params params = page_params;
|
||||
EnsureOrientationMatches(css_params, ¶ms);
|
||||
|
@ -282,14 +279,15 @@ PrintMsg_Print_Params CalculatePrintParamsForCss(
|
|||
// Since we are ignoring the margins, the css page size is no longer
|
||||
// valid.
|
||||
int default_margin_right = params.page_size.width() -
|
||||
params.content_size.width() - params.margin_left;
|
||||
params.content_size.width() - params.margin_left;
|
||||
int default_margin_bottom = params.page_size.height() -
|
||||
params.content_size.height() - params.margin_top;
|
||||
result_params.content_size = gfx::Size(
|
||||
result_params.page_size.width() - result_params.margin_left -
|
||||
default_margin_right,
|
||||
result_params.page_size.height() - result_params.margin_top -
|
||||
default_margin_bottom);
|
||||
params.content_size.height() -
|
||||
params.margin_top;
|
||||
result_params.content_size =
|
||||
gfx::Size(result_params.page_size.width() - result_params.margin_left -
|
||||
default_margin_right,
|
||||
result_params.page_size.height() - result_params.margin_top -
|
||||
default_margin_bottom);
|
||||
}
|
||||
|
||||
if (fit_to_page) {
|
||||
|
@ -310,8 +308,7 @@ FrameReference::FrameReference() {
|
|||
Reset(NULL);
|
||||
}
|
||||
|
||||
FrameReference::~FrameReference() {
|
||||
}
|
||||
FrameReference::~FrameReference() {}
|
||||
|
||||
void FrameReference::Reset(blink::WebLocalFrame* frame) {
|
||||
if (frame) {
|
||||
|
@ -370,17 +367,11 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
|||
// Prepares frame for printing.
|
||||
void StartPrinting();
|
||||
|
||||
blink::WebLocalFrame* frame() {
|
||||
return frame_.GetFrame();
|
||||
}
|
||||
blink::WebLocalFrame* frame() { return frame_.GetFrame(); }
|
||||
|
||||
const blink::WebNode& node() const {
|
||||
return node_to_print_;
|
||||
}
|
||||
const blink::WebNode& node() const { return node_to_print_; }
|
||||
|
||||
int GetExpectedPageCount() const {
|
||||
return expected_pages_count_;
|
||||
}
|
||||
int GetExpectedPageCount() const { return expected_pages_count_; }
|
||||
|
||||
void FinishPrinting();
|
||||
|
||||
|
@ -445,12 +436,11 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
|
|||
!PrintingNodeOrPdfFrame(frame, node_to_print_)) {
|
||||
bool fit_to_page = ignore_css_margins &&
|
||||
print_params.print_scaling_option ==
|
||||
blink::kWebPrintScalingOptionFitToPrintableArea;
|
||||
blink::kWebPrintScalingOptionFitToPrintableArea;
|
||||
ComputeWebKitPrintParamsInDesiredDpi(params, &web_print_params_);
|
||||
frame->PrintBegin(web_print_params_, node_to_print_);
|
||||
print_params = CalculatePrintParamsForCss(frame, 0, print_params,
|
||||
ignore_css_margins, fit_to_page,
|
||||
NULL);
|
||||
print_params = CalculatePrintParamsForCss(
|
||||
frame, 0, print_params, ignore_css_margins, fit_to_page, NULL);
|
||||
frame->PrintEnd();
|
||||
}
|
||||
ComputeWebKitPrintParamsInDesiredDpi(print_params, &web_print_params_);
|
||||
|
@ -486,7 +476,6 @@ void PrepareFrameAndViewForPrint::ResizeForPrinting() {
|
|||
web_view->Resize(print_layout_size);
|
||||
}
|
||||
|
||||
|
||||
void PrepareFrameAndViewForPrint::StartPrinting() {
|
||||
ResizeForPrinting();
|
||||
blink::WebView* web_view = frame_.view();
|
||||
|
@ -525,8 +514,8 @@ void PrepareFrameAndViewForPrint::CopySelection(
|
|||
blink::WebView::Create(this, blink::kWebPageVisibilityStateVisible);
|
||||
owns_web_view_ = true;
|
||||
content::RenderView::ApplyWebPreferences(prefs, web_view);
|
||||
blink::WebLocalFrame* main_frame = blink::WebLocalFrame::CreateMainFrame(
|
||||
web_view, this, nullptr, nullptr);
|
||||
blink::WebLocalFrame* main_frame =
|
||||
blink::WebLocalFrame::CreateMainFrame(web_view, this, nullptr, nullptr);
|
||||
blink::WebFrameWidget::Create(this, main_frame);
|
||||
frame_.Reset(web_view->MainFrame()->ToWebLocalFrame());
|
||||
node_to_print_.Reset();
|
||||
|
@ -557,8 +546,7 @@ blink::WebLocalFrame* PrepareFrameAndViewForPrint::CreateChildFrame(
|
|||
blink::WebSandboxFlags sandbox_flags,
|
||||
const blink::WebParsedFeaturePolicy& container_policy,
|
||||
const blink::WebFrameOwnerProperties& frame_owner_properties) {
|
||||
blink::WebLocalFrame* frame = parent->CreateLocalChild(
|
||||
scope, this, nullptr);
|
||||
blink::WebLocalFrame* frame = parent->CreateLocalChild(scope, this, nullptr);
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
@ -613,8 +601,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderFrame* render_frame)
|
|||
is_loading_(false),
|
||||
is_scripted_preview_delayed_(false),
|
||||
ipc_nesting_level_(0),
|
||||
weak_ptr_factory_(this) {
|
||||
}
|
||||
weak_ptr_factory_(this) {}
|
||||
|
||||
PrintWebViewHelper::~PrintWebViewHelper() {}
|
||||
|
||||
|
@ -639,7 +626,7 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
|
|||
IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone)
|
||||
IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
IPC_END_MESSAGE_MAP()
|
||||
|
||||
--ipc_nesting_level_;
|
||||
return handled;
|
||||
|
@ -650,9 +637,10 @@ void PrintWebViewHelper::OnDestruct() {
|
|||
}
|
||||
|
||||
#if !defined(DISABLE_BASIC_PRINTING)
|
||||
void PrintWebViewHelper::OnPrintPages(bool silent, bool print_background,
|
||||
void PrintWebViewHelper::OnPrintPages(bool silent,
|
||||
bool print_background,
|
||||
const base::string16& device_name) {
|
||||
if (ipc_nesting_level_> 1)
|
||||
if (ipc_nesting_level_ > 1)
|
||||
return;
|
||||
|
||||
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
|
@ -665,11 +653,9 @@ void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout(
|
|||
gfx::Size* page_size,
|
||||
gfx::Rect* content_area) {
|
||||
*page_size = gfx::Size(
|
||||
page_layout_in_points.content_width +
|
||||
page_layout_in_points.margin_right +
|
||||
page_layout_in_points.content_width + page_layout_in_points.margin_right +
|
||||
page_layout_in_points.margin_left,
|
||||
page_layout_in_points.content_height +
|
||||
page_layout_in_points.margin_top +
|
||||
page_layout_in_points.content_height + page_layout_in_points.margin_top +
|
||||
page_layout_in_points.margin_bottom);
|
||||
*content_area = gfx::Rect(page_layout_in_points.margin_left,
|
||||
page_layout_in_points.margin_top,
|
||||
|
@ -896,9 +882,9 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
|
|||
case FAIL_PREVIEW:
|
||||
case INVALID_SETTINGS:
|
||||
if (print_pages_params_) {
|
||||
Send(new PrintHostMsg_PrintPreviewFailed(routing_id(),
|
||||
print_pages_params_->params.document_cookie,
|
||||
print_pages_params_->params.preview_request_id));
|
||||
Send(new PrintHostMsg_PrintPreviewFailed(
|
||||
routing_id(), print_pages_params_->params.document_cookie,
|
||||
print_pages_params_->params.preview_request_id));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -929,9 +915,8 @@ void PrintWebViewHelper::PrintPages() {
|
|||
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
|
||||
// TODO(vitalybuka): should be page_count or valid pages from params.pages.
|
||||
// See http://crbug.com/161576
|
||||
Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(),
|
||||
print_params.document_cookie,
|
||||
page_count));
|
||||
Send(new PrintHostMsg_DidGetPrintedPagesCount(
|
||||
routing_id(), print_params.document_cookie, page_count));
|
||||
#endif // !defined(OS_CHROMEOS)
|
||||
|
||||
if (!PrintPagesNative(prep_frame_view_->frame(), page_count)) {
|
||||
|
@ -1018,10 +1003,11 @@ bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size,
|
|||
return result;
|
||||
}
|
||||
|
||||
bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame,
|
||||
const blink::WebNode& node,
|
||||
int* number_of_pages,
|
||||
const base::string16& device_name) {
|
||||
bool PrintWebViewHelper::CalculateNumberOfPages(
|
||||
blink::WebLocalFrame* frame,
|
||||
const blink::WebNode& node,
|
||||
int* number_of_pages,
|
||||
const base::string16& device_name) {
|
||||
DCHECK(frame);
|
||||
bool fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node));
|
||||
if (!InitPrintSettings(fit_to_paper_size, device_name)) {
|
||||
|
@ -1081,11 +1067,11 @@ bool PrintWebViewHelper::UpdatePrintSettings(
|
|||
|
||||
if (!print_for_preview_) {
|
||||
job_settings->GetInteger(kPreviewRequestID,
|
||||
&settings.params.preview_request_id);
|
||||
&settings.params.preview_request_id);
|
||||
settings.params.print_to_pdf = true;
|
||||
UpdateFrameMarginsCssInfo(*job_settings);
|
||||
settings.params.print_scaling_option =
|
||||
blink::kWebPrintScalingOptionSourceSize;
|
||||
blink::kWebPrintScalingOptionSourceSize;
|
||||
}
|
||||
|
||||
SetPrintPagesParams(settings);
|
||||
|
@ -1207,11 +1193,9 @@ PrintWebViewHelper::PrintPreviewContext::PrintPreviewContext()
|
|||
generate_draft_pages_(true),
|
||||
print_ready_metafile_page_count_(0),
|
||||
error_(PREVIEW_ERROR_NONE),
|
||||
state_(UNINITIALIZED) {
|
||||
}
|
||||
state_(UNINITIALIZED) {}
|
||||
|
||||
PrintWebViewHelper::PrintPreviewContext::~PrintPreviewContext() {
|
||||
}
|
||||
PrintWebViewHelper::PrintPreviewContext::~PrintPreviewContext() {}
|
||||
|
||||
void PrintWebViewHelper::PrintPreviewContext::InitWithFrame(
|
||||
blink::WebLocalFrame* web_frame) {
|
||||
|
@ -1391,8 +1375,8 @@ blink::WebLocalFrame* PrintWebViewHelper::PrintPreviewContext::source_frame() {
|
|||
return source_frame_.GetFrame();
|
||||
}
|
||||
|
||||
const blink::WebNode&
|
||||
PrintWebViewHelper::PrintPreviewContext::source_node() const {
|
||||
const blink::WebNode& PrintWebViewHelper::PrintPreviewContext::source_node()
|
||||
const {
|
||||
DCHECK(state_ != UNINITIALIZED);
|
||||
return source_node_;
|
||||
}
|
||||
|
@ -1403,8 +1387,8 @@ PrintWebViewHelper::PrintPreviewContext::prepared_frame() {
|
|||
return prep_frame_view_->frame();
|
||||
}
|
||||
|
||||
const blink::WebNode&
|
||||
PrintWebViewHelper::PrintPreviewContext::prepared_node() const {
|
||||
const blink::WebNode& PrintWebViewHelper::PrintPreviewContext::prepared_node()
|
||||
const {
|
||||
DCHECK(state_ != UNINITIALIZED);
|
||||
return prep_frame_view_->node();
|
||||
}
|
||||
|
|
|
@ -38,11 +38,10 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
|||
}
|
||||
|
||||
base::TimeTicks begin_time = base::TimeTicks::Now();
|
||||
PrintPageInternal(page_params,
|
||||
print_preview_context_.prepared_frame(),
|
||||
PrintPageInternal(page_params, print_preview_context_.prepared_frame(),
|
||||
initial_render_metafile);
|
||||
print_preview_context_.RenderedPreviewPage(
|
||||
base::TimeTicks::Now() - begin_time);
|
||||
print_preview_context_.RenderedPreviewPage(base::TimeTicks::Now() -
|
||||
begin_time);
|
||||
if (draft_metafile.get()) {
|
||||
draft_metafile->FinishDocument();
|
||||
} else if (print_preview_context_.IsModifiable() &&
|
||||
|
@ -51,7 +50,6 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
|||
draft_metafile =
|
||||
print_preview_context_.metafile()->GetMetafileForCurrentPage(
|
||||
SkiaDocumentType::PDF);
|
||||
|
||||
}
|
||||
return PreviewPageRendered(page_number, draft_metafile.get());
|
||||
}
|
||||
|
@ -94,8 +92,8 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
|||
metafile.FinishDocument();
|
||||
|
||||
PrintHostMsg_DidPrintPage_Params printed_page_params;
|
||||
if (!CopyMetafileDataToSharedMem(
|
||||
metafile, &printed_page_params.metafile_data_handle)) {
|
||||
if (!CopyMetafileDataToSharedMem(metafile,
|
||||
&printed_page_params.metafile_data_handle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "printing/units.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
|
||||
|
||||
namespace printing {
|
||||
|
||||
using blink::WebLocalFrame;
|
||||
|
@ -35,13 +34,10 @@ bool PrintWebViewHelper::RenderPreviewPage(
|
|||
}
|
||||
|
||||
base::TimeTicks begin_time = base::TimeTicks::Now();
|
||||
PrintPageInternal(page_params,
|
||||
print_preview_context_.prepared_frame(),
|
||||
initial_render_metafile,
|
||||
NULL,
|
||||
NULL);
|
||||
print_preview_context_.RenderedPreviewPage(
|
||||
base::TimeTicks::Now() - begin_time);
|
||||
PrintPageInternal(page_params, print_preview_context_.prepared_frame(),
|
||||
initial_render_metafile, NULL, NULL);
|
||||
print_preview_context_.RenderedPreviewPage(base::TimeTicks::Now() -
|
||||
begin_time);
|
||||
if (draft_metafile.get()) {
|
||||
draft_metafile->FinishDocument();
|
||||
} else if (print_preview_context_.IsModifiable() &&
|
||||
|
@ -84,10 +80,7 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
|||
page_params.params = params.params;
|
||||
for (size_t i = 0; i < printed_pages.size(); ++i) {
|
||||
page_params.page_number = printed_pages[i];
|
||||
PrintPageInternal(page_params,
|
||||
frame,
|
||||
&metafile,
|
||||
&page_size_in_dpi[i],
|
||||
PrintPageInternal(page_params, frame, &metafile, &page_size_in_dpi[i],
|
||||
&content_area_in_dpi[i]);
|
||||
}
|
||||
|
||||
|
@ -97,8 +90,8 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
|
|||
metafile.FinishDocument();
|
||||
|
||||
PrintHostMsg_DidPrintPage_Params printed_page_params;
|
||||
if (!CopyMetafileDataToSharedMem(
|
||||
metafile, &printed_page_params.metafile_data_handle)) {
|
||||
if (!CopyMetafileDataToSharedMem(metafile,
|
||||
&printed_page_params.metafile_data_handle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -138,10 +131,10 @@ void PrintWebViewHelper::PrintPageInternal(
|
|||
// Calculate the actual page size and content area in dpi.
|
||||
if (page_size_in_dpi) {
|
||||
*page_size_in_dpi =
|
||||
gfx::Size(static_cast<int>(ConvertUnitDouble(
|
||||
page_size.width(), kPointsPerInch, dpi)),
|
||||
static_cast<int>(ConvertUnitDouble(
|
||||
page_size.height(), kPointsPerInch, dpi)));
|
||||
gfx::Size(static_cast<int>(ConvertUnitDouble(page_size.width(),
|
||||
kPointsPerInch, dpi)),
|
||||
static_cast<int>(ConvertUnitDouble(page_size.height(),
|
||||
kPointsPerInch, dpi)));
|
||||
}
|
||||
|
||||
if (content_area_in_dpi) {
|
||||
|
@ -150,8 +143,7 @@ void PrintWebViewHelper::PrintPageInternal(
|
|||
gfx::Rect(0, 0, page_size_in_dpi->width(), page_size_in_dpi->height());
|
||||
}
|
||||
|
||||
gfx::Rect canvas_area =
|
||||
content_area;
|
||||
gfx::Rect canvas_area = content_area;
|
||||
#if 0
|
||||
params.params.display_header_footer ? gfx::Rect(page_size) : content_area;
|
||||
#endif
|
||||
|
@ -180,12 +172,9 @@ void PrintWebViewHelper::PrintPageInternal(
|
|||
}
|
||||
#endif
|
||||
|
||||
float webkit_scale_factor = RenderPageContent(frame,
|
||||
params.page_number,
|
||||
canvas_area,
|
||||
content_area,
|
||||
scale_factor,
|
||||
canvas);
|
||||
float webkit_scale_factor =
|
||||
RenderPageContent(frame, params.page_number, canvas_area, content_area,
|
||||
scale_factor, canvas);
|
||||
DCHECK_GT(webkit_scale_factor, 0.0f);
|
||||
// Done printing. Close the device context to retrieve the compiled metafile.
|
||||
if (!metafile->FinishPage())
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebVector.h"
|
||||
|
||||
using content::RenderThread;
|
||||
using blink::WebSpeechSynthesizerClient;
|
||||
using blink::WebSpeechSynthesisUtterance;
|
||||
using blink::WebSpeechSynthesisVoice;
|
||||
using blink::WebSpeechSynthesizerClient;
|
||||
using blink::WebString;
|
||||
using blink::WebVector;
|
||||
using content::RenderThread;
|
||||
|
||||
int TtsDispatcher::next_utterance_id_ = 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue