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

Side by Side Diff: webkit/plugins/npapi/plugin_instance_mac.mm

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/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 | « webkit/plugins/npapi/plugin_instance.cc ('k') | webkit/plugins/npapi/plugin_lib.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) 2010 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 "build/build_config.h"
6
7 #import <AppKit/AppKit.h> 5 #import <AppKit/AppKit.h>
8 6
9 #include "base/logging.h" 7 #include "base/logging.h"
10 #include "webkit/glue/plugins/plugin_instance.h" 8 #include "build/build_config.h"
9 #include "webkit/plugins/npapi/plugin_instance.h"
11 10
12 // When C++ exceptions are disabled, the C++ library defines |try| and 11 // When C++ exceptions are disabled, the C++ library defines |try| and
13 // |catch| so as to allow exception-expecting C++ code to build properly when 12 // |catch| so as to allow exception-expecting C++ code to build properly when
14 // language support for exceptions is not present. These macros interfere 13 // language support for exceptions is not present. These macros interfere
15 // with the use of |@try| and |@catch| in Objective-C files such as this one. 14 // with the use of |@try| and |@catch| in Objective-C files such as this one.
16 // Undefine these macros here, after everything has been #included, since 15 // Undefine these macros here, after everything has been #included, since
17 // there will be no C++ uses and only Objective-C uses from this point on. 16 // there will be no C++ uses and only Objective-C uses from this point on.
18 #undef try 17 #undef try
19 #undef catch 18 #undef catch
20 19
21 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 20 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
22 @interface NSMenu (SnowLeopardMenuPopUpDeclaration) 21 @interface NSMenu (SnowLeopardMenuPopUpDeclaration)
23 - (BOOL)popUpMenuPositioningItem:(NSMenuItem*)item 22 - (BOOL)popUpMenuPositioningItem:(NSMenuItem*)item
24 atLocation:(NSPoint)location 23 atLocation:(NSPoint)location
25 inView:(NSView*)view; 24 inView:(NSView*)view;
26 @end 25 @end
27 #endif 26 #endif
28 27
28 namespace webkit {
29 namespace npapi {
30
29 namespace { 31 namespace {
30 32
31 // Returns an autoreleased NSEvent constructed from the given np_event, 33 // Returns an autoreleased NSEvent constructed from the given np_event,
32 // targeting the given window. 34 // targeting the given window.
33 NSEvent* NSEventForNPCocoaEvent(NPCocoaEvent* np_event, NSWindow* window) { 35 NSEvent* NSEventForNPCocoaEvent(NPCocoaEvent* np_event, NSWindow* window) {
34 bool mouse_down = 1; 36 bool mouse_down = 1;
35 switch (np_event->type) { 37 switch (np_event->type) {
36 case NPCocoaEventMouseDown: 38 case NPCocoaEventMouseDown:
37 mouse_down = 1; 39 mouse_down = 1;
38 break; 40 break;
(...skipping 30 matching lines...) Expand all
69 windowNumber:[window windowNumber] 71 windowNumber:[window windowNumber]
70 context:[NSGraphicsContext currentContext] 72 context:[NSGraphicsContext currentContext]
71 eventNumber:0 73 eventNumber:0
72 clickCount:click_count 74 clickCount:click_count
73 pressure:1.0]; 75 pressure:1.0];
74 return event; 76 return event;
75 } 77 }
76 78
77 } // namespace 79 } // namespace
78 80
79 namespace NPAPI {
80
81 NPError PluginInstance::PopUpContextMenu(NPMenu* menu) { 81 NPError PluginInstance::PopUpContextMenu(NPMenu* menu) {
82 if (!currently_handled_event_) 82 if (!currently_handled_event_)
83 return NPERR_GENERIC_ERROR; 83 return NPERR_GENERIC_ERROR;
84 84
85 CGRect main_display_bounds = CGDisplayBounds(CGMainDisplayID()); 85 CGRect main_display_bounds = CGDisplayBounds(CGMainDisplayID());
86 NSPoint screen_point = NSMakePoint( 86 NSPoint screen_point = NSMakePoint(
87 plugin_origin_.x() + currently_handled_event_->data.mouse.pluginX, 87 plugin_origin_.x() + currently_handled_event_->data.mouse.pluginX,
88 plugin_origin_.y() + currently_handled_event_->data.mouse.pluginY); 88 plugin_origin_.y() + currently_handled_event_->data.mouse.pluginY);
89 // Plugin offsets are upper-left based, so flip vertically for Cocoa. 89 // Plugin offsets are upper-left based, so flip vertically for Cocoa.
90 screen_point.y = main_display_bounds.size.height - screen_point.y; 90 screen_point.y = main_display_bounds.size.height - screen_point.y;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 [window release]; 123 [window release];
124 } 124 }
125 @catch (NSException* e) { 125 @catch (NSException* e) {
126 NSLog(@"Caught exception while cleaning up in PopUpContextMenu: %@", e); 126 NSLog(@"Caught exception while cleaning up in PopUpContextMenu: %@", e);
127 } 127 }
128 } 128 }
129 129
130 return return_val; 130 return return_val;
131 } 131 }
132 132
133 } // namespace NPAPI 133 } // namespace npapi
134 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_instance.cc ('k') | webkit/plugins/npapi/plugin_lib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698