Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_node_data.h" | 5 #include "components/bookmarks/browser/bookmark_node_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "ui/base/dragdrop/drag_and_drop_url_utils.h" | |
| 10 #include "ui/base/dragdrop/os_exchange_data.h" | 11 #include "ui/base/dragdrop/os_exchange_data.h" |
| 11 #include "url/url_constants.h" | 12 #include "url/url_constants.h" |
| 12 | 13 |
| 13 namespace bookmarks { | 14 namespace bookmarks { |
| 14 | 15 |
| 15 // static | 16 // static |
| 16 const ui::Clipboard::FormatType& BookmarkNodeData::GetBookmarkFormatType() { | 17 const ui::Clipboard::FormatType& BookmarkNodeData::GetBookmarkFormatType() { |
| 17 CR_DEFINE_STATIC_LOCAL( | 18 CR_DEFINE_STATIC_LOCAL( |
| 18 ui::Clipboard::FormatType, | 19 ui::Clipboard::FormatType, |
| 19 format, | 20 format, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 48 profile_path_.clear(); | 49 profile_path_.clear(); |
| 49 | 50 |
| 50 if (data.HasCustomFormat(GetBookmarkFormatType())) { | 51 if (data.HasCustomFormat(GetBookmarkFormatType())) { |
| 51 base::Pickle drag_data_pickle; | 52 base::Pickle drag_data_pickle; |
| 52 if (data.GetPickledData(GetBookmarkFormatType(), &drag_data_pickle)) { | 53 if (data.GetPickledData(GetBookmarkFormatType(), &drag_data_pickle)) { |
| 53 if (!ReadFromPickle(&drag_data_pickle)) | 54 if (!ReadFromPickle(&drag_data_pickle)) |
| 54 return false; | 55 return false; |
| 55 } | 56 } |
| 56 } else { | 57 } else { |
| 57 // See if there is a URL on the clipboard. | 58 // See if there is a URL on the clipboard. |
| 58 GURL url; | 59 if (auto url_and_title = ui::TryToInterpretAsURL( |
|
dyaroshev
2016/09/14 17:12:05
No checks on the validity of url here, unlike othe
Peter Kasting
2016/09/15 21:26:53
See other replies
| |
| 59 base::string16 title; | 60 data, ui::OSExchangeData::CONVERT_FILENAMES)) { |
| 60 if (data.GetURLAndTitle( | 61 ReadFromTuple(url_and_title->first, url_and_title->second); |
| 61 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) | 62 } |
| 62 ReadFromTuple(url, title); | |
| 63 } | 63 } |
| 64 | 64 |
| 65 return is_valid(); | 65 return is_valid(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace bookmarks | 68 } // namespace bookmarks |
| OLD | NEW |