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

Unified Diff: content/browser/frame_service_impl.cc

Issue 1964273002: Add FrameHost mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing files Created 4 years, 7 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/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

Powered by Google App Engine
This is Rietveld 408576698