summaryrefslogtreecommitdiff
path: root/chromium/components/zoom/page_zoom_constants.cc
blob: 9eeb1ba96a65cf16677d45f447e470bb67fcb0fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2015 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/zoom/page_zoom_constants.h"

#include "base/json/json_writer.h"
#include "base/stl_util.h"
#include "base/values.h"

namespace zoom {

const double kPresetZoomFactors[] = {0.25, 1 / 3.0, 0.5, 2 / 3.0, 0.75, 0.8,
                                     0.9, 1.0, 1.1, 1.25, 1.5, 1.75, 2.0, 2.5,
                                     3.0, 4.0, 5.0};
const std::size_t kPresetZoomFactorsSize = base::size(kPresetZoomFactors);

std::string GetPresetZoomFactorsAsJSON() {
  base::Value zoom_factors(base::Value::Type::LIST);
  for (double zoom_value : kPresetZoomFactors) {
    zoom_factors.Append(zoom_value);
  }
  std::string zoom_factors_json;
  bool success = base::JSONWriter::Write(zoom_factors, &zoom_factors_json);
  DCHECK(success);
  return zoom_factors_json;
}

}  // namespace zoom