OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 element.url = url; | 133 element.url = url; |
134 element.is_url = true; | 134 element.is_url = true; |
135 | 135 |
136 elements.push_back(element); | 136 elements.push_back(element); |
137 | 137 |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 #if !defined(OS_MACOSX) | 141 #if !defined(OS_MACOSX) |
142 void BookmarkNodeData::WriteToClipboard(Profile* profile) const { | 142 void BookmarkNodeData::WriteToClipboard(Profile* profile) const { |
143 ui::ScopedClipboardWriter scw(g_browser_process->clipboard()); | 143 ui::ScopedClipboardWriter scw(g_browser_process->clipboard(), |
| 144 ui::Clipboard::BUFFER_STANDARD); |
144 | 145 |
145 // If there is only one element and it is a URL, write the URL to the | 146 // If there is only one element and it is a URL, write the URL to the |
146 // clipboard. | 147 // clipboard. |
147 if (elements.size() == 1 && elements[0].is_url) { | 148 if (elements.size() == 1 && elements[0].is_url) { |
148 const string16& title = elements[0].title; | 149 const string16& title = elements[0].title; |
149 const std::string url = elements[0].url.spec(); | 150 const std::string url = elements[0].url.spec(); |
150 | 151 |
151 scw.WriteBookmark(title, url); | 152 scw.WriteBookmark(title, url); |
152 scw.WriteHyperlink(net::EscapeForHTML(title), url); | 153 scw.WriteHyperlink(net::EscapeForHTML(title), url); |
153 | 154 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 DCHECK(profile_path_.empty()); | 344 DCHECK(profile_path_.empty()); |
344 | 345 |
345 if (profile) | 346 if (profile) |
346 profile_path_ = profile->GetPath(); | 347 profile_path_ = profile->GetPath(); |
347 } | 348 } |
348 | 349 |
349 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { | 350 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { |
350 // An empty path means the data is not associated with any profile. | 351 // An empty path means the data is not associated with any profile. |
351 return !profile_path_.empty() && profile_path_ == profile->GetPath(); | 352 return !profile_path_.empty() && profile_path_ == profile->GetPath(); |
352 } | 353 } |
OLD | NEW |