Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Unified Diff: components/dom_distiller/content/dom_distiller_viewer_source.cc

Issue 1225183002: Font size in DomDistiller prefs syncs with local scaling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: keep focus when useFontScaling() is called, add tests Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/content/dom_distiller_viewer_source.cc
diff --git a/components/dom_distiller/content/dom_distiller_viewer_source.cc b/components/dom_distiller/content/dom_distiller_viewer_source.cc
index b6b611cac83ed92551be0e8c9c0ebcb62c2d36b7..914e4f4a774bbb3d13c5201ab8817a238a5c11ca 100644
--- a/components/dom_distiller/content/dom_distiller_viewer_source.cc
+++ b/components/dom_distiller/content/dom_distiller_viewer_source.cc
@@ -12,6 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/user_metrics.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/dom_distiller/core/distilled_page_prefs.h"
#include "components/dom_distiller/core/dom_distiller_request_view_base.h"
@@ -164,6 +165,8 @@ void DomDistillerViewerSource::RequestViewerHandle::DidFinishLoad(
return;
}
waiting_for_page_ready_ = false;
+ SendJavaScript(viewer::GetDistilledPageFontScalingJs(
+ distilled_page_prefs_->GetFontScaling()));
if (buffer_.empty()) {
return;
}
@@ -226,6 +229,14 @@ void DomDistillerViewerSource::StartDataRequest(
FeedbackReporter::ReportQuality(true);
callback.Run(NULL);
return;
+ } else if (base::StartsWithASCII(path, kViewerSaveFontScalingPath, false)) {
+ std::stringstream ss;
+ ss << path.substr(strlen(kViewerSaveFontScalingPath));
cjhopman 2015/07/17 20:28:04 This should probably use base::StringToDouble.
wychen 2015/07/31 21:03:37 Done.
+ float scale;
+ ss >> scale;
+ dom_distiller_service_->GetDistilledPagePrefs()->SetFontScaling(scale);
+ callback.Run(NULL);
+ return;
}
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);

Powered by Google App Engine
This is Rietveld 408576698