Commit bdf7bc8e authored by Travis Skare's avatar Travis Skare Committed by Commit Bot

[QR Generator] Use generated image for downloads.

Change-Id: Iac5cbeb49c3de10f9bb77a6d02abc7be50eaebc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2163574Reviewed-by: default avatarKristi Park <kristipark@chromium.org>
Commit-Queue: Travis Skare <skare@chromium.org>
Cr-Commit-Position: refs/heads/master@{#763539}
parent e80b928d
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/theme_provider.h" #include "ui/base/theme_provider.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/gfx/codec/png_codec.h" #include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image_skia_source.h" #include "ui/gfx/image/image_skia_source.h"
...@@ -301,14 +302,12 @@ void QRCodeGeneratorBubble::ButtonPressed(views::Button* sender, ...@@ -301,14 +302,12 @@ void QRCodeGeneratorBubble::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
DCHECK_EQ(sender, download_button_); DCHECK_EQ(sender, download_button_);
if (sender == download_button_) { if (sender == download_button_) {
// This will be replaced by data from a QR encoder service. const gfx::ImageSkia& image_ref = qr_code_image_->GetImage();
// This placeholder is a 50x50 png, solid black, generated in devtools. // Returns closest scaling to parameter (1.0).
const GURL data_url = GURL( // Should be exact since we generated the bitmap.
"data:image/png;base64," const gfx::ImageSkiaRep& image_rep = image_ref.GetRepresentation(1.0f);
"iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAk0lEQVRoQ+3SwQnAMBDEwH" const SkBitmap& bitmap = image_rep.GetBitmap();
"X/RSc9CATGKP9bsCZn27cHvtNDLlNM5DKQJZKIVKBfSwqLZxPB6aTDRKSweDYRnE46TEQK" const GURL data_url = GURL(webui::GetBitmapDataUrl(bitmap));
"i2cTwemkw0SksHg2EZxOOkxECotnE8HppMNEpLB4NhGcTjpMRAqLZxPB6aTDRKSweDYRnE"
"46TEQKi2cTwemkw0SksHg2EZxOOkxECotnf62iMgGLjn9UAAAAAElFTkSuQmCC");
Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
content::DownloadManager* download_manager = content::DownloadManager* download_manager =
......
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