| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #if !defined(__LP64__) | 5 #if !defined(__LP64__) |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
| 8 | 8 |
| 9 #include "chrome/plugin/plugin_interpose_util_mac.h" | 9 #include "chrome/plugin/plugin_interpose_util_mac.h" |
| 10 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
| 11 #include "webkit/plugins/npapi/carbon_plugin_window_tracker_mac.h" | 11 #include "webkit/glue/plugins/carbon_plugin_window_tracker_mac.h" |
| 12 | 12 |
| 13 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 13 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 14 | 14 |
| 15 // Returns true if the given window is modal. | 15 // Returns true if the given window is modal. |
| 16 static bool IsModalWindow(WindowRef window) { | 16 static bool IsModalWindow(WindowRef window) { |
| 17 WindowModality modality = kWindowModalityNone; | 17 WindowModality modality = kWindowModalityNone; |
| 18 WindowRef modal_target = NULL; | 18 WindowRef modal_target = NULL; |
| 19 OSStatus status = GetWindowModality(window, &modality, &modal_target); | 19 OSStatus status = GetWindowModality(window, &modality, &modal_target); |
| 20 return (status == noErr) && (modality != kWindowModalityNone); | 20 return (status == noErr) && (modality != kWindowModalityNone); |
| 21 } | 21 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 static void OnPluginWindowSelected(WindowRef window) { | 54 static void OnPluginWindowSelected(WindowRef window) { |
| 55 mac_plugin_interposing::NotifyBrowserOfPluginSelectWindow( | 55 mac_plugin_interposing::NotifyBrowserOfPluginSelectWindow( |
| 56 HIWindowGetCGWindowID(window), CGRectForWindow(window), | 56 HIWindowGetCGWindowID(window), CGRectForWindow(window), |
| 57 IsModalWindow(window)); | 57 IsModalWindow(window)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 #pragma mark - | 60 #pragma mark - |
| 61 | 61 |
| 62 static Boolean ChromePluginIsWindowActive(WindowRef window) { | 62 static Boolean ChromePluginIsWindowActive(WindowRef window) { |
| 63 const OpaquePluginRef delegate = | 63 const OpaquePluginRef delegate = |
| 64 webkit::npapi::CarbonPluginWindowTracker::SharedInstance()-> | 64 CarbonPluginWindowTracker::SharedInstance()->GetDelegateForDummyWindow( |
| 65 GetDelegateForDummyWindow(window); | 65 window); |
| 66 return delegate ? IsContainingWindowActive(delegate) | 66 return delegate ? IsContainingWindowActive(delegate) |
| 67 : IsWindowActive(window); | 67 : IsWindowActive(window); |
| 68 } | 68 } |
| 69 | 69 |
| 70 static Boolean ChromePluginIsWindowHilited(WindowRef window) { | 70 static Boolean ChromePluginIsWindowHilited(WindowRef window) { |
| 71 const OpaquePluginRef delegate = | 71 const OpaquePluginRef delegate = |
| 72 webkit::npapi::CarbonPluginWindowTracker::SharedInstance()-> | 72 CarbonPluginWindowTracker::SharedInstance()->GetDelegateForDummyWindow( |
| 73 GetDelegateForDummyWindow(window); | 73 window); |
| 74 return delegate ? IsContainingWindowActive(delegate) | 74 return delegate ? IsContainingWindowActive(delegate) |
| 75 : IsWindowHilited(window); | 75 : IsWindowHilited(window); |
| 76 } | 76 } |
| 77 | 77 |
| 78 static void ChromePluginSelectWindow(WindowRef window) { | 78 static void ChromePluginSelectWindow(WindowRef window) { |
| 79 mac_plugin_interposing::SwitchToPluginProcess(); | 79 mac_plugin_interposing::SwitchToPluginProcess(); |
| 80 SelectWindow(window); | 80 SelectWindow(window); |
| 81 OnPluginWindowSelected(window); | 81 OnPluginWindowSelected(window); |
| 82 } | 82 } |
| 83 | 83 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 static void ChromePluginDisposeDialog(DialogRef dialog) { | 120 static void ChromePluginDisposeDialog(DialogRef dialog) { |
| 121 WindowRef window = GetDialogWindow(dialog); | 121 WindowRef window = GetDialogWindow(dialog); |
| 122 WindowInfo window_info(window); | 122 WindowInfo window_info(window); |
| 123 DisposeDialog(dialog); | 123 DisposeDialog(dialog); |
| 124 OnPluginWindowClosed(window_info); | 124 OnPluginWindowClosed(window_info); |
| 125 } | 125 } |
| 126 | 126 |
| 127 static WindowPartCode ChromePluginFindWindow(Point point, WindowRef* window) { | 127 static WindowPartCode ChromePluginFindWindow(Point point, WindowRef* window) { |
| 128 OpaquePluginRef delegate = mac_plugin_interposing::GetActiveDelegate(); | 128 OpaquePluginRef delegate = mac_plugin_interposing::GetActiveDelegate(); |
| 129 webkit::npapi::CarbonPluginWindowTracker* tracker = | 129 CarbonPluginWindowTracker* tracker = |
| 130 webkit::npapi::CarbonPluginWindowTracker::SharedInstance(); | 130 CarbonPluginWindowTracker::SharedInstance(); |
| 131 WindowRef plugin_window = tracker->GetDummyWindowForDelegate(delegate); | 131 WindowRef plugin_window = tracker->GetDummyWindowForDelegate(delegate); |
| 132 if (plugin_window) { | 132 if (plugin_window) { |
| 133 // If plugin_window is non-NULL, then we are in the middle of routing an | 133 // If plugin_window is non-NULL, then we are in the middle of routing an |
| 134 // event to the plugin, so we know it's destined for this window already, | 134 // event to the plugin, so we know it's destined for this window already, |
| 135 // so we don't have to worry that we'll be stealing an event meant for an | 135 // so we don't have to worry that we'll be stealing an event meant for an |
| 136 // overlapping window. | 136 // overlapping window. |
| 137 Rect window_bounds; | 137 Rect window_bounds; |
| 138 GetWindowBounds(plugin_window, kWindowContentRgn, &window_bounds); | 138 GetWindowBounds(plugin_window, kWindowContentRgn, &window_bounds); |
| 139 if (PtInRect(point, &window_bounds)) { | 139 if (PtInRect(point, &window_bounds)) { |
| 140 if (window) | 140 if (window) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 INTERPOSE_FUNCTION(DisposeWindow), | 184 INTERPOSE_FUNCTION(DisposeWindow), |
| 185 INTERPOSE_FUNCTION(HideWindow), | 185 INTERPOSE_FUNCTION(HideWindow), |
| 186 INTERPOSE_FUNCTION(ReleaseWindow), | 186 INTERPOSE_FUNCTION(ReleaseWindow), |
| 187 INTERPOSE_FUNCTION(DisposeDialog), | 187 INTERPOSE_FUNCTION(DisposeDialog), |
| 188 INTERPOSE_FUNCTION(FindWindow), | 188 INTERPOSE_FUNCTION(FindWindow), |
| 189 INTERPOSE_FUNCTION(SetThemeCursor), | 189 INTERPOSE_FUNCTION(SetThemeCursor), |
| 190 INTERPOSE_FUNCTION(SetCursor), | 190 INTERPOSE_FUNCTION(SetCursor), |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 #endif // !__LP64__ | 193 #endif // !__LP64__ |
| OLD | NEW |