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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
991 IPC_MESSAGE_HANDLER( | 991 IPC_MESSAGE_HANDLER( |
992 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, | 992 ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks, |
993 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) | 993 OnGetSerializedHtmlDataForCurrentPageWithLocalLinks) |
994 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) | 994 IPC_MESSAGE_HANDLER(ViewMsg_ContextMenuClosed, OnContextMenuClosed) |
995 // TODO(viettrungluu): Move to a separate message filter. | 995 // TODO(viettrungluu): Move to a separate message filter. |
996 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 996 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
997 OnSetHistoryLengthAndPrune) | 997 OnSetHistoryLengthAndPrune) |
998 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 998 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
999 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 999 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
1000 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) | 1000 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) |
1001 IPC_MESSAGE_HANDLER(ViewMsg_DisownOpener, OnDisownOpener) | |
1001 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) | 1002 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) |
1002 #if defined(OS_ANDROID) | 1003 #if defined(OS_ANDROID) |
1003 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, | 1004 IPC_MESSAGE_HANDLER(ViewMsg_ActivateNearestFindResult, |
1004 OnActivateNearestFindResult) | 1005 OnActivateNearestFindResult) |
1005 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) | 1006 IPC_MESSAGE_HANDLER(ViewMsg_FindMatchRects, OnFindMatchRects) |
1006 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1007 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
1007 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewMsg_SynchronousFind, OnSynchronousFind) | 1008 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewMsg_SynchronousFind, OnSynchronousFind) |
1008 IPC_MESSAGE_HANDLER(ViewMsg_UndoScrollFocusedEditableNodeIntoView, | 1009 IPC_MESSAGE_HANDLER(ViewMsg_UndoScrollFocusedEditableNodeIntoView, |
1009 OnUndoScrollFocusedEditableNodeIntoRect) | 1010 OnUndoScrollFocusedEditableNodeIntoRect) |
1010 #elif defined(OS_MACOSX) | 1011 #elif defined(OS_MACOSX) |
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2619 | 2620 |
2620 WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) { | 2621 WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) { |
2621 return &cookie_jar_; | 2622 return &cookie_jar_; |
2622 } | 2623 } |
2623 | 2624 |
2624 void RenderViewImpl::didCreateFrame(WebFrame* parent, WebFrame* child) { | 2625 void RenderViewImpl::didCreateFrame(WebFrame* parent, WebFrame* child) { |
2625 if (!updating_frame_tree_) | 2626 if (!updating_frame_tree_) |
2626 SendUpdatedFrameTree(NULL); | 2627 SendUpdatedFrameTree(NULL); |
2627 } | 2628 } |
2628 | 2629 |
2630 void RenderViewImpl::didDisownOpener(WebKit::WebFrame* frame) { | |
2631 // We should only hear this from the top-level frame, because subframes do not | |
2632 // have openers. | |
2633 CHECK_EQ(webview()->mainFrame(), frame); | |
darin (slow to review)
2012/12/05 06:06:59
nit: slightly more compact check would be CHECK(!f
Charlie Reis
2012/12/05 19:44:51
Done.
| |
2634 | |
2635 // We only need to notify the browser if the active frame clears its opener. | |
2636 // We can ignore cases where a swapped out frame clears its opener after | |
2637 // hearing about it from the browser. | |
2638 if (is_swapped_out_) | |
2639 return; | |
2640 | |
2641 // Notify WebContents and all its swapped out RenderViews. | |
2642 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); | |
2643 } | |
2644 | |
2629 void RenderViewImpl::frameDetached(WebFrame* frame) { | 2645 void RenderViewImpl::frameDetached(WebFrame* frame) { |
2630 if (is_loading_) { | 2646 if (is_loading_) { |
2631 pending_frame_tree_update_ = true; | 2647 pending_frame_tree_update_ = true; |
2632 // Make sure observers are notified, even if we return right away. | 2648 // Make sure observers are notified, even if we return right away. |
2633 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); | 2649 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); |
2634 return; | 2650 return; |
2635 } | 2651 } |
2636 if (!updating_frame_tree_) | 2652 if (!updating_frame_tree_) |
2637 SendUpdatedFrameTree(frame); | 2653 SendUpdatedFrameTree(frame); |
2638 | 2654 |
(...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6356 return !!RenderThreadImpl::current()->compositor_thread(); | 6372 return !!RenderThreadImpl::current()->compositor_thread(); |
6357 } | 6373 } |
6358 | 6374 |
6359 void RenderViewImpl::OnJavaBridgeInit() { | 6375 void RenderViewImpl::OnJavaBridgeInit() { |
6360 DCHECK(!java_bridge_dispatcher_); | 6376 DCHECK(!java_bridge_dispatcher_); |
6361 #if defined(ENABLE_JAVA_BRIDGE) | 6377 #if defined(ENABLE_JAVA_BRIDGE) |
6362 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 6378 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
6363 #endif | 6379 #endif |
6364 } | 6380 } |
6365 | 6381 |
6382 void RenderViewImpl::OnDisownOpener() { | |
6383 if (webview() && webview()->mainFrame() && webview()->mainFrame()->opener()) | |
darin (slow to review)
2012/12/05 06:06:59
nit: since webview()->mainFrame() is virtual, it m
Charlie Reis
2012/12/05 19:44:51
Done.
| |
6384 webview()->mainFrame()->setOpener(NULL); | |
6385 } | |
6386 | |
6366 void RenderViewImpl::OnUpdatedFrameTree( | 6387 void RenderViewImpl::OnUpdatedFrameTree( |
6367 int process_id, | 6388 int process_id, |
6368 int route_id, | 6389 int route_id, |
6369 const std::string& frame_tree) { | 6390 const std::string& frame_tree) { |
6370 // TODO(nasko): Remove once http://crbug.com/153701 is fixed. | 6391 // TODO(nasko): Remove once http://crbug.com/153701 is fixed. |
6371 DCHECK(false); | 6392 DCHECK(false); |
6372 // We should only act on this message if we are swapped out. It's possible | 6393 // We should only act on this message if we are swapped out. It's possible |
6373 // for this to happen due to races. | 6394 // for this to happen due to races. |
6374 if (!is_swapped_out_) | 6395 if (!is_swapped_out_) |
6375 return; | 6396 return; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6427 } | 6448 } |
6428 #endif | 6449 #endif |
6429 | 6450 |
6430 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6451 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
6431 TransportDIB::Handle dib_handle) { | 6452 TransportDIB::Handle dib_handle) { |
6432 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6453 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6433 RenderProcess::current()->ReleaseTransportDIB(dib); | 6454 RenderProcess::current()->ReleaseTransportDIB(dib); |
6434 } | 6455 } |
6435 | 6456 |
6436 } // namespace content | 6457 } // namespace content |
OLD | NEW |