| 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 // Don't call scw.WriteHyperlink() here, since some rich text editors will |
| 148 // change fonts when such data is pasted in; besides, most such editors |
| 149 // auto-linkify at some point anyway. |
| 147 | 150 |
| 148 // Also write the URL to the clipboard as text so that it can be pasted | 151 // 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 | 152 // 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 | 153 // 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 | 154 // on Linux (on Windows and Mac, there is no difference between these |
| 152 // functions). | 155 // functions). |
| 153 scw.WriteText(UTF8ToUTF16(url)); | 156 scw.WriteText(UTF8ToUTF16(url)); |
| 154 } | 157 } |
| 155 | 158 |
| 156 Pickle pickle; | 159 Pickle pickle; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 DCHECK(profile_path_.empty()); | 252 DCHECK(profile_path_.empty()); |
| 250 | 253 |
| 251 if (profile) | 254 if (profile) |
| 252 profile_path_ = profile->GetPath(); | 255 profile_path_ = profile->GetPath(); |
| 253 } | 256 } |
| 254 | 257 |
| 255 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { | 258 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { |
| 256 // An empty path means the data is not associated with any profile. | 259 // An empty path means the data is not associated with any profile. |
| 257 return !profile_path_.empty() && profile_path_ == profile->GetPath(); | 260 return !profile_path_.empty() && profile_path_ == profile->GetPath(); |
| 258 } | 261 } |
| OLD | NEW |