Commit e0912629 authored by Christopher Thompson's avatar Christopher Thompson Committed by Commit Bot

Format print header/footer URLs using url_formatter::FormatUrl

This CL changes the print preview handler to set kSettingHeaderFooterURL
using url_formatter::FormatUrl rather than extracting the GURL::spec()
directly. In particular, this allows safe IDNs to be displayed as
unicode rather than punycode in the header/footer (matching how they are
displayed in the omnibox).

Bug: 910344
Change-Id: Iabed0e1821df29e5c2a5b6fc9953fa6d8cb3e10d
Reviewed-on: https://chromium-review.googlesource.com/c/1356235Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Christopher Thompson <cthomp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612775}
parent c215068a
......@@ -67,6 +67,7 @@
#include "components/signin/core/browser/gaia_cookie_manager_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/url_formatter/url_formatter.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
......@@ -806,7 +807,8 @@ void PrintPreviewHandler::HandleGetPreview(const base::ListValue* args) {
url_sanitizer.ClearPassword();
const GURL& initiator_url = initiator->GetLastCommittedURL();
settings->SetString(printing::kSettingHeaderFooterURL,
initiator_url.ReplaceComponents(url_sanitizer).spec());
url_formatter::FormatUrl(
initiator_url.ReplaceComponents(url_sanitizer)));
}
VLOG(1) << "Print preview request start";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment