Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/bookmarks/bookmark_node_data.cc

Issue 25894003: Don't write URLs to clipboard from views omnibox as hyperlinks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/omnibox/omnibox_view_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/omnibox/omnibox_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698