| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/renderer/aw_render_view_ext.h" | 5 #include "android_webview/renderer/aw_render_view_ext.h" |
| 6 #include "android_webview/common/render_view_messages.h" | 6 #include "android_webview/common/render_view_messages.h" |
| 7 #include "content/public/renderer/render_frame.h" | 7 #include "content/public/renderer/render_frame.h" |
| 8 #include "content/public/renderer/render_view.h" | 8 #include "content/public/renderer/render_view.h" |
| 9 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 9 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 10 #include "third_party/WebKit/public/web/WebView.h" | 10 #include "third_party/WebKit/public/web/WebView.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Even without out-of-process iframes, we now create RemoteFrames for the | 49 // Even without out-of-process iframes, we now create RemoteFrames for the |
| 50 // main frame when you navigate cross-process, to create a placeholder in the | 50 // main frame when you navigate cross-process, to create a placeholder in the |
| 51 // old process. This is necessary to support things like postMessage across | 51 // old process. This is necessary to support things like postMessage across |
| 52 // windows that have references to each other. The RemoteFrame will | 52 // windows that have references to each other. The RemoteFrame will |
| 53 // immediately go away if there aren't any active frames left in the old | 53 // immediately go away if there aren't any active frames left in the old |
| 54 // process. RenderView's main frame pointer will become null in the old | 54 // process. RenderView's main frame pointer will become null in the old |
| 55 // process when it is no longer the active main frame. | 55 // process when it is no longer the active main frame. |
| 56 if (!webview || !main_render_frame) | 56 if (!webview || !main_render_frame) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 gfx::Size contents_size; | 59 gfx::Size contents_size = main_render_frame->GetWebFrame()->ContentsSize(); |
| 60 | |
| 61 blink::WebLocalFrame* main_frame = main_render_frame->GetWebFrame(); | |
| 62 if (main_frame) | |
| 63 contents_size = main_frame->ContentsSize(); | |
| 64 | 60 |
| 65 // Fall back to contentsPreferredMinimumSize if the mainFrame is reporting a | 61 // Fall back to contentsPreferredMinimumSize if the mainFrame is reporting a |
| 66 // 0x0 size (this happens during initial load). | 62 // 0x0 size (this happens during initial load). |
| 67 if (contents_size.IsEmpty()) { | 63 if (contents_size.IsEmpty()) { |
| 68 contents_size = webview->ContentsPreferredMinimumSize(); | 64 contents_size = webview->ContentsPreferredMinimumSize(); |
| 69 } | 65 } |
| 70 | 66 |
| 71 if (contents_size == last_sent_contents_size_) | 67 if (contents_size == last_sent_contents_size_) |
| 72 return; | 68 return; |
| 73 | 69 |
| 74 last_sent_contents_size_ = contents_size; | 70 last_sent_contents_size_ = contents_size; |
| 75 main_render_frame->Send(new AwViewHostMsg_OnContentsSizeChanged( | 71 main_render_frame->Send(new AwViewHostMsg_OnContentsSizeChanged( |
| 76 main_render_frame->GetRoutingID(), contents_size)); | 72 main_render_frame->GetRoutingID(), contents_size)); |
| 77 } | 73 } |
| 78 | 74 |
| 79 } // namespace android_webview | 75 } // namespace android_webview |
| OLD | NEW |