| OLD | NEW |
| 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/html_viewer/web_clipboard_impl.h" | 5 #include "components/html_viewer/web_clipboard_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Force this to be synchronous. | 169 // Force this to be synchronous. |
| 170 clipboard_.WaitForIncomingResponse(); | 170 clipboard_.WaitForIncomingResponse(); |
| 171 | 171 |
| 172 return data; | 172 return data; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void WebClipboardImpl::writePlainText(const blink::WebString& plain_text) { | 175 void WebClipboardImpl::writePlainText(const blink::WebString& plain_text) { |
| 176 Map<String, Array<uint8_t>> data; | 176 Map<String, Array<uint8_t>> data; |
| 177 data[Clipboard::MIME_TYPE_TEXT] = Array<uint8_t>::From(plain_text); | 177 data[Clipboard::MIME_TYPE_TEXT] = Array<uint8_t>::From(plain_text); |
| 178 | 178 |
| 179 clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, std::move(data)); | 179 clipboard_->WriteClipboardData(Clipboard::Type::COPY_PASTE, std::move(data)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void WebClipboardImpl::writeHTML(const blink::WebString& html_text, | 182 void WebClipboardImpl::writeHTML(const blink::WebString& html_text, |
| 183 const blink::WebURL& source_url, | 183 const blink::WebURL& source_url, |
| 184 const blink::WebString& plain_text, | 184 const blink::WebString& plain_text, |
| 185 bool writeSmartPaste) { | 185 bool writeSmartPaste) { |
| 186 Map<String, Array<uint8_t>> data; | 186 Map<String, Array<uint8_t>> data; |
| 187 data[Clipboard::MIME_TYPE_TEXT] = Array<uint8_t>::From(plain_text); | 187 data[Clipboard::MIME_TYPE_TEXT] = Array<uint8_t>::From(plain_text); |
| 188 data[Clipboard::MIME_TYPE_HTML] = Array<uint8_t>::From(html_text); | 188 data[Clipboard::MIME_TYPE_HTML] = Array<uint8_t>::From(html_text); |
| 189 data[Clipboard::MIME_TYPE_URL] = Array<uint8_t>::From(source_url.string()); | 189 data[Clipboard::MIME_TYPE_URL] = Array<uint8_t>::From(source_url.string()); |
| 190 | 190 |
| 191 if (writeSmartPaste) | 191 if (writeSmartPaste) |
| 192 data[kMimeTypeWebkitSmartPaste] = Array<uint8_t>::From(blink::WebString()); | 192 data[kMimeTypeWebkitSmartPaste] = Array<uint8_t>::From(blink::WebString()); |
| 193 | 193 |
| 194 clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, std::move(data)); | 194 clipboard_->WriteClipboardData(Clipboard::Type::COPY_PASTE, std::move(data)); |
| 195 } | 195 } |
| 196 | 196 |
| 197 Clipboard::Type WebClipboardImpl::ConvertBufferType(Buffer buffer) { | 197 Clipboard::Type WebClipboardImpl::ConvertBufferType(Buffer buffer) { |
| 198 switch (buffer) { | 198 switch (buffer) { |
| 199 case BufferStandard: | 199 case BufferStandard: |
| 200 return Clipboard::TYPE_COPY_PASTE; | 200 return Clipboard::Type::COPY_PASTE; |
| 201 case BufferSelection: | 201 case BufferSelection: |
| 202 return Clipboard::TYPE_SELECTION; | 202 return Clipboard::Type::SELECTION; |
| 203 } | 203 } |
| 204 | 204 |
| 205 NOTREACHED(); | 205 NOTREACHED(); |
| 206 return Clipboard::TYPE_COPY_PASTE; | 206 return Clipboard::Type::COPY_PASTE; |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace html_viewer | 209 } // namespace html_viewer |
| OLD | NEW |