Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/bookmarks/bookmark_node_data.h" | 5 #include "chrome/browser/bookmarks/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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(), | 136 ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(), |
| 137 ui::Clipboard::BUFFER_STANDARD); | 137 ui::Clipboard::BUFFER_STANDARD); |
| 138 | 138 |
| 139 // If there is only one element and it is a URL, write the URL to the | 139 // If there is only one element and it is a URL, write the URL to the |
| 140 // clipboard. | 140 // clipboard. |
| 141 if (elements.size() == 1 && elements[0].is_url) { | 141 if (elements.size() == 1 && elements[0].is_url) { |
| 142 const string16& title = elements[0].title; | 142 const string16& title = elements[0].title; |
| 143 const std::string url = elements[0].url.spec(); | 143 const std::string url = elements[0].url.spec(); |
| 144 | 144 |
| 145 scw.WriteBookmark(title, url); | 145 scw.WriteBookmark(title, url); |
| 146 scw.WriteHyperlink(title, url); | 146 |
| 147 // Previously scw.WriteHyperlink was called here. Purposfully don't write | |
|
Peter Kasting
2013/10/07 22:19:23
Nit: Shorter and more direct: "Don't call scw.Writ
| |
| 148 // hyperlink data, since some rich text editors will change fonts when | |
| 149 // such data is pasted in; besides, most such editors auto-linkify at some | |
| 150 // point anyway. | |
| 147 | 151 |
| 148 // Also write the URL to the clipboard as text so that it can be pasted | 152 // Also write the URL to the clipboard as text so that it can be pasted |
| 149 // into text fields. We use WriteText instead of WriteURL because we don't | 153 // into text fields. We use WriteText instead of WriteURL because we don't |
| 150 // want to clobber the X clipboard when the user copies out of the omnibox | 154 // want to clobber the X clipboard when the user copies out of the omnibox |
| 151 // on Linux (on Windows and Mac, there is no difference between these | 155 // on Linux (on Windows and Mac, there is no difference between these |
| 152 // functions). | 156 // functions). |
| 153 scw.WriteText(UTF8ToUTF16(url)); | 157 scw.WriteText(UTF8ToUTF16(url)); |
| 154 } | 158 } |
| 155 | 159 |
| 156 Pickle pickle; | 160 Pickle pickle; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 DCHECK(profile_path_.empty()); | 253 DCHECK(profile_path_.empty()); |
| 250 | 254 |
| 251 if (profile) | 255 if (profile) |
| 252 profile_path_ = profile->GetPath(); | 256 profile_path_ = profile->GetPath(); |
| 253 } | 257 } |
| 254 | 258 |
| 255 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { | 259 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { |
| 256 // An empty path means the data is not associated with any profile. | 260 // An empty path means the data is not associated with any profile. |
| 257 return !profile_path_.empty() && profile_path_ == profile->GetPath(); | 261 return !profile_path_.empty() && profile_path_ == profile->GetPath(); |
| 258 } | 262 } |
| OLD | NEW |