| 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 "components/html_viewer/html_frame.h" | 5 #include "components/html_viewer/html_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 blink::WebRemoteFrame::create(state_.tree_scope, this); | 634 blink::WebRemoteFrame::create(state_.tree_scope, this); |
| 635 remote_frame->initializeFromFrame(web_frame_->toWebLocalFrame()); | 635 remote_frame->initializeFromFrame(web_frame_->toWebLocalFrame()); |
| 636 // swap() ends up calling us back and we then close the frame, which deletes | 636 // swap() ends up calling us back and we then close the frame, which deletes |
| 637 // it. | 637 // it. |
| 638 web_frame_->swap(remote_frame); | 638 web_frame_->swap(remote_frame); |
| 639 if (owned_window_) { | 639 if (owned_window_) { |
| 640 surface_layer_ = | 640 surface_layer_ = |
| 641 cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), | 641 cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), |
| 642 base::Bind(&SatisfyCallback), | 642 base::Bind(&SatisfyCallback), |
| 643 base::Bind(&RequireCallback)); | 643 base::Bind(&RequireCallback)); |
| 644 surface_layer_->SetSurfaceId(cc::SurfaceId(owned_window_->window()->id()), | 644 surface_layer_->SetSurfaceId( |
| 645 global_state()->device_pixel_ratio(), | 645 cc::SurfaceId::FromUnsafeValue(owned_window_->window()->id()), |
| 646 owned_window_->window()->bounds().size()); | 646 global_state()->device_pixel_ratio(), |
| 647 owned_window_->window()->bounds().size()); |
| 647 | 648 |
| 648 web_layer_.reset(new cc_blink::WebLayerImpl(surface_layer_)); | 649 web_layer_.reset(new cc_blink::WebLayerImpl(surface_layer_)); |
| 649 } | 650 } |
| 650 remote_frame->setRemoteWebLayer(web_layer_.get()); | 651 remote_frame->setRemoteWebLayer(web_layer_.get()); |
| 651 remote_frame->setReplicatedName(state_.name); | 652 remote_frame->setReplicatedName(state_.name); |
| 652 remote_frame->setReplicatedOrigin(state_.origin); | 653 remote_frame->setReplicatedOrigin(state_.origin); |
| 653 remote_frame->setReplicatedSandboxFlags(state_.sandbox_flags); | 654 remote_frame->setReplicatedSandboxFlags(state_.sandbox_flags); |
| 654 | 655 |
| 655 // Tell the frame that it is actually loading. This prevents its parent | 656 // Tell the frame that it is actually loading. This prevents its parent |
| 656 // from prematurely dispatching load event. | 657 // from prematurely dispatching load event. |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 | 1025 |
| 1025 const gfx::Rect rect_in_dip(frame_rect.x, frame_rect.y, frame_rect.width, | 1026 const gfx::Rect rect_in_dip(frame_rect.x, frame_rect.y, frame_rect.width, |
| 1026 frame_rect.height); | 1027 frame_rect.height); |
| 1027 const gfx::Rect rect_in_pixels(gfx::ConvertRectToPixel( | 1028 const gfx::Rect rect_in_pixels(gfx::ConvertRectToPixel( |
| 1028 global_state()->device_pixel_ratio(), rect_in_dip)); | 1029 global_state()->device_pixel_ratio(), rect_in_dip)); |
| 1029 owned_window_->window()->SetBounds(rect_in_pixels); | 1030 owned_window_->window()->SetBounds(rect_in_pixels); |
| 1030 | 1031 |
| 1031 if (!surface_layer_) | 1032 if (!surface_layer_) |
| 1032 return; | 1033 return; |
| 1033 | 1034 |
| 1034 surface_layer_->SetSurfaceId(cc::SurfaceId(owned_window_->window()->id()), | 1035 surface_layer_->SetSurfaceId( |
| 1035 global_state()->device_pixel_ratio(), | 1036 cc::SurfaceId::FromUnsafeValue(owned_window_->window()->id()), |
| 1036 owned_window_->window()->bounds().size()); | 1037 global_state()->device_pixel_ratio(), |
| 1038 owned_window_->window()->bounds().size()); |
| 1037 } | 1039 } |
| 1038 | 1040 |
| 1039 } // namespace mojo | 1041 } // namespace mojo |
| OLD | NEW |