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 #if !defined(OS_WIN) | |
|
Peter Kasting
2013/10/05 00:42:27
This makes me wonder if we should also avoid writi
scottmg
2013/10/07 22:16:27
I confirmed that the behaviour is same (font-prese
| |
| 147 // http://crbug.com/976. We don't want hyperlink formatted text on Windows | |
| 148 // as that carries font information which can be annoying to remove when | |
| 149 // pasting into other programs. | |
|
Peter Kasting
2013/10/05 00:42:27
Nit: I generally try to avoid bug links, since the
scottmg
2013/10/07 22:16:27
Done.
| |
| 146 scw.WriteHyperlink(title, url); | 150 scw.WriteHyperlink(title, url); |
| 151 #endif | |
| 147 | 152 |
| 148 // Also write the URL to the clipboard as text so that it can be pasted | 153 // 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 | 154 // 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 | 155 // 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 | 156 // on Linux (on Windows and Mac, there is no difference between these |
| 152 // functions). | 157 // functions). |
| 153 scw.WriteText(UTF8ToUTF16(url)); | 158 scw.WriteText(UTF8ToUTF16(url)); |
| 154 } | 159 } |
| 155 | 160 |
| 156 Pickle pickle; | 161 Pickle pickle; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 DCHECK(profile_path_.empty()); | 254 DCHECK(profile_path_.empty()); |
| 250 | 255 |
| 251 if (profile) | 256 if (profile) |
| 252 profile_path_ = profile->GetPath(); | 257 profile_path_ = profile->GetPath(); |
| 253 } | 258 } |
| 254 | 259 |
| 255 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { | 260 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { |
| 256 // An empty path means the data is not associated with any profile. | 261 // An empty path means the data is not associated with any profile. |
| 257 return !profile_path_.empty() && profile_path_ == profile->GetPath(); | 262 return !profile_path_.empty() && profile_path_ == profile->GetPath(); |
| 258 } | 263 } |
| OLD | NEW |