Index: content/browser/frame_service_impl.cc |
diff --git a/content/browser/frame_service_impl.cc b/content/browser/frame_service_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e7a7a1702eee2cc6e3f623342c310f8adc7acef5 |
--- /dev/null |
+++ b/content/browser/frame_service_impl.cc |
@@ -0,0 +1,46 @@ |
+// 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/frame_service_impl.h" |
+ |
+#include "content/browser/host_zoom_map_impl.h" |
+#include "content/public/browser/render_process_host.h" |
+#include "content/public/browser/storage_partition.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "mojo/public/cpp/bindings/interface_request.h" |
+ |
+namespace content { |
+ |
+FrameServiceImpl::FrameServiceImpl(int render_process_id, |
+ int routing_id, |
+ mojom::FrameServiceRequest request) |
+ : binding_(this, std::move(request)), |
+ render_process_id_(render_process_id), |
+ routing_id_(routing_id) {} |
+ |
+FrameServiceImpl::~FrameServiceImpl() {} |
+ |
+// static |
+void FrameServiceImpl::Create(int render_process_id, |
+ int routing_id, |
+ mojom::FrameServiceRequest request) { |
+ new FrameServiceImpl(render_process_id, routing_id, std::move(request)); |
+} |
+ |
+void FrameServiceImpl::GetHostZoomLevel( |
+ const GURL& url, |
+ const GetHostZoomLevelCallback& callback) { |
+ RenderProcessHost* render_process_host = |
+ RenderProcessHost::FromID(render_process_id_); |
+ double zoom_level = 0.0; |
+ if (render_process_host) { |
+ const HostZoomMapImpl* host_zoom_map = static_cast<const HostZoomMapImpl*>( |
+ render_process_host->GetStoragePartition()->GetHostZoomMap()); |
+ zoom_level = host_zoom_map->GetZoomLevelForView(url, render_process_id_, |
+ routing_id_); |
+ } |
+ callback.Run(std::move(url), zoom_level); |
+} |
+ |
+} // namespace content |