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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/frame_service_impl.h"
6
7 #include "content/browser/host_zoom_map_impl.h"
8 #include "content/public/browser/render_process_host.h"
9 #include "content/public/browser/storage_partition.h"
10 #include "mojo/public/cpp/bindings/binding.h"
11 #include "mojo/public/cpp/bindings/interface_request.h"
12
13 namespace content {
14
15 FrameServiceImpl::FrameServiceImpl(int render_process_id,
16 int routing_id,
17 mojom::FrameServiceRequest request)
18 : binding_(this, std::move(request)),
19 render_process_id_(render_process_id),
20 routing_id_(routing_id) {}
21
22 FrameServiceImpl::~FrameServiceImpl() {}
23
24 // static
25 void FrameServiceImpl::Create(int render_process_id,
26 int routing_id,
27 mojom::FrameServiceRequest request) {
28 new FrameServiceImpl(render_process_id, routing_id, std::move(request));
29 }
30
31 void FrameServiceImpl::GetHostZoomLevel(
32 const GURL& url,
33 const GetHostZoomLevelCallback& callback) {
34 RenderProcessHost* render_process_host =
35 RenderProcessHost::FromID(render_process_id_);
36 double zoom_level = 0.0;
37 if (render_process_host) {
38 const HostZoomMapImpl* host_zoom_map = static_cast<const HostZoomMapImpl*>(
39 render_process_host->GetStoragePartition()->GetHostZoomMap());
40 zoom_level = host_zoom_map->GetZoomLevelForView(url, render_process_id_,
41 routing_id_);
42 }
43 callback.Run(std::move(url), zoom_level);
44 }
45
46 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698