| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 while ((observer = it.GetNext()) != NULL) { | 733 while ((observer = it.GetNext()) != NULL) { |
| 734 if (observer->OnMessageReceived(msg)) | 734 if (observer->OnMessageReceived(msg)) |
| 735 return true; | 735 return true; |
| 736 } | 736 } |
| 737 | 737 |
| 738 bool handled = true; | 738 bool handled = true; |
| 739 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) | 739 IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) |
| 740 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) | 740 IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate) |
| 741 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) | 741 IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) |
| 742 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) | 742 IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) |
| 743 IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) |
| 743 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) | 744 IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) |
| 744 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, | 745 IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, |
| 745 OnCustomContextMenuAction) | 746 OnCustomContextMenuAction) |
| 746 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) | 747 IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) |
| 747 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) | 748 IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) |
| 748 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) | 749 IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) |
| 749 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) | 750 IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) |
| 750 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) | 751 IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) |
| 751 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) | 752 IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) |
| 752 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) | 753 IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 if (!frame_->parent()) | 1022 if (!frame_->parent()) |
| 1022 render_view_->SetSwappedOut(true); | 1023 render_view_->SetSwappedOut(true); |
| 1023 is_swapped_out_ = true; | 1024 is_swapped_out_ = true; |
| 1024 | 1025 |
| 1025 // Now that we're swapped out and filtering IPC messages, stop loading to | 1026 // Now that we're swapped out and filtering IPC messages, stop loading to |
| 1026 // ensure that no other in-progress navigation continues. We do this here | 1027 // ensure that no other in-progress navigation continues. We do this here |
| 1027 // to avoid sending a DidStopLoading message to the browser process. | 1028 // to avoid sending a DidStopLoading message to the browser process. |
| 1028 // TODO(creis): Should we be stopping all frames here and using | 1029 // TODO(creis): Should we be stopping all frames here and using |
| 1029 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this | 1030 // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this |
| 1030 // frame? | 1031 // frame? |
| 1031 if (!frame_->parent()) | 1032 OnStop(); |
| 1032 render_view_->OnStop(); | |
| 1033 else | |
| 1034 frame_->stopLoading(); | |
| 1035 | 1033 |
| 1036 // Let subframes know that the frame is now rendered remotely, for the | 1034 // Let subframes know that the frame is now rendered remotely, for the |
| 1037 // purposes of compositing and input events. | 1035 // purposes of compositing and input events. |
| 1038 if (frame_->parent()) | 1036 if (frame_->parent()) |
| 1039 frame_->setIsRemote(true); | 1037 frame_->setIsRemote(true); |
| 1040 | 1038 |
| 1041 // Replace the page with a blank dummy URL. The unload handler will not be | 1039 // Replace the page with a blank dummy URL. The unload handler will not be |
| 1042 // run a second time, thanks to a check in FrameLoader::stopLoading. | 1040 // run a second time, thanks to a check in FrameLoader::stopLoading. |
| 1043 // TODO(creis): Need to add a better way to do this that avoids running the | 1041 // TODO(creis): Need to add a better way to do this that avoids running the |
| 1044 // beforeunload handler. For now, we just run it a second time silently. | 1042 // beforeunload handler. For now, we just run it a second time silently. |
| (...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3049 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) { | 3047 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) { |
| 3050 observers_.AddObserver(observer); | 3048 observers_.AddObserver(observer); |
| 3051 } | 3049 } |
| 3052 | 3050 |
| 3053 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) { | 3051 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) { |
| 3054 observer->RenderFrameGone(); | 3052 observer->RenderFrameGone(); |
| 3055 observers_.RemoveObserver(observer); | 3053 observers_.RemoveObserver(observer); |
| 3056 } | 3054 } |
| 3057 | 3055 |
| 3058 void RenderFrameImpl::OnStop() { | 3056 void RenderFrameImpl::OnStop() { |
| 3057 DCHECK(frame_); |
| 3058 frame_->stopLoading(); |
| 3059 if (!frame_->parent()) |
| 3060 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, OnStop()); |
| 3061 |
| 3059 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); | 3062 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); |
| 3060 } | 3063 } |
| 3061 | 3064 |
| 3062 void RenderFrameImpl::WasHidden() { | 3065 void RenderFrameImpl::WasHidden() { |
| 3063 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasHidden()); | 3066 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasHidden()); |
| 3064 } | 3067 } |
| 3065 | 3068 |
| 3066 void RenderFrameImpl::WasShown() { | 3069 void RenderFrameImpl::WasShown() { |
| 3067 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown()); | 3070 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, WasShown()); |
| 3068 } | 3071 } |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3719 | 3722 |
| 3720 #if defined(ENABLE_BROWSER_CDMS) | 3723 #if defined(ENABLE_BROWSER_CDMS) |
| 3721 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3724 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
| 3722 if (!cdm_manager_) | 3725 if (!cdm_manager_) |
| 3723 cdm_manager_ = new RendererCdmManager(this); | 3726 cdm_manager_ = new RendererCdmManager(this); |
| 3724 return cdm_manager_; | 3727 return cdm_manager_; |
| 3725 } | 3728 } |
| 3726 #endif // defined(ENABLE_BROWSER_CDMS) | 3729 #endif // defined(ENABLE_BROWSER_CDMS) |
| 3727 | 3730 |
| 3728 } // namespace content | 3731 } // namespace content |
| OLD | NEW |