OLD | NEW |
1 // Copyright 2009, Google Inc. All rights reserved. | 1 // Copyright 2009, Google Inc. All rights reserved. |
2 // Portions of this file were adapted from the Mozilla project. | 2 // Portions of this file were adapted from the Mozilla project. |
3 // See https://developer.mozilla.org/en/ActiveX_Control_for_Hosting_Netscape_Plu
g-ins_in_IE | 3 // See https://developer.mozilla.org/en/ActiveX_Control_for_Hosting_Netscape_Plu
g-ins_in_IE |
4 /* ***** BEGIN LICENSE BLOCK ***** | 4 /* ***** BEGIN LICENSE BLOCK ***** |
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
6 * | 6 * |
7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 CComPtr<IDispatchEx> dispatch_ex(NULL); | 152 CComPtr<IDispatchEx> dispatch_ex(NULL); |
153 HRESULT hr = it->second.QueryInterface(&dispatch_ex); | 153 HRESULT hr = it->second.QueryInterface(&dispatch_ex); |
154 if (SUCCEEDED(hr)) { | 154 if (SUCCEEDED(hr)) { |
155 return dispatch_ex; | 155 return dispatch_ex; |
156 } else { | 156 } else { |
157 return NULL; | 157 return NULL; |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 // Create a new NPObject proxy, register it for future use and return it. | 161 // Create a new NPObject proxy, register it for future use and return it. |
| 162 CComObject<NPObjectProxy>* proxy_instance; |
| 163 HRESULT hr = CComObject<NPObjectProxy>::CreateInstance(&proxy_instance); |
| 164 if (FAILED(hr)) |
| 165 return NULL; |
| 166 |
162 CComPtr<INPObjectProxy> proxy_wrapper; | 167 CComPtr<INPObjectProxy> proxy_wrapper; |
163 HRESULT hr = NPObjectProxy::CreateInstance(&proxy_wrapper); | 168 hr = proxy_instance->QueryInterface(&proxy_wrapper); |
164 if (SUCCEEDED(hr)) { | 169 if (SUCCEEDED(hr)) { |
165 proxy_wrapper->SetBrowserProxy(this); | 170 proxy_wrapper->SetBrowserProxy(this); |
166 proxy_wrapper->SetHostedObject(np_object); | 171 proxy_wrapper->SetHostedObject(np_object); |
167 RegisterNPObjectProxy(np_object, proxy_wrapper); | 172 RegisterNPObjectProxy(np_object, proxy_wrapper); |
168 | 173 |
169 CComPtr<IDispatchEx> dispatch_proxy_wrapper; | 174 CComPtr<IDispatchEx> dispatch_proxy_wrapper; |
170 hr = proxy_wrapper.QueryInterface(&dispatch_proxy_wrapper); | 175 hr = proxy_wrapper.QueryInterface(&dispatch_proxy_wrapper); |
171 ATLASSERT(SUCCEEDED(hr)); | 176 ATLASSERT(SUCCEEDED(hr)); |
172 return dispatch_proxy_wrapper; | 177 return dispatch_proxy_wrapper; |
173 } | 178 } |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 // All NPObjectProxy instances stored in the java-script environment must | 825 // All NPObjectProxy instances stored in the java-script environment must |
821 // be marked so that scripted operations on these operations fail after | 826 // be marked so that scripted operations on these operations fail after |
822 // the plug-in has been torn down. We release the hosted object on all of | 827 // the plug-in has been torn down. We release the hosted object on all of |
823 // these wrappers to prevent access, and allow deletion of the NPAPI objects. | 828 // these wrappers to prevent access, and allow deletion of the NPAPI objects. |
824 NPObjectProxyMap::iterator np_object_iter(np_object_proxy_map_.begin()), | 829 NPObjectProxyMap::iterator np_object_iter(np_object_proxy_map_.begin()), |
825 np_object_end(np_object_proxy_map_.end()); | 830 np_object_end(np_object_proxy_map_.end()); |
826 for (; np_object_iter != np_object_end; ++np_object_iter) { | 831 for (; np_object_iter != np_object_end; ++np_object_iter) { |
827 np_object_iter->second->ReleaseHosted(); | 832 np_object_iter->second->ReleaseHosted(); |
828 } | 833 } |
829 } | 834 } |
OLD | NEW |