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

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

Issue 558913003: Remove clipboard argument from ScopedClipboardWriter constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't leak a clipboard on Windows Created 6 years, 3 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
« no previous file with comments | « chrome/common/net/url_util.cc ('k') | components/bookmarks/browser/bookmark_utils_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_node_data.h" 5 #include "components/bookmarks/browser/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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 elements.push_back(element); 151 elements.push_back(element);
152 152
153 return true; 153 return true;
154 } 154 }
155 155
156 #if !defined(OS_MACOSX) 156 #if !defined(OS_MACOSX)
157 void BookmarkNodeData::WriteToClipboard(ui::ClipboardType clipboard_type) { 157 void BookmarkNodeData::WriteToClipboard(ui::ClipboardType clipboard_type) {
158 DCHECK(clipboard_type == ui::CLIPBOARD_TYPE_COPY_PASTE || 158 DCHECK(clipboard_type == ui::CLIPBOARD_TYPE_COPY_PASTE ||
159 clipboard_type == ui::CLIPBOARD_TYPE_SELECTION); 159 clipboard_type == ui::CLIPBOARD_TYPE_SELECTION);
160 ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(), 160 ui::ScopedClipboardWriter scw(clipboard_type);
161 clipboard_type);
162 161
163 // If there is only one element and it is a URL, write the URL to the 162 // If there is only one element and it is a URL, write the URL to the
164 // clipboard. 163 // clipboard.
165 if (elements.size() == 1 && elements[0].is_url) { 164 if (elements.size() == 1 && elements[0].is_url) {
166 const base::string16& title = elements[0].title; 165 const base::string16& title = elements[0].title;
167 const std::string url = elements[0].url.spec(); 166 const std::string url = elements[0].url.spec();
168 167
169 scw.WriteBookmark(title, url); 168 scw.WriteBookmark(title, url);
170 169
171 // Don't call scw.WriteHyperlink() here, since some rich text editors will 170 // Don't call scw.WriteHyperlink() here, since some rich text editors will
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 profile_path_ = profile_path; 280 profile_path_ = profile_path;
282 } 281 }
283 282
284 bool BookmarkNodeData::IsFromProfilePath( 283 bool BookmarkNodeData::IsFromProfilePath(
285 const base::FilePath& profile_path) const { 284 const base::FilePath& profile_path) const {
286 // An empty path means the data is not associated with any profile. 285 // An empty path means the data is not associated with any profile.
287 return !profile_path_.empty() && profile_path_ == profile_path; 286 return !profile_path_.empty() && profile_path_ == profile_path;
288 } 287 }
289 288
290 } // namespace bookmarks 289 } // namespace bookmarks
OLDNEW
« no previous file with comments | « chrome/common/net/url_util.cc ('k') | components/bookmarks/browser/bookmark_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698