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

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

Issue 7658006: Merge 96876 - Add scroll and gesture message filters for UIPI Flash. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/782/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
« no previous file with comments | « chrome/common/chrome_content_client.cc ('k') | webkit/plugins/npapi/plugin_constants_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 28 matching lines...) Expand all
39 #include "ui/gfx/gtk_native_view_id_manager.h" 39 #include "ui/gfx/gtk_native_view_id_manager.h"
40 #endif 40 #endif
41 41
42 #if defined(OS_MACOSX) 42 #if defined(OS_MACOSX)
43 #include "base/mac/mac_util.h" 43 #include "base/mac/mac_util.h"
44 #include "content/common/plugin_carbon_interpose_constants_mac.h" 44 #include "content/common/plugin_carbon_interpose_constants_mac.h"
45 #include "ui/gfx/rect.h" 45 #include "ui/gfx/rect.h"
46 #endif 46 #endif
47 47
48 #if defined(OS_WIN) 48 #if defined(OS_WIN)
49 #include "base/win/windows_version.h"
50 #include "webkit/plugins/npapi/plugin_constants_win.h"
49 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 51 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
50 52
51 namespace { 53 namespace {
52 54
53 void ReparentPluginWindowHelper(HWND window, HWND parent) { 55 void ReparentPluginWindowHelper(HWND window, HWND parent) {
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
55 57
56 int window_style = WS_CHILD; 58 int window_style = WS_CHILD;
57 if (!webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window)) 59 if (!webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window))
58 window_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; 60 window_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
59 61
60 ::SetWindowLongPtr(window, GWL_STYLE, window_style); 62 ::SetWindowLongPtr(window, GWL_STYLE, window_style);
61 ::SetParent(window, parent); 63 ::SetParent(window, parent);
64 // Allow the Flash plugin to forward some messages back to Chrome.
65 if (base::win::GetVersion() >= base::win::VERSION_WIN7)
66 ::SetPropW(parent, webkit::npapi::kNativeWindowClassFilterProp, HANDLE(-1));
62 } 67 }
63 68
64 } // namespace 69 } // namespace
65 70
66 void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { 71 void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) {
67 // The window is destroyed at this point, we just care about its parent, which 72 // The window is destroyed at this point, we just care about its parent, which
68 // is the intermediate window we created. 73 // is the intermediate window we created.
69 std::set<HWND>::iterator window_index = 74 std::set<HWND>::iterator window_index =
70 plugin_parent_windows_set_.find(parent); 75 plugin_parent_windows_set_.find(parent);
71 if (window_index == plugin_parent_windows_set_.end()) 76 if (window_index == plugin_parent_windows_set_.end())
72 return; 77 return;
73 78
74 plugin_parent_windows_set_.erase(window_index); 79 plugin_parent_windows_set_.erase(window_index);
75 PostMessage(parent, WM_CLOSE, 0, 0); 80 PostMessage(parent, WM_CLOSE, 0, 0);
76 } 81 }
77 82
78 void PluginProcessHost::AddWindow(HWND window) { 83 void PluginProcessHost::AddWindow(HWND window) {
79 plugin_parent_windows_set_.insert(window); 84 plugin_parent_windows_set_.insert(window);
80 } 85 }
81 86
82 void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) { 87 void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) {
83 // Reparent only to our process. 88 // Reparent only from the plugin process to our process.
84 DWORD process_id = 0; 89 DWORD process_id = 0;
90 ::GetWindowThreadProcessId(window, &process_id);
91 if (process_id != ::GetProcessId(GetChildProcessHandle()))
92 return;
85 ::GetWindowThreadProcessId(parent, &process_id); 93 ::GetWindowThreadProcessId(parent, &process_id);
86 if (process_id != ::GetCurrentProcessId()) 94 if (process_id != ::GetCurrentProcessId())
87 return; 95 return;
88 96
89 BrowserThread::PostTask( 97 BrowserThread::PostTask(
90 BrowserThread::UI, FROM_HERE, 98 BrowserThread::UI, FROM_HERE,
91 NewRunnableFunction(ReparentPluginWindowHelper, window, parent)); 99 NewRunnableFunction(ReparentPluginWindowHelper, window, parent));
92 } 100 }
93 #endif // defined(OS_WIN) 101 #endif // defined(OS_WIN)
94 102
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 364 }
357 } 365 }
358 366
359 void PluginProcessHost::OnChannelCreated( 367 void PluginProcessHost::OnChannelCreated(
360 const IPC::ChannelHandle& channel_handle) { 368 const IPC::ChannelHandle& channel_handle) {
361 Client* client = sent_requests_.front(); 369 Client* client = sent_requests_.front();
362 370
363 client->OnChannelOpened(channel_handle); 371 client->OnChannelOpened(channel_handle);
364 sent_requests_.pop(); 372 sent_requests_.pop();
365 } 373 }
OLDNEW
« no previous file with comments | « chrome/common/chrome_content_client.cc ('k') | webkit/plugins/npapi/plugin_constants_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698