OLD | NEW |
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 #import <AppKit/AppKit.h> | 5 #import <AppKit/AppKit.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "webkit/plugins/npapi/plugin_instance.h" | 9 #include "content/child/npapi/plugin_instance.h" |
10 | 10 |
11 // When C++ exceptions are disabled, the C++ library defines |try| and | 11 // When C++ exceptions are disabled, the C++ library defines |try| and |
12 // |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 |
13 // language support for exceptions is not present. These macros interfere | 13 // language support for exceptions is not present. These macros interfere |
14 // 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. |
15 // Undefine these macros here, after everything has been #included, since | 15 // Undefine these macros here, after everything has been #included, since |
16 // 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. |
17 #undef try | 17 #undef try |
18 #undef catch | 18 #undef catch |
19 | 19 |
20 namespace webkit { | 20 namespace content { |
21 namespace npapi { | |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 // Returns an autoreleased NSEvent constructed from the given np_event, | 24 // Returns an autoreleased NSEvent constructed from the given np_event, |
26 // targeting the given window. | 25 // targeting the given window. |
27 NSEvent* NSEventForNPCocoaEvent(NPCocoaEvent* np_event, NSWindow* window) { | 26 NSEvent* NSEventForNPCocoaEvent(NPCocoaEvent* np_event, NSWindow* window) { |
28 bool mouse_down = 1; | 27 bool mouse_down = 1; |
29 switch (np_event->type) { | 28 switch (np_event->type) { |
30 case NPCocoaEventMouseDown: | 29 case NPCocoaEventMouseDown: |
31 mouse_down = 1; | 30 mouse_down = 1; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 ScopedCurrentPluginEvent::ScopedCurrentPluginEvent(PluginInstance* instance, | 96 ScopedCurrentPluginEvent::ScopedCurrentPluginEvent(PluginInstance* instance, |
98 NPCocoaEvent* event) | 97 NPCocoaEvent* event) |
99 : instance_(instance) { | 98 : instance_(instance) { |
100 instance_->set_currently_handled_event(event); | 99 instance_->set_currently_handled_event(event); |
101 } | 100 } |
102 | 101 |
103 ScopedCurrentPluginEvent::~ScopedCurrentPluginEvent() { | 102 ScopedCurrentPluginEvent::~ScopedCurrentPluginEvent() { |
104 instance_->set_currently_handled_event(NULL); | 103 instance_->set_currently_handled_event(NULL); |
105 } | 104 } |
106 | 105 |
107 } // namespace npapi | 106 } // namespace content |
108 } // namespace webkit | |
OLD | NEW |