diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-28 00:53:22 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-28 00:53:22 +0000 |
commit | 43868c50d991fc5d548b74451f4f4d0b03eedd04 (patch) | |
tree | 82a9438df800f2a8fc64e6ed12126519ad7f5c51 /chrome/browser/bookmarks/bookmark_drag_data.cc | |
parent | cbc43fc87b9db405002eef9c769b39a192c4147c (diff) | |
download | chromium_src-43868c50d991fc5d548b74451f4f4d0b03eedd04.zip chromium_src-43868c50d991fc5d548b74451f4f4d0b03eedd04.tar.gz chromium_src-43868c50d991fc5d548b74451f4f4d0b03eedd04.tar.bz2 |
Make it so the user can't drag javascript: links to the
desktop from web content or the bookmarks bar. Maintain
the ability to drag javascript: links from web content
to the bookmarks bar or to drag the javascript: link as
plain text.
BUG=3431
Review URL: http://codereview.chromium.org/8638
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_drag_data.cc')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_drag_data.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/bookmarks/bookmark_drag_data.cc b/chrome/browser/bookmarks/bookmark_drag_data.cc index 85911a7..c55d24f 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data.cc +++ b/chrome/browser/bookmarks/bookmark_drag_data.cc @@ -5,6 +5,7 @@ #include "chrome/browser/bookmarks/bookmark_drag_data.h" #include "base/pickle.h" +#include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/profile.h" #include "chrome/common/os_exchange_data.h" @@ -82,8 +83,13 @@ void BookmarkDragData::Write(Profile* profile, OSExchangeData* data) const { // If there is only one element and it is a URL, write the URL to the // clipboard. - if (elements.size() == 1 && elements[0].is_url) - data->SetURL(elements[0].url, elements[0].title); + if (elements.size() == 1 && elements[0].is_url) { + if (elements[0].url.SchemeIs("javascript")) { + data->SetString(ASCIIToWide(elements[0].url.spec())); + } else { + data->SetURL(elements[0].url, elements[0].title); + } + } Pickle data_pickle; data_pickle.WriteWString(profile->GetPath()); |