OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sky/shell/ui/engine.h" | 5 #include "sky/shell/ui/engine.h" |
6 | 6 |
7 #include "sky/engine/public/web/Sky.h" | 7 #include "sky/engine/public/web/Sky.h" |
8 #include "sky/engine/public/web/WebLocalFrame.h" | 8 #include "sky/engine/public/web/WebLocalFrame.h" |
9 #include "sky/engine/public/web/WebView.h" | 9 #include "sky/engine/public/web/WebView.h" |
10 #include "sky/shell/ui/platform_impl.h" | 10 #include "sky/shell/ui/platform_impl.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 void Engine::Init() { | 27 void Engine::Init() { |
28 platform_impl_.reset(new PlatformImpl); | 28 platform_impl_.reset(new PlatformImpl); |
29 blink::initialize(platform_impl_.get()); | 29 blink::initialize(platform_impl_.get()); |
30 | 30 |
31 web_view_ = blink::WebView::create(this); | 31 web_view_ = blink::WebView::create(this); |
32 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); | 32 web_view_->setMainFrame(blink::WebLocalFrame::create(this)); |
33 } | 33 } |
34 | 34 |
| 35 void Engine::OnViewportMetricsChanged(const gfx::Size& size, |
| 36 float device_pixel_ratio) { |
| 37 blink::WebSize web_size(size.width() / device_pixel_ratio, |
| 38 size.height() / device_pixel_ratio); |
| 39 web_view_->setDeviceScaleFactor(device_pixel_ratio); |
| 40 web_view_->resize(web_size); |
| 41 } |
| 42 |
35 } // namespace shell | 43 } // namespace shell |
36 } // namespace sky | 44 } // namespace sky |
OLD | NEW |