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

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

Powered by Google App Engine
This is Rietveld 408576698