Chromium Code Reviews| Index: content/browser/safe_util_win.cc |
| diff --git a/content/browser/safe_util_win.cc b/content/browser/safe_util_win.cc |
| index 2dce2ca10f1a8fa0bf82bea6796476df7c6108d9..bbf9ca41c1face909ad41f5f58e3f25b0343689f 100644 |
| --- a/content/browser/safe_util_win.cc |
| +++ b/content/browser/safe_util_win.cc |
| @@ -25,36 +25,6 @@ namespace { |
| static const GUID kClientID = { 0x2676a9a2, 0xd919, 0x4fee, |
|
Lei Zhang
2013/08/03 00:28:26
Do we want to expose the copy in base and get rid
Greg Billock
2013/08/05 21:42:30
Done.
|
| { 0x91, 0x87, 0x15, 0x21, 0x0, 0x39, 0x3a, 0xb2 } }; |
| -// Sets the Zone Identifier on the file to "Internet" (3). Returns true if the |
| -// function succeeds, false otherwise. A failure is expected on system where |
| -// the Zone Identifier is not supported, like a machine with a FAT32 filesystem. |
| -// This function does not invoke Windows Attachment Execution Services. |
| -// |
| -// |full_path| is the path to the downloaded file. |
| -bool SetInternetZoneIdentifierDirectly(const base::FilePath& full_path) { |
| - const DWORD kShare = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; |
| - std::wstring path = full_path.value() + L":Zone.Identifier"; |
| - HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, kShare, NULL, |
| - OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); |
| - if (INVALID_HANDLE_VALUE == file) |
| - return false; |
| - |
| - static const char kIdentifier[] = "[ZoneTransfer]\r\nZoneId=3\r\n"; |
| - // Don't include trailing null in data written. |
| - static const DWORD kIdentifierSize = arraysize(kIdentifier) - 1; |
| - DWORD written = 0; |
| - BOOL result = WriteFile(file, kIdentifier, kIdentifierSize, &written, NULL); |
| - BOOL flush_result = FlushFileBuffers(file); |
| - CloseHandle(file); |
| - |
| - if (!result || !flush_result || written != kIdentifierSize) { |
| - NOTREACHED(); |
| - return false; |
| - } |
| - |
| - return true; |
| -} |
| - |
| } |
| // This function implementation is based on the attachment execution |
| @@ -119,37 +89,4 @@ bool SaferOpenItemViaShell(HWND hwnd, const std::wstring& window_title, |
| return ui::win::OpenItemViaShellNoZoneCheck(full_path); |
| } |
| -HRESULT ScanAndSaveDownloadedFile(const base::FilePath& full_path, |
| - const GURL& source_url) { |
| - base::win::ScopedComPtr<IAttachmentExecute> attachment_services; |
| - HRESULT hr = attachment_services.CreateInstance(CLSID_AttachmentServices); |
| - |
| - if (FAILED(hr)) { |
| - // The thread must have COM initialized. |
| - DCHECK_NE(CO_E_NOTINITIALIZED, hr); |
| - |
| - // We don't have Attachment Execution Services, it must be a pre-XP.SP2 |
| - // Windows installation, or the thread does not have COM initialized. Try to |
| - // set the zone information directly. Failure is not considered an error. |
| - SetInternetZoneIdentifierDirectly(full_path); |
| - return hr; |
| - } |
| - |
| - hr = attachment_services->SetClientGuid(kClientID); |
| - if (FAILED(hr)) |
| - return hr; |
| - |
| - hr = attachment_services->SetLocalPath(full_path.value().c_str()); |
| - if (FAILED(hr)) |
| - return hr; |
| - |
| - hr = attachment_services->SetSource(UTF8ToWide(source_url.spec()).c_str()); |
| - if (FAILED(hr)) |
| - return hr; |
| - |
| - // A failure in the Save() call below could result in the downloaded file |
| - // being deleted. |
| - return attachment_services->Save(); |
| -} |
| - |
| } // namespace content |