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

Side by Side Diff: ui/base/clipboard/clipboard_aurax11.cc

Issue 776903002: Cleanup: Remove some unneeded string allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win Created 6 years 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
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 "ui/base/clipboard/clipboard_aurax11.h" 5 #include "ui/base/clipboard/clipboard_aurax11.h"
6 6
7 #include <X11/extensions/Xfixes.h> 7 #include <X11/extensions/Xfixes.h>
8 #include <X11/Xatom.h> 8 #include <X11/Xatom.h>
9 #include <list> 9 #include <list>
10 #include <set> 10 #include <set>
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 void ClipboardAuraX11::WriteRTF(const char* rtf_data, size_t data_len) { 883 void ClipboardAuraX11::WriteRTF(const char* rtf_data, size_t data_len) {
884 WriteData(GetRtfFormatType(), rtf_data, data_len); 884 WriteData(GetRtfFormatType(), rtf_data, data_len);
885 } 885 }
886 886
887 void ClipboardAuraX11::WriteBookmark(const char* title_data, 887 void ClipboardAuraX11::WriteBookmark(const char* title_data,
888 size_t title_len, 888 size_t title_len,
889 const char* url_data, 889 const char* url_data,
890 size_t url_len) { 890 size_t url_len) {
891 // Write as a mozilla url (UTF16: URL, newline, title). 891 // Write as a mozilla url (UTF16: URL, newline, title).
892 base::string16 url = base::UTF8ToUTF16(std::string(url_data, url_len) + "\n"); 892 base::string16 url = base::UTF8ToUTF16(std::string(url_data, url_len) + "\n");
893 base::string16 title = base::UTF8ToUTF16(std::string(title_data, title_len)); 893 base::string16 title =
894 base::UTF8ToUTF16(base::StringPiece(title_data, title_len));
894 895
895 std::vector<unsigned char> data; 896 std::vector<unsigned char> data;
896 ui::AddString16ToVector(url, &data); 897 ui::AddString16ToVector(url, &data);
897 ui::AddString16ToVector(title, &data); 898 ui::AddString16ToVector(title, &data);
898 scoped_refptr<base::RefCountedMemory> mem( 899 scoped_refptr<base::RefCountedMemory> mem(
899 base::RefCountedBytes::TakeVector(&data)); 900 base::RefCountedBytes::TakeVector(&data));
900 901
901 aurax11_details_->InsertMapping(kMimeTypeMozillaURL, mem); 902 aurax11_details_->InsertMapping(kMimeTypeMozillaURL, mem);
902 } 903 }
903 904
(...skipping 25 matching lines...) Expand all
929 if (format.Equals(GetBitmapFormatType())) 930 if (format.Equals(GetBitmapFormatType()))
930 return; 931 return;
931 932
932 std::vector<unsigned char> bytes(data_data, data_data + data_len); 933 std::vector<unsigned char> bytes(data_data, data_data + data_len);
933 scoped_refptr<base::RefCountedMemory> mem( 934 scoped_refptr<base::RefCountedMemory> mem(
934 base::RefCountedBytes::TakeVector(&bytes)); 935 base::RefCountedBytes::TakeVector(&bytes));
935 aurax11_details_->InsertMapping(format.ToString(), mem); 936 aurax11_details_->InsertMapping(format.ToString(), mem);
936 } 937 }
937 938
938 } // namespace ui 939 } // namespace ui
OLDNEW
« components/user_manager/empty_user_info.cc ('K') | « net/base/mime_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698