| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 elements.push_back(element); | 151 elements.push_back(element); |
| 152 | 152 |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 #if !defined(OS_MACOSX) | 156 #if !defined(OS_MACOSX) |
| 157 void BookmarkNodeData::WriteToClipboard(ui::ClipboardType clipboard_type) { | 157 void BookmarkNodeData::WriteToClipboard(ui::ClipboardType clipboard_type) { |
| 158 DCHECK(clipboard_type == ui::CLIPBOARD_TYPE_COPY_PASTE || | 158 DCHECK(clipboard_type == ui::CLIPBOARD_TYPE_COPY_PASTE || |
| 159 clipboard_type == ui::CLIPBOARD_TYPE_SELECTION); | 159 clipboard_type == ui::CLIPBOARD_TYPE_SELECTION); |
| 160 ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(), | 160 ui::ScopedClipboardWriter scw(clipboard_type); |
| 161 clipboard_type); | |
| 162 | 161 |
| 163 // If there is only one element and it is a URL, write the URL to the | 162 // If there is only one element and it is a URL, write the URL to the |
| 164 // clipboard. | 163 // clipboard. |
| 165 if (elements.size() == 1 && elements[0].is_url) { | 164 if (elements.size() == 1 && elements[0].is_url) { |
| 166 const base::string16& title = elements[0].title; | 165 const base::string16& title = elements[0].title; |
| 167 const std::string url = elements[0].url.spec(); | 166 const std::string url = elements[0].url.spec(); |
| 168 | 167 |
| 169 scw.WriteBookmark(title, url); | 168 scw.WriteBookmark(title, url); |
| 170 | 169 |
| 171 // Don't call scw.WriteHyperlink() here, since some rich text editors will | 170 // Don't call scw.WriteHyperlink() here, since some rich text editors will |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 profile_path_ = profile_path; | 280 profile_path_ = profile_path; |
| 282 } | 281 } |
| 283 | 282 |
| 284 bool BookmarkNodeData::IsFromProfilePath( | 283 bool BookmarkNodeData::IsFromProfilePath( |
| 285 const base::FilePath& profile_path) const { | 284 const base::FilePath& profile_path) const { |
| 286 // An empty path means the data is not associated with any profile. | 285 // An empty path means the data is not associated with any profile. |
| 287 return !profile_path_.empty() && profile_path_ == profile_path; | 286 return !profile_path_.empty() && profile_path_ == profile_path; |
| 288 } | 287 } |
| 289 | 288 |
| 290 } // namespace bookmarks | 289 } // namespace bookmarks |
| OLD | NEW |