| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <shlobj.h> | 5 #include <shlobj.h> |
| 6 #include <shobjidl.h> | 6 #include <shobjidl.h> |
| 7 #include <atlcomcli.h> | 7 #include <atlcomcli.h> |
| 8 | 8 |
| 9 #include "chrome/common/win_safe_util.h" | 9 #include "chrome/common/win_safe_util.h" |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 #endif // __IAttachmentExecute_INTERFACE_DEFINED__ | 83 #endif // __IAttachmentExecute_INTERFACE_DEFINED__ |
| 84 | 84 |
| 85 // This function implementation is based on the attachment execution | 85 // This function implementation is based on the attachment execution |
| 86 // services functionally deployed with IE6 or Service pack 2. This | 86 // services functionally deployed with IE6 or Service pack 2. This |
| 87 // functionality is exposed in the IAttachmentExecute COM interface. | 87 // functionality is exposed in the IAttachmentExecute COM interface. |
| 88 // more information at: | 88 // more information at: |
| 89 // http://msdn2.microsoft.com/en-us/library/ms647048.aspx | 89 // http://msdn2.microsoft.com/en-us/library/ms647048.aspx |
| 90 bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title, | 90 bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title, |
| 91 const std::wstring& full_path, | 91 const FilePath& full_path, |
| 92 const std::wstring& source_url, | 92 const std::wstring& source_url, |
| 93 bool ask_for_app) { | 93 bool ask_for_app) { |
| 94 ATL::CComPtr<IAttachmentExecute> attachment_services; | 94 ATL::CComPtr<IAttachmentExecute> attachment_services; |
| 95 HRESULT hr = attachment_services.CoCreateInstance(CLSID_AttachmentServices); | 95 HRESULT hr = attachment_services.CoCreateInstance(CLSID_AttachmentServices); |
| 96 if (FAILED(hr)) { | 96 if (FAILED(hr)) { |
| 97 // We don't have Attachment Execution Services, it must be a pre-XP.SP2 | 97 // We don't have Attachment Execution Services, it must be a pre-XP.SP2 |
| 98 // Windows installation, or the thread does not have COM initialized. | 98 // Windows installation, or the thread does not have COM initialized. |
| 99 if (hr == CO_E_NOTINITIALIZED) { | 99 if (hr == CO_E_NOTINITIALIZED) { |
| 100 NOTREACHED(); | 100 NOTREACHED(); |
| 101 return false; | 101 return false; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (!result || written != arraysize(kIdentifier)) { | 178 if (!result || written != arraysize(kIdentifier)) { |
| 179 DCHECK(FALSE); | 179 DCHECK(FALSE); |
| 180 return false; | 180 return false; |
| 181 } | 181 } |
| 182 | 182 |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace win_util | 186 } // namespace win_util |
| 187 | 187 |
| OLD | NEW |