OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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) && !defined(USE_AURA) | 7 #if defined(OS_WIN) && !defined(USE_AURA) |
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<> |
11 #endif | 11 #endif |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
| 16 #include "base/bind.h" |
16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
17 #include "base/file_path.h" | 18 #include "base/file_path.h" |
18 #include "base/file_util.h" | 19 #include "base/file_util.h" |
19 #include "base/logging.h" | 20 #include "base/logging.h" |
20 #include "base/path_service.h" | 21 #include "base/path_service.h" |
21 #include "base/string_util.h" | 22 #include "base/string_util.h" |
22 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
23 #include "content/browser/plugin_service.h" | 24 #include "content/browser/plugin_service.h" |
24 #include "content/common/plugin_messages.h" | 25 #include "content/common/plugin_messages.h" |
25 #include "content/common/resource_messages.h" | 26 #include "content/common/resource_messages.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 DWORD process_id = 0; | 89 DWORD process_id = 0; |
89 ::GetWindowThreadProcessId(window, &process_id); | 90 ::GetWindowThreadProcessId(window, &process_id); |
90 if (process_id != ::GetProcessId(GetChildProcessHandle())) | 91 if (process_id != ::GetProcessId(GetChildProcessHandle())) |
91 return; | 92 return; |
92 ::GetWindowThreadProcessId(parent, &process_id); | 93 ::GetWindowThreadProcessId(parent, &process_id); |
93 if (process_id != ::GetCurrentProcessId()) | 94 if (process_id != ::GetCurrentProcessId()) |
94 return; | 95 return; |
95 | 96 |
96 BrowserThread::PostTask( | 97 BrowserThread::PostTask( |
97 BrowserThread::UI, FROM_HERE, | 98 BrowserThread::UI, FROM_HERE, |
98 NewRunnableFunction(ReparentPluginWindowHelper, window, parent)); | 99 base::Bind(ReparentPluginWindowHelper, window, parent)); |
99 } | 100 } |
100 #endif // defined(OS_WIN) | 101 #endif // defined(OS_WIN) |
101 | 102 |
102 #if defined(TOOLKIT_USES_GTK) | 103 #if defined(TOOLKIT_USES_GTK) |
103 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, | 104 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, |
104 gfx::PluginWindowHandle* output) { | 105 gfx::PluginWindowHandle* output) { |
105 *output = 0; | 106 *output = 0; |
106 #if !defined(USE_AURA) | 107 #if !defined(USE_AURA) |
107 GtkNativeViewManager::GetInstance()->GetXIDForId(output, id); | 108 GtkNativeViewManager::GetInstance()->GetXIDForId(output, id); |
108 #endif | 109 #endif |
(...skipping 25 matching lines...) Expand all Loading... |
134 #elif defined(OS_MACOSX) | 135 #elif defined(OS_MACOSX) |
135 // If the plugin process crashed but had fullscreen windows open at the time, | 136 // If the plugin process crashed but had fullscreen windows open at the time, |
136 // make sure that the menu bar is visible. | 137 // make sure that the menu bar is visible. |
137 std::set<uint32>::iterator window_index; | 138 std::set<uint32>::iterator window_index; |
138 for (window_index = plugin_fullscreen_windows_set_.begin(); | 139 for (window_index = plugin_fullscreen_windows_set_.begin(); |
139 window_index != plugin_fullscreen_windows_set_.end(); | 140 window_index != plugin_fullscreen_windows_set_.end(); |
140 window_index++) { | 141 window_index++) { |
141 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 142 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
142 base::mac::ReleaseFullScreen(base::mac::kFullScreenModeHideAll); | 143 base::mac::ReleaseFullScreen(base::mac::kFullScreenModeHideAll); |
143 } else { | 144 } else { |
144 BrowserThread::PostTask( | 145 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
145 BrowserThread::UI, FROM_HERE, | 146 base::Bind(base::mac::ReleaseFullScreen, |
146 NewRunnableFunction(base::mac::ReleaseFullScreen, | 147 base::mac::kFullScreenModeHideAll)); |
147 base::mac::kFullScreenModeHideAll)); | |
148 } | 148 } |
149 } | 149 } |
150 // If the plugin hid the cursor, reset that. | 150 // If the plugin hid the cursor, reset that. |
151 if (!plugin_cursor_visible_) { | 151 if (!plugin_cursor_visible_) { |
152 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 152 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
153 base::mac::SetCursorVisibility(true); | 153 base::mac::SetCursorVisibility(true); |
154 } else { | 154 } else { |
155 BrowserThread::PostTask( | 155 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
156 BrowserThread::UI, FROM_HERE, | 156 base::Bind(base::mac::SetCursorVisibility, true)); |
157 NewRunnableFunction(base::mac::SetCursorVisibility, | |
158 true)); | |
159 } | 157 } |
160 } | 158 } |
161 #endif | 159 #endif |
162 // Cancel all pending and sent requests. | 160 // Cancel all pending and sent requests. |
163 CancelRequests(); | 161 CancelRequests(); |
164 } | 162 } |
165 | 163 |
166 bool PluginProcessHost::Init(const webkit::WebPluginInfo& info, | 164 bool PluginProcessHost::Init(const webkit::WebPluginInfo& info, |
167 const std::string& locale) { | 165 const std::string& locale) { |
168 info_ = info; | 166 info_ = info; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 413 } |
416 | 414 |
417 void PluginProcessHost::OnChannelCreated( | 415 void PluginProcessHost::OnChannelCreated( |
418 const IPC::ChannelHandle& channel_handle) { | 416 const IPC::ChannelHandle& channel_handle) { |
419 Client* client = sent_requests_.front(); | 417 Client* client = sent_requests_.front(); |
420 | 418 |
421 if (client) | 419 if (client) |
422 client->OnChannelOpened(channel_handle); | 420 client->OnChannelOpened(channel_handle); |
423 sent_requests_.pop_front(); | 421 sent_requests_.pop_front(); |
424 } | 422 } |
OLD | NEW |