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 #include "chrome_frame/chrome_frame_activex.h" | 5 #include "chrome_frame/chrome_frame_activex.h" |
6 | 6 |
7 #include <wininet.h> | 7 #include <wininet.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 Fire_onmessage(message_event); | 239 Fire_onmessage(message_event); |
240 | 240 |
241 FireEvent(onmessage_, message_event); | 241 FireEvent(onmessage_, message_event); |
242 | 242 |
243 base::win::ScopedVariant event_var; | 243 base::win::ScopedVariant event_var; |
244 event_var.Set(static_cast<IDispatch*>(message_event)); | 244 event_var.Set(static_cast<IDispatch*>(message_event)); |
245 InvokeScriptFunction(onmessage_handler_, event_var.AsInput()); | 245 InvokeScriptFunction(onmessage_handler_, event_var.AsInput()); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
| 249 bool ChromeFrameActivex::ShouldShowVersionMismatchDialog( |
| 250 bool is_privileged, |
| 251 IOleClientSite* client_site) { |
| 252 if (!is_privileged) { |
| 253 return true; |
| 254 } |
| 255 |
| 256 if (client_site) { |
| 257 ScopedComPtr<IChromeFramePrivileged> service; |
| 258 HRESULT hr = DoQueryService(SID_ChromeFramePrivileged, |
| 259 client_site, |
| 260 service.Receive()); |
| 261 if (SUCCEEDED(hr) && service) { |
| 262 return (S_FALSE != service->ShouldShowVersionMismatchDialog()); |
| 263 } |
| 264 } |
| 265 |
| 266 NOTREACHED(); |
| 267 return true; |
| 268 } |
| 269 |
249 void ChromeFrameActivex::OnAutomationServerLaunchFailed( | 270 void ChromeFrameActivex::OnAutomationServerLaunchFailed( |
250 AutomationLaunchResult reason, const std::string& server_version) { | 271 AutomationLaunchResult reason, const std::string& server_version) { |
251 Base::OnAutomationServerLaunchFailed(reason, server_version); | 272 Base::OnAutomationServerLaunchFailed(reason, server_version); |
252 | 273 |
253 // Do not display warnings for privileged instances of Chrome Frame. | 274 if (reason == AUTOMATION_VERSION_MISMATCH && |
254 if (reason == AUTOMATION_VERSION_MISMATCH && !is_privileged_) { | 275 ShouldShowVersionMismatchDialog(is_privileged_, m_spClientSite)) { |
255 THREAD_SAFE_UMA_HISTOGRAM_COUNTS("ChromeFrame.VersionMismatchDisplayed", 1); | 276 THREAD_SAFE_UMA_HISTOGRAM_COUNTS( |
| 277 "ChromeFrame.VersionMismatchDisplayed", 1); |
256 DisplayVersionMismatchWarning(m_hWnd, server_version); | 278 DisplayVersionMismatchWarning(m_hWnd, server_version); |
257 } | 279 } |
258 } | 280 } |
259 | 281 |
260 void ChromeFrameActivex::OnExtensionInstalled( | 282 void ChromeFrameActivex::OnExtensionInstalled( |
261 const FilePath& path, | 283 const FilePath& path, |
262 void* user_data, | 284 void* user_data, |
263 AutomationMsg_ExtensionResponseValues response) { | 285 AutomationMsg_ExtensionResponseValues response) { |
264 base::win::ScopedBstr path_str(path.value().c_str()); | 286 base::win::ScopedBstr path_str(path.value().c_str()); |
265 Fire_onextensionready(path_str, response); | 287 Fire_onextensionready(path_str, response); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 if (FAILED(hr)) { | 686 if (FAILED(hr)) { |
665 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" | 687 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" |
666 << base::StringPrintf(" 0x%08X", hr); | 688 << base::StringPrintf(" 0x%08X", hr); |
667 return hr; | 689 return hr; |
668 } | 690 } |
669 | 691 |
670 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), | 692 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), |
671 base::win::ScopedVariant(bho)); | 693 base::win::ScopedVariant(bho)); |
672 return S_OK; | 694 return S_OK; |
673 } | 695 } |
OLD | NEW |