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

Side by Side Diff: content/browser/plugin_process_host.cc

Issue 7617019: Add scroll and gesture message filters for UIPI Flash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
OLDNEW
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) 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 26 matching lines...) Expand all
37 #include "ui/gfx/gtk_native_view_id_manager.h" 37 #include "ui/gfx/gtk_native_view_id_manager.h"
38 #endif 38 #endif
39 39
40 #if defined(OS_MACOSX) 40 #if defined(OS_MACOSX)
41 #include "base/mac/mac_util.h" 41 #include "base/mac/mac_util.h"
42 #include "content/common/plugin_carbon_interpose_constants_mac.h" 42 #include "content/common/plugin_carbon_interpose_constants_mac.h"
43 #include "ui/gfx/rect.h" 43 #include "ui/gfx/rect.h"
44 #endif 44 #endif
45 45
46 #if defined(OS_WIN) 46 #if defined(OS_WIN)
47 #include "base/win/windows_version.h"
48 #include "webkit/plugins/npapi/plugin_constants_win.h"
47 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 49 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
48 50
49 namespace { 51 namespace {
50 52
51 void ReparentPluginWindowHelper(HWND window, HWND parent) { 53 void ReparentPluginWindowHelper(HWND window, HWND parent) {
52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
53 55
54 int window_style = WS_CHILD; 56 int window_style = WS_CHILD;
55 if (!webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window)) 57 if (!webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window))
56 window_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; 58 window_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
57 59
58 ::SetWindowLongPtr(window, GWL_STYLE, window_style); 60 ::SetWindowLongPtr(window, GWL_STYLE, window_style);
59 ::SetParent(window, parent); 61 ::SetParent(window, parent);
62 // Allow the Flash plugin to forward some messages back to Chrome.
63 if (base::win::GetVersion() >= base::win::VERSION_WIN7)
64 ::SetPropW(parent, webkit::npapi::kNativeWindowClassFilterProp, HANDLE(-1));
60 } 65 }
61 66
62 } // namespace 67 } // namespace
63 68
64 void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { 69 void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) {
65 // The window is destroyed at this point, we just care about its parent, which 70 // The window is destroyed at this point, we just care about its parent, which
66 // is the intermediate window we created. 71 // is the intermediate window we created.
67 std::set<HWND>::iterator window_index = 72 std::set<HWND>::iterator window_index =
68 plugin_parent_windows_set_.find(parent); 73 plugin_parent_windows_set_.find(parent);
69 if (window_index == plugin_parent_windows_set_.end()) 74 if (window_index == plugin_parent_windows_set_.end())
70 return; 75 return;
71 76
72 plugin_parent_windows_set_.erase(window_index); 77 plugin_parent_windows_set_.erase(window_index);
73 PostMessage(parent, WM_CLOSE, 0, 0); 78 PostMessage(parent, WM_CLOSE, 0, 0);
74 } 79 }
75 80
76 void PluginProcessHost::AddWindow(HWND window) { 81 void PluginProcessHost::AddWindow(HWND window) {
77 plugin_parent_windows_set_.insert(window); 82 plugin_parent_windows_set_.insert(window);
78 } 83 }
79 84
80 void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) { 85 void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) {
81 // Reparent only to our process. 86 // Reparent only from the plugin process to our process.
82 DWORD process_id = 0; 87 DWORD process_id = 0;
88 ::GetWindowThreadProcessId(window, &process_id);
89 if (process_id != ::GetProcessId(GetChildProcessHandle()))
90 return;
83 ::GetWindowThreadProcessId(parent, &process_id); 91 ::GetWindowThreadProcessId(parent, &process_id);
84 if (process_id != ::GetCurrentProcessId()) 92 if (process_id != ::GetCurrentProcessId())
85 return; 93 return;
86 94
87 BrowserThread::PostTask( 95 BrowserThread::PostTask(
88 BrowserThread::UI, FROM_HERE, 96 BrowserThread::UI, FROM_HERE,
89 NewRunnableFunction(ReparentPluginWindowHelper, window, parent)); 97 NewRunnableFunction(ReparentPluginWindowHelper, window, parent));
90 } 98 }
91 #endif // defined(OS_WIN) 99 #endif // defined(OS_WIN)
92 100
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 354 }
347 } 355 }
348 356
349 void PluginProcessHost::OnChannelCreated( 357 void PluginProcessHost::OnChannelCreated(
350 const IPC::ChannelHandle& channel_handle) { 358 const IPC::ChannelHandle& channel_handle) {
351 Client* client = sent_requests_.front(); 359 Client* client = sent_requests_.front();
352 360
353 client->OnChannelOpened(channel_handle); 361 client->OnChannelOpened(channel_handle);
354 sent_requests_.pop(); 362 sent_requests_.pop();
355 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698