| 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/WebFrame.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" |
| 11 | 11 |
| 12 namespace android_webview { | 12 namespace android_webview { |
| 13 | 13 |
| 14 AwRenderViewExt::AwRenderViewExt(content::RenderView* render_view) | 14 AwRenderViewExt::AwRenderViewExt(content::RenderView* render_view) |
| 15 : content::RenderViewObserver(render_view) {} | 15 : content::RenderViewObserver(render_view) {} |
| 16 | 16 |
| 17 AwRenderViewExt::~AwRenderViewExt() {} | 17 AwRenderViewExt::~AwRenderViewExt() {} |
| 18 | 18 |
| 19 // static | 19 // static |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; |
| 60 | 60 |
| 61 blink::WebFrame* main_frame = webview->MainFrame(); | 61 blink::WebLocalFrame* main_frame = main_render_frame->GetWebFrame(); |
| 62 if (main_frame) | 62 if (main_frame) |
| 63 contents_size = main_frame->ContentsSize(); | 63 contents_size = main_frame->ContentsSize(); |
| 64 | 64 |
| 65 // Fall back to contentsPreferredMinimumSize if the mainFrame is reporting a | 65 // Fall back to contentsPreferredMinimumSize if the mainFrame is reporting a |
| 66 // 0x0 size (this happens during initial load). | 66 // 0x0 size (this happens during initial load). |
| 67 if (contents_size.IsEmpty()) { | 67 if (contents_size.IsEmpty()) { |
| 68 contents_size = webview->ContentsPreferredMinimumSize(); | 68 contents_size = webview->ContentsPreferredMinimumSize(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (contents_size == last_sent_contents_size_) | 71 if (contents_size == last_sent_contents_size_) |
| 72 return; | 72 return; |
| 73 | 73 |
| 74 last_sent_contents_size_ = contents_size; | 74 last_sent_contents_size_ = contents_size; |
| 75 main_render_frame->Send(new AwViewHostMsg_OnContentsSizeChanged( | 75 main_render_frame->Send(new AwViewHostMsg_OnContentsSizeChanged( |
| 76 main_render_frame->GetRoutingID(), contents_size)); | 76 main_render_frame->GetRoutingID(), contents_size)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace android_webview | 79 } // namespace android_webview |
| OLD | NEW |