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

Unified Diff: content/browser/host_zoom_map.cc

Issue 6901084: Use new APIs in base/values.h: Value::GetAsNumber and DictionaryValue::GetNumber. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 8 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: content/browser/host_zoom_map.cc
diff --git a/content/browser/host_zoom_map.cc b/content/browser/host_zoom_map.cc
index 3d504034e3f9c513740bd8890e251e7a769164f0..0fedfb34e5f6951630d12a9aa884f4be3e464e73 100644
--- a/content/browser/host_zoom_map.cc
+++ b/content/browser/host_zoom_map.cc
@@ -62,25 +62,25 @@ void HostZoomMap::Load() {
const std::string& host(*i);
double zoom_level = 0;
- bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion(
- host, &zoom_level);
- if (!success) {
- // The data used to be stored as ints, so try that.
- int int_zoom_level;
- success = host_zoom_dictionary->GetIntegerWithoutPathExpansion(
- host, &int_zoom_level);
- if (success) {
- zoom_level = static_cast<double>(int_zoom_level);
- // Since the values were once stored as non-clamped, clamp now.
- double zoom_factor = WebView::zoomLevelToZoomFactor(zoom_level);
- if (zoom_factor < WebView::minTextSizeMultiplier) {
- zoom_level =
- WebView::zoomFactorToZoomLevel(WebView::minTextSizeMultiplier);
- } else if (zoom_factor > WebView::maxTextSizeMultiplier) {
- zoom_level =
- WebView::zoomFactorToZoomLevel(WebView::maxTextSizeMultiplier);
- }
+ // The data used to be stored as ints, so try that first. Note that
+ // GetDoubleWithoutPathExpansion supports both Integer and Double values.
+ int int_zoom_level;
+ bool success = host_zoom_dictionary->GetIntegerWithoutPathExpansion(
+ host, &int_zoom_level);
+ if (success) {
+ zoom_level = static_cast<double>(int_zoom_level);
+ // Since the values were once stored as non-clamped, clamp now.
+ double zoom_factor = WebView::zoomLevelToZoomFactor(zoom_level);
+ if (zoom_factor < WebView::minTextSizeMultiplier) {
+ zoom_level =
+ WebView::zoomFactorToZoomLevel(WebView::minTextSizeMultiplier);
+ } else if (zoom_factor > WebView::maxTextSizeMultiplier) {
+ zoom_level =
+ WebView::zoomFactorToZoomLevel(WebView::maxTextSizeMultiplier);
}
+ } else {
+ success = host_zoom_dictionary->GetDoubleWithoutPathExpansion(
jam 2011/05/02 16:17:04 why not only call GetDoubleWithoutPathExpansion?
Yusuke Sato 2011/05/04 14:10:10 Done. Removed the old code.
+ host, &zoom_level);
}
DCHECK(success);
host_zoom_levels_[host] = zoom_level;
« chrome/browser/themes/browser_theme_pack.cc ('K') | « chrome/test/webdriver/cookie.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698