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

Unified Diff: components/arc/intent_helper/font_size_util.cc

Issue 1843563003: Move arc_intent_helper_bridge.h from c/b/chromeos/ to components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address a comment Created 4 years, 9 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/arc/intent_helper/font_size_util.cc
diff --git a/components/arc/intent_helper/font_size_util.cc b/components/arc/intent_helper/font_size_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ec8acb76cae5dfb15a5d801882a8837ece616ba6
--- /dev/null
+++ b/components/arc/intent_helper/font_size_util.cc
@@ -0,0 +1,34 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/arc/intent_helper/font_size_util.h"
+
+#include <algorithm>
+
+namespace arc {
+
+double ConvertFontSizeChromeToAndroid(int default_size,
+ int default_fixed_size,
+ int minimum_size) {
+ // kWebKitDefaultFixedFontSize is automatically set to be 3 pixels smaller
+ // than kWebKitDefaultFontSize when Chrome's settings page's main font
+ // dropdown control is adjusted. If the user specifically sets a higher
+ // fixed font size we will want to take into account the adjustment.
+ default_fixed_size += 3;
+ int max_chrome_size =
+ std::max(std::max(default_fixed_size, default_size), minimum_size);
+
+ double android_scale = kAndroidFontScaleSmall;
+ if (max_chrome_size >= kChromeFontSizeVeryLarge) {
+ android_scale = kAndroidFontScaleHuge;
+ } else if (max_chrome_size >= kChromeFontSizeLarge) {
+ android_scale = kAndroidFontScaleLarge;
+ } else if (max_chrome_size >= kChromeFontSizeNormal) {
+ android_scale = kAndroidFontScaleNormal;
+ }
+
+ return android_scale;
+}
+
+} // namespace arc
« no previous file with comments | « components/arc/intent_helper/font_size_util.h ('k') | components/arc/intent_helper/font_size_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698