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

Unified Diff: content/browser/host_zoom_level_impl.cc

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

Powered by Google App Engine
This is Rietveld 408576698