OLD | NEW |
(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/host_zoom_level_impl.h" |
| 6 |
| 7 #include "content/browser/host_zoom_map_impl.h" |
| 8 #include "content/public/browser/browser_context.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 HostZoomLevelImpl::HostZoomLevelImpl(BrowserContext* context, |
| 15 int render_process_id, |
| 16 mojom::HostZoomLevelRequest request) |
| 17 : binding_(this, std::move(request)), |
| 18 context_(context), |
| 19 render_process_id_(render_process_id) {} |
| 20 |
| 21 HostZoomLevelImpl::~HostZoomLevelImpl() {} |
| 22 |
| 23 // static |
| 24 void HostZoomLevelImpl::Create(content::BrowserContext* context, |
| 25 int render_process_id, |
| 26 mojom::HostZoomLevelRequest request) { |
| 27 new HostZoomLevelImpl(context, render_process_id, std::move(request)); |
| 28 } |
| 29 |
| 30 void HostZoomLevelImpl::GetZoomLevel(const GURL& url, |
| 31 int32_t render_view_id, |
| 32 const GetZoomLevelCallback& callback) { |
| 33 const HostZoomMapImpl* host_zoom_map = static_cast<const HostZoomMapImpl*>( |
| 34 HostZoomMap::GetDefaultForBrowserContext(context_)); |
| 35 double zoom_level = host_zoom_map->GetZoomLevelForView( |
| 36 url, render_process_id_, render_view_id); |
| 37 callback.Run(std::move(url), zoom_level); |
| 38 } |
| 39 |
| 40 } // namespace content |
OLD | NEW |