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

Unified Diff: components/dom_distiller/content/browser/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: fix for rebasing 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/browser/dom_distiller_viewer_source.cc
diff --git a/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc b/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc
index 85264ed23343d101e82a6c3cc82b6cb9c3e3f09f..5c9e6faeb856f005631e405f7ddc13c88fe0b82b 100644
--- a/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc
+++ b/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc
@@ -4,7 +4,6 @@
#include "components/dom_distiller/content/browser/dom_distiller_viewer_source.h"
-#include <sstream>
#include <string>
#include <vector>
@@ -12,6 +11,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/user_metrics.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/dom_distiller/content/browser/distiller_javascript_utils.h"
#include "components/dom_distiller/content/browser/external_feedback_reporter.h"
@@ -167,6 +168,8 @@ void DomDistillerViewerSource::RequestViewerHandle::DidFinishLoad(
return;
}
waiting_for_page_ready_ = false;
+ SendJavaScript(viewer::GetDistilledPageFontScalingJs(
+ distilled_page_prefs_->GetFontScaling()));
if (buffer_.empty()) {
return;
}
@@ -225,6 +228,14 @@ void DomDistillerViewerSource::StartDataRequest(
FeedbackReporter::ReportQuality(true);
callback.Run(NULL);
return;
+ } else if (base::StartsWith(path, kViewerSaveFontScalingPath,
+ base::CompareCase::SENSITIVE)) {
+ double scale = 1.0;
+ base::StringToDouble(
nyquist 2015/08/11 06:27:56 Should we do something if base::StringToDouble ret
wychen 2015/08/31 21:47:39 Done.
+ path.substr(strlen(kViewerSaveFontScalingPath)), &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