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 // This file implements the ScopedClipboardWriter class. Documentation on its | 5 // This file implements the ScopedClipboardWriter class. Documentation on its |
6 // purpose can be found in our header. Documentation on the format of the | 6 // purpose can be found in our header. Documentation on the format of the |
7 // parameters for each clipboard target can be found in clipboard.h. | 7 // parameters for each clipboard target can be found in clipboard.h. |
8 | 8 |
9 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 9 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 SkBitmap* bitmap_pointer = &bitmap_; | 96 SkBitmap* bitmap_pointer = &bitmap_; |
97 Clipboard::ObjectMapParam packed_pointer; | 97 Clipboard::ObjectMapParam packed_pointer; |
98 packed_pointer.resize(sizeof(bitmap_pointer)); | 98 packed_pointer.resize(sizeof(bitmap_pointer)); |
99 *reinterpret_cast<SkBitmap**>(&*packed_pointer.begin()) = bitmap_pointer; | 99 *reinterpret_cast<SkBitmap**>(&*packed_pointer.begin()) = bitmap_pointer; |
100 Clipboard::ObjectMapParams parameters; | 100 Clipboard::ObjectMapParams parameters; |
101 parameters.push_back(packed_pointer); | 101 parameters.push_back(packed_pointer); |
102 objects_[Clipboard::CBF_SMBITMAP] = parameters; | 102 objects_[Clipboard::CBF_SMBITMAP] = parameters; |
103 } | 103 } |
104 | 104 |
105 void ScopedClipboardWriter::WritePickledData( | 105 void ScopedClipboardWriter::WritePickledData( |
106 const Pickle& pickle, const Clipboard::FormatType& format) { | 106 const base::Pickle& pickle, |
| 107 const Clipboard::FormatType& format) { |
107 std::string format_string = format.Serialize(); | 108 std::string format_string = format.Serialize(); |
108 Clipboard::ObjectMapParam format_parameter(format_string.begin(), | 109 Clipboard::ObjectMapParam format_parameter(format_string.begin(), |
109 format_string.end()); | 110 format_string.end()); |
110 Clipboard::ObjectMapParam data_parameter; | 111 Clipboard::ObjectMapParam data_parameter; |
111 | 112 |
112 data_parameter.resize(pickle.size()); | 113 data_parameter.resize(pickle.size()); |
113 memcpy(const_cast<char*>(&data_parameter.front()), | 114 memcpy(const_cast<char*>(&data_parameter.front()), |
114 pickle.data(), pickle.size()); | 115 pickle.data(), pickle.size()); |
115 | 116 |
116 Clipboard::ObjectMapParams parameters; | 117 Clipboard::ObjectMapParams parameters; |
(...skipping 18 matching lines...) Expand all Loading... |
135 objects_[Clipboard::CBF_TEXT] = parameters; | 136 objects_[Clipboard::CBF_TEXT] = parameters; |
136 | 137 |
137 if (is_url) { | 138 if (is_url) { |
138 url_text_ = utf8_text; | 139 url_text_ = utf8_text; |
139 } else { | 140 } else { |
140 url_text_.clear(); | 141 url_text_.clear(); |
141 } | 142 } |
142 } | 143 } |
143 | 144 |
144 } // namespace ui | 145 } // namespace ui |
OLD | NEW |