Add a unit test that filenames aren't unintentionally converted to URLs.

Also fixes two issues in OSExchangeDataProviderWin:
- It used a disjoint set of clipboard formats when handling
  GetUrl(..., true /* filename conversion */) vs GetFilenames(...), so the
  actual returned results would vary depending on which one was called.
- It incorrectly used ::DragFinish() instead of ::ReleaseStgMedium().
  ::DragFinish() is only meant to be used in conjunction with WM_DROPFILES.

BUG=346135

Review URL: https://codereview.chromium.org/380553002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283226 0039d316-1c4b-4281-b951-d872f2087c98
 bool ClipboardUtil::GetHtml(IDataObject* data_object,
                            base::string16* html, std::string* base_url) {
  DCHECK(data_object && html && base_url);

  STGMEDIUM store;
  if (HasData(data_object, Clipboard::GetHtmlFormatType()) &&
       GetData(data_object, Clipboard::GetHtmlFormatType(), &store)) {
     {
      base::win::ScopedHGlobal<char*> data(store.hGlobal);
 
       std::string html_utf8;
       CFHtmlToHtml(std::string(data.get(), data.Size()), &html_utf8, base_url);
      html->assign(base::UTF8ToWide(html_utf8));
    }
    ReleaseStgMedium(&store);
    return true;
  }

  if (!HasData(data_object, Clipboard::GetTextHtmlFormatType()))
    return false;

  if (!GetData(data_object, Clipboard::GetTextHtmlFormatType(), &store))
    return false;
 
   {
    base::win::ScopedHGlobal<wchar_t*> data(store.hGlobal);
     html->assign(data.get());
   }
   ReleaseStgMedium(&store);
  return true;
}

 bool ClipboardUtil::GetHtml(IDataObject* data_object,
                            base::string16* html, std::string* base_url) {
  DCHECK(data_object && html && base_url);

  STGMEDIUM store;
  if (HasData(data_object, Clipboard::GetHtmlFormatType()) &&
       GetData(data_object, Clipboard::GetHtmlFormatType(), &store)) {
     {
      base::win::ScopedHGlobal<char> data(store.hGlobal);
 
       std::string html_utf8;
       CFHtmlToHtml(std::string(data.get(), data.Size()), &html_utf8, base_url);
      html->assign(base::UTF8ToWide(html_utf8));
    }
    ReleaseStgMedium(&store);
    return true;
  }

  if (!HasData(data_object, Clipboard::GetTextHtmlFormatType()))
    return false;

  if (!GetData(data_object, Clipboard::GetTextHtmlFormatType(), &store))
    return false;
 
   {
    base::win::ScopedHGlobal<wchar_t> data(store.hGlobal);
     html->assign(data.get());
   }
   ReleaseStgMedium(&store);
  return true;
}
