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/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
115 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a | 115 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a |
116 // notification that the window is being destroyed. If we don't receive this | 116 // notification that the window is being destroyed. If we don't receive this |
117 // notification and the PluginProcessHost instance is being destroyed, it | 117 // notification and the PluginProcessHost instance is being destroyed, it |
118 // means that the plugin process crashed. We paint a sad face in this case in | 118 // means that the plugin process crashed. We paint a sad face in this case in |
119 // the renderer process. To ensure that the sad face shows up, and we don't | 119 // the renderer process. To ensure that the sad face shows up, and we don't |
120 // leak HWNDs, we should destroy existing plugin parent windows. | 120 // leak HWNDs, we should destroy existing plugin parent windows. |
121 std::set<HWND>::iterator window_index; | 121 std::set<HWND>::iterator window_index; |
122 for (window_index = plugin_parent_windows_set_.begin(); | 122 for (window_index = plugin_parent_windows_set_.begin(); |
123 window_index != plugin_parent_windows_set_.end(); | 123 window_index != plugin_parent_windows_set_.end(); |
124 window_index++) { | 124 ++window_index) { |
125 PostMessage(*window_index, WM_CLOSE, 0, 0); | 125 PostMessage(*window_index, WM_CLOSE, 0, 0); |
126 } | 126 } |
127 #elif defined(OS_MACOSX) | 127 #elif defined(OS_MACOSX) |
| 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
128 // If the plugin process crashed but had fullscreen windows open at the time, | 129 // If the plugin process crashed but had fullscreen windows open at the time, |
129 // make sure that the menu bar is visible. | 130 // make sure that the menu bar is visible. |
130 std::set<uint32>::iterator window_index; | 131 for (size_t i = 0; i < plugin_fullscreen_windows_set_.size(); ++i) { |
131 for (window_index = plugin_fullscreen_windows_set_.begin(); | 132 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
132 window_index != plugin_fullscreen_windows_set_.end(); | 133 base::Bind(base::mac::ReleaseFullScreen, |
133 window_index++) { | 134 base::mac::kFullScreenModeHideAll)); |
134 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | |
135 base::mac::ReleaseFullScreen(base::mac::kFullScreenModeHideAll); | |
136 } else { | |
137 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
138 base::Bind(base::mac::ReleaseFullScreen, | |
139 base::mac::kFullScreenModeHideAll)); | |
140 } | |
141 } | 135 } |
142 // If the plugin hid the cursor, reset that. | 136 // If the plugin hid the cursor, reset that. |
143 if (!plugin_cursor_visible_) { | 137 if (!plugin_cursor_visible_) { |
144 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 138 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
145 base::mac::SetCursorVisibility(true); | 139 base::Bind(base::mac::SetCursorVisibility, true)); |
146 } else { | |
147 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
148 base::Bind(base::mac::SetCursorVisibility, true)); | |
149 } | |
150 } | 140 } |
151 #endif | 141 #endif |
152 // Cancel all pending and sent requests. | 142 // Cancel all pending and sent requests. |
153 CancelRequests(); | 143 CancelRequests(); |
154 } | 144 } |
155 | 145 |
156 bool PluginProcessHost::Send(IPC::Message* message) { | 146 bool PluginProcessHost::Send(IPC::Message* message) { |
157 return process_->Send(message); | 147 return process_->Send(message); |
158 } | 148 } |
159 | 149 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 void PluginProcessHost::OnChannelCreated( | 410 void PluginProcessHost::OnChannelCreated( |
421 const IPC::ChannelHandle& channel_handle) { | 411 const IPC::ChannelHandle& channel_handle) { |
422 Client* client = sent_requests_.front(); | 412 Client* client = sent_requests_.front(); |
423 | 413 |
424 if (client) | 414 if (client) |
425 client->OnChannelOpened(channel_handle); | 415 client->OnChannelOpened(channel_handle); |
426 sent_requests_.pop_front(); | 416 sent_requests_.pop_front(); |
427 } | 417 } |
428 | 418 |
429 } // namespace content | 419 } // namespace content |
OLD | NEW |