Index: content/browser/host_zoom_level_impl.cc |
diff --git a/content/browser/host_zoom_level_impl.cc b/content/browser/host_zoom_level_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0b577189810d143426705a6449c7642b6db2393 |
--- /dev/null |
+++ b/content/browser/host_zoom_level_impl.cc |
@@ -0,0 +1,40 @@ |
+// 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 "content/browser/host_zoom_level_impl.h" |
+ |
+#include "content/browser/host_zoom_map_impl.h" |
+#include "content/public/browser/browser_context.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "mojo/public/cpp/bindings/interface_request.h" |
+ |
+namespace content { |
+ |
+HostZoomLevelImpl::HostZoomLevelImpl(BrowserContext* context, |
+ int render_process_id, |
+ mojom::HostZoomLevelRequest request) |
+ : binding_(this, std::move(request)), |
+ context_(context), |
+ render_process_id_(render_process_id) {} |
+ |
+HostZoomLevelImpl::~HostZoomLevelImpl() {} |
+ |
+// static |
+void HostZoomLevelImpl::Create(content::BrowserContext* context, |
+ int render_process_id, |
+ mojom::HostZoomLevelRequest request) { |
+ new HostZoomLevelImpl(context, render_process_id, std::move(request)); |
+} |
+ |
+void HostZoomLevelImpl::GetZoomLevel(const GURL& url, |
+ int32_t render_view_id, |
+ const GetZoomLevelCallback& callback) { |
+ const HostZoomMapImpl* host_zoom_map = static_cast<const HostZoomMapImpl*>( |
+ HostZoomMap::GetDefaultForBrowserContext(context_)); |
+ double zoom_level = host_zoom_map->GetZoomLevelForView( |
+ url, render_process_id_, render_view_id); |
+ callback.Run(std::move(url), zoom_level); |
+} |
+ |
+} // namespace content |