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

Unified Diff: content/browser/frame_host/cross_process_frame_connector.cc

Issue 299703002: Decouple RVH creation from CrossProcessFrameConnector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update WebContentsImpl::CreateRenderViewForInitialEmptyDocument to pass the proper argument. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/cross_process_frame_connector.cc
diff --git a/content/browser/frame_host/cross_process_frame_connector.cc b/content/browser/frame_host/cross_process_frame_connector.cc
index 0e4033205a778e20177b91afe896a5cd48df8266..438f1f7c9982956e83340bf72cd91c19838d8a3c 100644
--- a/content/browser/frame_host/cross_process_frame_connector.cc
+++ b/content/browser/frame_host/cross_process_frame_connector.cc
@@ -53,9 +53,12 @@ void CrossProcessFrameConnector::set_view(
view_ = view;
- // Attach ourselves to the new view.
- if (view_)
+ // Attach ourselves to the new view and size it appropriately.
+ if (view_) {
view_->set_cross_process_frame_connector(this);
+ SetDeviceScaleFactor(device_scale_factor_);
+ SetSize(child_frame_rect_);
+ }
}
void CrossProcessFrameConnector::RenderProcessGone() {
@@ -123,20 +126,11 @@ void CrossProcessFrameConnector::OnReclaimCompositorResources(
void CrossProcessFrameConnector::OnInitializeChildFrame(gfx::Rect frame_rect,
float scale_factor) {
- if (scale_factor != device_scale_factor_) {
- device_scale_factor_ = scale_factor;
- if (view_) {
- RenderWidgetHostImpl* child_widget =
- RenderWidgetHostImpl::From(view_->GetRenderWidgetHost());
- child_widget->NotifyScreenInfoChanged();
- }
- }
+ if (scale_factor != device_scale_factor_)
+ SetDeviceScaleFactor(scale_factor);
- if (!frame_rect.size().IsEmpty()) {
- child_frame_rect_ = frame_rect;
- if (view_)
- view_->SetSize(frame_rect.size());
- }
+ if (!frame_rect.size().IsEmpty())
+ SetSize(frame_rect);
}
gfx::Rect CrossProcessFrameConnector::ChildFrameRect() {
@@ -175,4 +169,19 @@ void CrossProcessFrameConnector::OnForwardInputEvent(
}
}
+void CrossProcessFrameConnector::SetDeviceScaleFactor(float scale_factor) {
+ device_scale_factor_ = scale_factor;
+ if (view_) {
+ RenderWidgetHostImpl* child_widget =
+ RenderWidgetHostImpl::From(view_->GetRenderWidgetHost());
+ child_widget->NotifyScreenInfoChanged();
+ }
+}
+
+void CrossProcessFrameConnector::SetSize(gfx::Rect frame_rect) {
+ child_frame_rect_ = frame_rect;
+ if (view_)
+ view_->SetSize(frame_rect.size());
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/cross_process_frame_connector.h ('k') | content/browser/frame_host/render_frame_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698