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 #include <Carbon/Carbon.h> | 5 #include <Carbon/Carbon.h> |
6 | 6 |
7 #include "base/gfx/rect.h" | 7 #include "base/gfx/rect.h" |
8 #include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" | 8 #include "webkit/glue/plugins/fake_plugin_window_tracker_mac.h" |
9 | 9 |
10 namespace webkit_glue { | 10 namespace webkit_glue { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 static void ChromePluginShowWindow(WindowRef window) { | 106 static void ChromePluginShowWindow(WindowRef window) { |
107 SwitchToPluginProcess(); | 107 SwitchToPluginProcess(); |
108 ShowWindow(window); | 108 ShowWindow(window); |
109 webkit_glue::NotifyBrowserOfPluginShowWindow(HIWindowGetCGWindowID(window), | 109 webkit_glue::NotifyBrowserOfPluginShowWindow(HIWindowGetCGWindowID(window), |
110 CGRectForWindow(window)); | 110 CGRectForWindow(window)); |
111 } | 111 } |
112 | 112 |
113 static void ChromePluginDisposeWindow(WindowRef window) { | 113 static void ChromePluginDisposeWindow(WindowRef window) { |
| 114 CGWindowID window_id = HIWindowGetCGWindowID(window); |
| 115 CGRect window_rect = CGRectForWindow(window); |
| 116 DisposeWindow(window); |
| 117 webkit_glue::NotifyBrowserOfPluginDisposeWindow(window_id, window_rect); |
114 MaybeReactivateSavedProcess(); | 118 MaybeReactivateSavedProcess(); |
115 webkit_glue::NotifyBrowserOfPluginDisposeWindow(HIWindowGetCGWindowID(window), | |
116 CGRectForWindow(window)); | |
117 DisposeWindow(window); | |
118 } | 119 } |
119 | 120 |
120 static void ChromePluginHideWindow(WindowRef window) { | 121 static void ChromePluginHideWindow(WindowRef window) { |
| 122 CGWindowID window_id = HIWindowGetCGWindowID(window); |
| 123 CGRect window_rect = CGRectForWindow(window); |
| 124 HideWindow(window); |
| 125 webkit_glue::NotifyBrowserOfPluginHideWindow(window_id, window_rect); |
121 MaybeReactivateSavedProcess(); | 126 MaybeReactivateSavedProcess(); |
122 webkit_glue::NotifyBrowserOfPluginHideWindow(HIWindowGetCGWindowID(window), | |
123 CGRectForWindow(window)); | |
124 HideWindow(window); | |
125 } | 127 } |
126 | 128 |
127 #pragma mark - | 129 #pragma mark - |
128 | 130 |
129 struct interpose_substitution { | 131 struct interpose_substitution { |
130 const void* replacement; | 132 const void* replacement; |
131 const void* original; | 133 const void* original; |
132 }; | 134 }; |
133 | 135 |
134 #define INTERPOSE_FUNCTION(function) \ | 136 #define INTERPOSE_FUNCTION(function) \ |
135 { reinterpret_cast<const void*>(ChromePlugin##function), \ | 137 { reinterpret_cast<const void*>(ChromePlugin##function), \ |
136 reinterpret_cast<const void*>(function) } | 138 reinterpret_cast<const void*>(function) } |
137 | 139 |
138 __attribute__((used)) static const interpose_substitution substitutions[] | 140 __attribute__((used)) static const interpose_substitution substitutions[] |
139 __attribute__((section("__DATA, __interpose"))) = { | 141 __attribute__((section("__DATA, __interpose"))) = { |
140 INTERPOSE_FUNCTION(IsWindowHilited), | 142 INTERPOSE_FUNCTION(IsWindowHilited), |
141 INTERPOSE_FUNCTION(SelectWindow), | 143 INTERPOSE_FUNCTION(SelectWindow), |
142 INTERPOSE_FUNCTION(ShowWindow), | 144 INTERPOSE_FUNCTION(ShowWindow), |
143 INTERPOSE_FUNCTION(DisposeWindow), | 145 INTERPOSE_FUNCTION(DisposeWindow), |
144 INTERPOSE_FUNCTION(HideWindow), | 146 INTERPOSE_FUNCTION(HideWindow), |
145 }; | 147 }; |
OLD | NEW |