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

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

Issue 1544273002: Switch to standard integer types in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « content/plugin/plugin_channel.cc ('k') | content/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) 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/plugin/plugin_interpose_util_mac.h" 5 #include "content/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 #include <stdint.h>
9 10
10 #include "content/child/npapi/webplugin_delegate_impl.h" 11 #include "content/child/npapi/webplugin_delegate_impl.h"
11 #include "content/common/plugin_process_messages.h" 12 #include "content/common/plugin_process_messages.h"
12 #include "content/plugin/plugin_thread.h" 13 #include "content/plugin/plugin_thread.h"
13 14
14 using content::PluginThread; 15 using content::PluginThread;
15 16
16 namespace { 17 namespace {
17 18
18 // Brings the plugin process to the front so that the user can see its windows. 19 // Brings the plugin process to the front so that the user can see its windows.
19 void SwitchToPluginProcess() { 20 void SwitchToPluginProcess() {
20 ProcessSerialNumber this_process, front_process; 21 ProcessSerialNumber this_process, front_process;
21 if ((GetCurrentProcess(&this_process) != noErr) || 22 if ((GetCurrentProcess(&this_process) != noErr) ||
22 (GetFrontProcess(&front_process) != noErr)) { 23 (GetFrontProcess(&front_process) != noErr)) {
23 return; 24 return;
24 } 25 }
25 26
26 Boolean matched = false; 27 Boolean matched = false;
27 if ((SameProcess(&this_process, &front_process, &matched) == noErr) && 28 if ((SameProcess(&this_process, &front_process, &matched) == noErr) &&
28 !matched) { 29 !matched) {
29 SetFrontProcess(&this_process); 30 SetFrontProcess(&this_process);
30 } 31 }
31 } 32 }
32 33
33 // Sends a message to the browser process to inform it that the given window 34 // Sends a message to the browser process to inform it that the given window
34 // has been shown. 35 // has been shown.
35 void NotifyBrowserOfPluginShowWindow(uint32 window_id, CGRect bounds, 36 void NotifyBrowserOfPluginShowWindow(uint32_t window_id,
37 CGRect bounds,
36 bool modal) { 38 bool modal) {
37 PluginThread* plugin_thread = PluginThread::current(); 39 PluginThread* plugin_thread = PluginThread::current();
38 if (plugin_thread) { 40 if (plugin_thread) {
39 gfx::Rect window_bounds(bounds); 41 gfx::Rect window_bounds(bounds);
40 plugin_thread->Send( 42 plugin_thread->Send(
41 new PluginProcessHostMsg_PluginShowWindow(window_id, window_bounds, 43 new PluginProcessHostMsg_PluginShowWindow(window_id, window_bounds,
42 modal)); 44 modal));
43 } 45 }
44 } 46 }
45 47
46 // Sends a message to the browser process to inform it that the given window 48 // Sends a message to the browser process to inform it that the given window
47 // has been hidden, and switches focus back to the browser process if there are 49 // has been hidden, and switches focus back to the browser process if there are
48 // no remaining plugin windows. 50 // no remaining plugin windows.
49 void NotifyBrowserOfPluginHideWindow(uint32 window_id, CGRect bounds) { 51 void NotifyBrowserOfPluginHideWindow(uint32_t window_id, CGRect bounds) {
50 PluginThread* plugin_thread = PluginThread::current(); 52 PluginThread* plugin_thread = PluginThread::current();
51 if (plugin_thread) { 53 if (plugin_thread) {
52 gfx::Rect window_bounds(bounds); 54 gfx::Rect window_bounds(bounds);
53 plugin_thread->Send( 55 plugin_thread->Send(
54 new PluginProcessHostMsg_PluginHideWindow(window_id, window_bounds)); 56 new PluginProcessHostMsg_PluginHideWindow(window_id, window_bounds));
55 } 57 }
56 } 58 }
57 59
58 // Informs the host that the plugin has changed the cursor visibility. 60 // Informs the host that the plugin has changed the cursor visibility.
59 void NotifyPluginOfSetCursorVisibility(bool visibility) { 61 void NotifyPluginOfSetCursorVisibility(bool visibility) {
60 PluginThread* plugin_thread = PluginThread::current(); 62 PluginThread* plugin_thread = PluginThread::current();
61 if (plugin_thread) { 63 if (plugin_thread) {
62 plugin_thread->Send( 64 plugin_thread->Send(
63 new PluginProcessHostMsg_PluginSetCursorVisibility(visibility)); 65 new PluginProcessHostMsg_PluginSetCursorVisibility(visibility));
64 } 66 }
65 } 67 }
66 68
67 struct WindowInfo { 69 struct WindowInfo {
68 uint32 window_id; 70 uint32_t window_id;
69 CGRect bounds; 71 CGRect bounds;
70 WindowInfo(NSWindow* window) { 72 WindowInfo(NSWindow* window) {
71 NSInteger window_num = [window windowNumber]; 73 NSInteger window_num = [window windowNumber];
72 window_id = window_num > 0 ? window_num : 0; 74 window_id = window_num > 0 ? window_num : 0;
73 bounds = NSRectToCGRect([window frame]); 75 bounds = NSRectToCGRect([window frame]);
74 } 76 }
75 }; 77 };
76 78
77 void OnPluginWindowClosed(const WindowInfo& window_info) { 79 void OnPluginWindowClosed(const WindowInfo& window_info) {
78 if (window_info.window_id == 0) 80 if (window_info.window_id == 0)
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 Class nscursor_class = [NSCursor class]; 252 Class nscursor_class = [NSCursor class];
251 ExchangeMethods(nscursor_class, NO, @selector(set), 253 ExchangeMethods(nscursor_class, NO, @selector(set),
252 @selector(chromePlugin_set)); 254 @selector(chromePlugin_set));
253 ExchangeMethods(nscursor_class, YES, @selector(hide), 255 ExchangeMethods(nscursor_class, YES, @selector(hide),
254 @selector(chromePlugin_hide)); 256 @selector(chromePlugin_hide));
255 ExchangeMethods(nscursor_class, YES, @selector(unhide), 257 ExchangeMethods(nscursor_class, YES, @selector(unhide),
256 @selector(chromePlugin_unhide)); 258 @selector(chromePlugin_unhide));
257 } 259 }
258 260
259 } // namespace mac_plugin_interposing 261 } // namespace mac_plugin_interposing
OLDNEW
« no previous file with comments | « content/plugin/plugin_channel.cc ('k') | content/plugin/plugin_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698