| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
| 10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the | 88 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the |
| 89 // first place: http://crbug.com/273089. | 89 // first place: http://crbug.com/273089. |
| 90 // | 90 // |
| 91 // |guest_| is NULL during test. | 91 // |guest_| is NULL during test. |
| 92 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) | 92 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) |
| 93 return; | 93 return; |
| 94 // Make sure the size of this view matches the size of the WebContentsView. | 94 // Make sure the size of this view matches the size of the WebContentsView. |
| 95 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, | 95 // The two sizes may fall out of sync if we switch RenderWidgetHostViews, |
| 96 // resize, and then switch page, as is the case with interstitial pages. | 96 // resize, and then switch page, as is the case with interstitial pages. |
| 97 // NOTE: |guest_| is NULL in unit tests. | 97 // NOTE: |guest_| is NULL in unit tests. |
| 98 if (guest_) | 98 if (guest_) { |
| 99 SetSize(guest_->web_contents()->GetViewBounds().size()); | 99 SetSize(guest_->web_contents()->GetViewBounds().size()); |
| 100 // Since we were last shown, our renderer may have had a different surface |
| 101 // set (e.g. showing an interstitial), so we resend our current surface to |
| 102 // the renderer. |
| 103 if (!surface_id_.is_null()) { |
| 104 cc::SurfaceSequence sequence = cc::SurfaceSequence( |
| 105 id_allocator_->id_namespace(), next_surface_sequence_++); |
| 106 GetSurfaceManager() |
| 107 ->GetSurfaceForId(surface_id_) |
| 108 ->AddDestructionDependency(sequence); |
| 109 guest_->SetChildFrameSurface(surface_id_, current_surface_size_, |
| 110 current_surface_scale_factor_, |
| 111 sequence); |
| 112 } |
| 113 } |
| 100 host_->WasShown(ui::LatencyInfo()); | 114 host_->WasShown(ui::LatencyInfo()); |
| 101 } | 115 } |
| 102 | 116 |
| 103 void RenderWidgetHostViewGuest::Hide() { | 117 void RenderWidgetHostViewGuest::Hide() { |
| 104 // |guest_| is NULL during test. | 118 // |guest_| is NULL during test. |
| 105 if ((guest_ && guest_->is_in_destruction()) || host_->is_hidden()) | 119 if ((guest_ && guest_->is_in_destruction()) || host_->is_hidden()) |
| 106 return; | 120 return; |
| 107 host_->WasHidden(); | 121 host_->WasHidden(); |
| 108 } | 122 } |
| 109 | 123 |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate && | 718 if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate && |
| 705 gesture_event.data.scrollUpdate.inertial) { | 719 gesture_event.data.scrollUpdate.inertial) { |
| 706 return; | 720 return; |
| 707 } | 721 } |
| 708 host_->ForwardGestureEvent(gesture_event); | 722 host_->ForwardGestureEvent(gesture_event); |
| 709 return; | 723 return; |
| 710 } | 724 } |
| 711 } | 725 } |
| 712 | 726 |
| 713 } // namespace content | 727 } // namespace content |
| OLD | NEW |