Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Side by Side Diff: content/common/swapped_out_messages.cc

Issue 6319001: Support window.opener after a process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/swapped_out_messages.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/common/swapped_out_messages.h"
6
7 #include "content/common/content_client.h"
8 #include "content/common/view_messages.h"
9
10 namespace content {
11
12 bool SwappedOutMessages::CanSendWhileSwappedOut(const IPC::Message* msg) {
13 // We filter out most IPC messages when swapped out. However, some are
14 // important (e.g., ACKs) for keeping the browser and renderer state
15 // consistent in case we later return to the same renderer.
16 switch (msg->type()) {
17 // Handled by RenderWidget.
18 case ViewHostMsg_HandleInputEvent_ACK::ID:
19 case ViewHostMsg_PaintAtSize_ACK::ID:
20 case ViewHostMsg_UpdateRect::ID:
21 // Handled by RenderView.
22 case ViewHostMsg_RenderViewGone::ID:
23 case ViewHostMsg_ShouldClose_ACK::ID:
24 case ViewHostMsg_SwapOut_ACK::ID:
25 case ViewHostMsg_ClosePage_ACK::ID:
26 return true;
27 default:
28 break;
29 }
30
31 // Check with the embedder as well.
32 ContentClient* client = GetContentClient();
33 return client->CanSendWhileSwappedOut(msg);
34 }
35
36 bool SwappedOutMessages::CanHandleWhileSwappedOut(
37 const IPC::Message& msg) {
38 // Any message the renderer is allowed to send while swapped out should
39 // be handled by the browser.
40 if (CanSendWhileSwappedOut(&msg))
41 return true;
42
43 // We drop most other messages that arrive from a swapped out renderer.
44 // However, some are important (e.g., ACKs) for keeping the browser and
45 // renderer state consistent in case we later return to the renderer.
46 switch (msg.type()) {
47 // Sends an ACK.
48 case ViewHostMsg_ShowView::ID:
49 // Sends an ACK.
50 case ViewHostMsg_ShowWidget::ID:
51 // Sends an ACK.
52 case ViewHostMsg_ShowFullscreenWidget::ID:
53 // Updates browser state.
54 case ViewHostMsg_RenderViewReady::ID:
55 // Updates the previous navigation entry.
56 case ViewHostMsg_UpdateState::ID:
57 // Sends an ACK.
58 case ViewHostMsg_UpdateTargetURL::ID:
59 // We allow closing even if we are in the process of swapping out.
60 case ViewHostMsg_Close::ID:
61 // Sends an ACK.
62 case ViewHostMsg_RequestMove::ID:
63 // Suppresses dialog and sends an ACK.
64 case ViewHostMsg_RunJavaScriptMessage::ID:
65 // Suppresses dialog and sends an ACK.
66 case ViewHostMsg_RunBeforeUnloadConfirm::ID:
67 // Sends an ACK.
68 case ViewHostMsg_AccessibilityNotifications::ID:
69 return true;
70 default:
71 break;
72 }
73
74 // Check with the embedder as well.
75 ContentClient* client = GetContentClient();
76 return client->CanHandleWhileSwappedOut(msg);
77 }
78
79 } // namespace content
OLDNEW
« no previous file with comments | « content/common/swapped_out_messages.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698