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

Side by Side Diff: chrome/plugin/plugin_interpose_util_mac.mm

Issue 5961004: Revert 69755 - Move the NPAPI files from webkit/glue/plugins to webkit/plugin... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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/plugin/plugin_channel.cc ('k') | chrome/plugin/plugin_thread.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/plugin/plugin_interpose_util_mac.h" 5 #include "chrome/plugin/plugin_interpose_util_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 #import <objc/runtime.h> 8 #import <objc/runtime.h>
9 9
10 #include "chrome/common/plugin_messages.h" 10 #include "chrome/common/plugin_messages.h"
11 #include "chrome/plugin/plugin_thread.h" 11 #include "chrome/plugin/plugin_thread.h"
12 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 12 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
13 13
14 namespace mac_plugin_interposing { 14 namespace mac_plugin_interposing {
15 15
16 // TODO(stuartmorgan): Make this an IPC to order the plugin process above the 16 // TODO(stuartmorgan): Make this an IPC to order the plugin process above the
17 // browser process only if the browser is current frontmost. 17 // browser process only if the browser is current frontmost.
18 __attribute__((visibility("default"))) 18 __attribute__((visibility("default")))
19 void SwitchToPluginProcess() { 19 void SwitchToPluginProcess() {
20 ProcessSerialNumber this_process, front_process; 20 ProcessSerialNumber this_process, front_process;
21 if ((GetCurrentProcess(&this_process) != noErr) || 21 if ((GetCurrentProcess(&this_process) != noErr) ||
22 (GetFrontProcess(&front_process) != noErr)) { 22 (GetFrontProcess(&front_process) != noErr)) {
23 return; 23 return;
24 } 24 }
25 25
26 Boolean matched = false; 26 Boolean matched = false;
27 if ((SameProcess(&this_process, &front_process, &matched) == noErr) && 27 if ((SameProcess(&this_process, &front_process, &matched) == noErr) &&
28 !matched) { 28 !matched) {
29 SetFrontProcess(&this_process); 29 SetFrontProcess(&this_process);
30 } 30 }
31 } 31 }
32 32
33 __attribute__((visibility("default"))) 33 __attribute__((visibility("default")))
34 OpaquePluginRef GetActiveDelegate() { 34 OpaquePluginRef GetActiveDelegate() {
35 return webkit::npapi::WebPluginDelegateImpl::GetActiveDelegate(); 35 return WebPluginDelegateImpl::GetActiveDelegate();
36 } 36 }
37 37
38 __attribute__((visibility("default"))) 38 __attribute__((visibility("default")))
39 void NotifyBrowserOfPluginSelectWindow(uint32 window_id, CGRect bounds, 39 void NotifyBrowserOfPluginSelectWindow(uint32 window_id, CGRect bounds,
40 bool modal) { 40 bool modal) {
41 PluginThread* plugin_thread = PluginThread::current(); 41 PluginThread* plugin_thread = PluginThread::current();
42 if (plugin_thread) { 42 if (plugin_thread) {
43 gfx::Rect window_bounds(bounds); 43 gfx::Rect window_bounds(bounds);
44 plugin_thread->Send( 44 plugin_thread->Send(
45 new PluginProcessHostMsg_PluginSelectWindow(window_id, window_bounds, 45 new PluginProcessHostMsg_PluginSelectWindow(window_id, window_bounds,
(...skipping 19 matching lines...) Expand all
65 if (plugin_thread) { 65 if (plugin_thread) {
66 gfx::Rect window_bounds(bounds); 66 gfx::Rect window_bounds(bounds);
67 plugin_thread->Send( 67 plugin_thread->Send(
68 new PluginProcessHostMsg_PluginHideWindow(window_id, window_bounds)); 68 new PluginProcessHostMsg_PluginHideWindow(window_id, window_bounds));
69 } 69 }
70 } 70 }
71 71
72 __attribute__((visibility("default"))) 72 __attribute__((visibility("default")))
73 void NotifyPluginOfSetThemeCursor(OpaquePluginRef delegate, 73 void NotifyPluginOfSetThemeCursor(OpaquePluginRef delegate,
74 ThemeCursor cursor) { 74 ThemeCursor cursor) {
75 static_cast<webkit::npapi::WebPluginDelegateImpl*>(delegate)->SetThemeCursor( 75 static_cast<WebPluginDelegateImpl*>(delegate)->SetThemeCursor(cursor);
76 cursor);
77 } 76 }
78 77
79 __attribute__((visibility("default"))) 78 __attribute__((visibility("default")))
80 void NotifyPluginOfSetCursor(OpaquePluginRef delegate, 79 void NotifyPluginOfSetCursor(OpaquePluginRef delegate,
81 const Cursor* cursor) { 80 const Cursor* cursor) {
82 static_cast<webkit::npapi::WebPluginDelegateImpl*>(delegate)->SetCursor( 81 static_cast<WebPluginDelegateImpl*>(delegate)->SetCursor(cursor);
83 cursor);
84 } 82 }
85 83
86 void NotifyPluginOfSetCursorVisibility(bool visibility) { 84 void NotifyPluginOfSetCursorVisibility(bool visibility) {
87 PluginThread* plugin_thread = PluginThread::current(); 85 PluginThread* plugin_thread = PluginThread::current();
88 if (plugin_thread) { 86 if (plugin_thread) {
89 plugin_thread->Send( 87 plugin_thread->Send(
90 new PluginProcessHostMsg_PluginSetCursorVisibility(visibility)); 88 new PluginProcessHostMsg_PluginSetCursorVisibility(visibility));
91 } 89 }
92 } 90 }
93 91
94 __attribute__((visibility("default"))) 92 __attribute__((visibility("default")))
95 bool GetPluginWindowHasFocus(const OpaquePluginRef delegate) { 93 bool GetPluginWindowHasFocus(const OpaquePluginRef delegate) {
96 return static_cast<webkit::npapi::WebPluginDelegateImpl*>( 94 return static_cast<WebPluginDelegateImpl*>(delegate)->GetWindowHasFocus();
97 delegate)->GetWindowHasFocus();
98 } 95 }
99 96
100 } // namespace mac_plugin_interposing 97 } // namespace mac_plugin_interposing
101 98
102 #pragma mark - 99 #pragma mark -
103 100
104 struct WindowInfo { 101 struct WindowInfo {
105 uint32 window_id; 102 uint32 window_id;
106 CGRect bounds; 103 CGRect bounds;
107 WindowInfo(NSWindow* window) { 104 WindowInfo(NSWindow* window) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 - (void)chromePlugin_set; 230 - (void)chromePlugin_set;
234 + (void)chromePlugin_hide; 231 + (void)chromePlugin_hide;
235 + (void)chromePlugin_unhide; 232 + (void)chromePlugin_unhide;
236 @end 233 @end
237 234
238 @implementation NSCursor (ChromePluginInterposing) 235 @implementation NSCursor (ChromePluginInterposing)
239 236
240 - (void)chromePlugin_set { 237 - (void)chromePlugin_set {
241 OpaquePluginRef delegate = mac_plugin_interposing::GetActiveDelegate(); 238 OpaquePluginRef delegate = mac_plugin_interposing::GetActiveDelegate();
242 if (delegate) { 239 if (delegate) {
243 static_cast<webkit::npapi::WebPluginDelegateImpl*>(delegate)->SetNSCursor( 240 static_cast<WebPluginDelegateImpl*>(delegate)->SetNSCursor(self);
244 self);
245 return; 241 return;
246 } 242 }
247 [self chromePlugin_set]; 243 [self chromePlugin_set];
248 } 244 }
249 245
250 + (void)chromePlugin_hide { 246 + (void)chromePlugin_hide {
251 mac_plugin_interposing::NotifyPluginOfSetCursorVisibility(false); 247 mac_plugin_interposing::NotifyPluginOfSetCursorVisibility(false);
252 } 248 }
253 249
254 + (void)chromePlugin_unhide { 250 + (void)chromePlugin_unhide {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 Class nscursor_class = [NSCursor class]; 293 Class nscursor_class = [NSCursor class];
298 ExchangeMethods(nscursor_class, NO, @selector(set), 294 ExchangeMethods(nscursor_class, NO, @selector(set),
299 @selector(chromePlugin_set)); 295 @selector(chromePlugin_set));
300 ExchangeMethods(nscursor_class, YES, @selector(hide), 296 ExchangeMethods(nscursor_class, YES, @selector(hide),
301 @selector(chromePlugin_hide)); 297 @selector(chromePlugin_hide));
302 ExchangeMethods(nscursor_class, YES, @selector(unhide), 298 ExchangeMethods(nscursor_class, YES, @selector(unhide),
303 @selector(chromePlugin_unhide)); 299 @selector(chromePlugin_unhide));
304 } 300 }
305 301
306 } // namespace mac_plugin_interposing 302 } // namespace mac_plugin_interposing
OLDNEW
« no previous file with comments | « chrome/plugin/plugin_channel.cc ('k') | chrome/plugin/plugin_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698