| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 blink::WebRemoteFrame::create(state_.tree_scope, this); | 643 blink::WebRemoteFrame::create(state_.tree_scope, this); |
| 644 remote_frame->initializeFromFrame(web_frame_->toWebLocalFrame()); | 644 remote_frame->initializeFromFrame(web_frame_->toWebLocalFrame()); |
| 645 // swap() ends up calling us back and we then close the frame, which deletes | 645 // swap() ends up calling us back and we then close the frame, which deletes |
| 646 // it. | 646 // it. |
| 647 web_frame_->swap(remote_frame); | 647 web_frame_->swap(remote_frame); |
| 648 if (owned_window_) { | 648 if (owned_window_) { |
| 649 surface_layer_ = | 649 surface_layer_ = |
| 650 cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), | 650 cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), |
| 651 base::Bind(&SatisfyCallback), | 651 base::Bind(&SatisfyCallback), |
| 652 base::Bind(&RequireCallback)); | 652 base::Bind(&RequireCallback)); |
| 653 surface_layer_->SetSurfaceId(cc::SurfaceId(owned_window_->window()->id()), | 653 surface_layer_->SetSurfaceId( |
| 654 global_state()->device_pixel_ratio(), | 654 cc::SurfaceId::FromUnsafeValue(owned_window_->window()->id()), |
| 655 owned_window_->window()->bounds().size()); | 655 global_state()->device_pixel_ratio(), |
| 656 owned_window_->window()->bounds().size()); |
| 656 | 657 |
| 657 web_layer_.reset(new cc_blink::WebLayerImpl(surface_layer_)); | 658 web_layer_.reset(new cc_blink::WebLayerImpl(surface_layer_)); |
| 658 } | 659 } |
| 659 remote_frame->setRemoteWebLayer(web_layer_.get()); | 660 remote_frame->setRemoteWebLayer(web_layer_.get()); |
| 660 remote_frame->setReplicatedName(state_.name); | 661 remote_frame->setReplicatedName(state_.name); |
| 661 remote_frame->setReplicatedOrigin(state_.origin); | 662 remote_frame->setReplicatedOrigin(state_.origin); |
| 662 remote_frame->setReplicatedSandboxFlags(state_.sandbox_flags); | 663 remote_frame->setReplicatedSandboxFlags(state_.sandbox_flags); |
| 663 | 664 |
| 664 // Tell the frame that it is actually loading. This prevents its parent | 665 // Tell the frame that it is actually loading. This prevents its parent |
| 665 // from prematurely dispatching load event. | 666 // from prematurely dispatching load event. |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 | 1038 |
| 1038 const gfx::Rect rect_in_dip(frame_rect.x, frame_rect.y, frame_rect.width, | 1039 const gfx::Rect rect_in_dip(frame_rect.x, frame_rect.y, frame_rect.width, |
| 1039 frame_rect.height); | 1040 frame_rect.height); |
| 1040 const gfx::Rect rect_in_pixels(gfx::ConvertRectToPixel( | 1041 const gfx::Rect rect_in_pixels(gfx::ConvertRectToPixel( |
| 1041 global_state()->device_pixel_ratio(), rect_in_dip)); | 1042 global_state()->device_pixel_ratio(), rect_in_dip)); |
| 1042 owned_window_->window()->SetBounds(rect_in_pixels); | 1043 owned_window_->window()->SetBounds(rect_in_pixels); |
| 1043 | 1044 |
| 1044 if (!surface_layer_) | 1045 if (!surface_layer_) |
| 1045 return; | 1046 return; |
| 1046 | 1047 |
| 1047 surface_layer_->SetSurfaceId(cc::SurfaceId(owned_window_->window()->id()), | 1048 surface_layer_->SetSurfaceId( |
| 1048 global_state()->device_pixel_ratio(), | 1049 cc::SurfaceId::FromUnsafeValue(owned_window_->window()->id()), |
| 1049 owned_window_->window()->bounds().size()); | 1050 global_state()->device_pixel_ratio(), |
| 1051 owned_window_->window()->bounds().size()); |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 } // namespace mojo | 1054 } // namespace mojo |
| OLD | NEW |