OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/views/mus/clipboard_mus.h" | 5 #include "ui/views/mus/clipboard_mus.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "mojo/common/common_type_converters.h" | 10 #include "mojo/common/common_type_converters.h" |
11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" | 11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" |
12 #include "services/shell/public/cpp/connector.h" | 12 #include "services/shell/public/cpp/connector.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "ui/base/clipboard/custom_data_helper.h" | 14 #include "ui/base/clipboard/custom_data_helper.h" |
15 #include "ui/gfx/codec/png_codec.h" | 15 #include "ui/gfx/codec/png_codec.h" |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 namespace { | 18 namespace { |
19 | 19 |
20 ui::mojom::Clipboard::Type GetType(ui::ClipboardType type) { | 20 ui::mojom::Clipboard::Type GetType(ui::ClipboardType type) { |
21 switch (type) { | 21 switch (type) { |
22 case ui::CLIPBOARD_TYPE_COPY_PASTE: | 22 case ui::CLIPBOARD_TYPE_COPY_PASTE: |
23 return ui::mojom::Clipboard::Type::COPY_PASTE; | 23 return ui::mojom::Clipboard::Type::COPY_PASTE; |
24 case ui::CLIPBOARD_TYPE_SELECTION: | 24 case ui::CLIPBOARD_TYPE_SELECTION: |
25 return ui::mojom::Clipboard::Type::SELECTION; | 25 return ui::mojom::Clipboard::Type::SELECTION; |
26 case ui::CLIPBOARD_TYPE_DRAG: | 26 case ui::CLIPBOARD_TYPE_DRAG: |
27 return ui::mojom::Clipboard::Type::DRAG; | 27 // Only OSX uses a drag clipboard. |
| 28 break; |
28 } | 29 } |
29 | 30 |
30 NOTREACHED(); | 31 NOTREACHED(); |
31 return ui::mojom::Clipboard::Type::COPY_PASTE; | 32 return ui::mojom::Clipboard::Type::COPY_PASTE; |
32 } | 33 } |
33 | 34 |
34 // The source URL of copied HTML. | 35 // The source URL of copied HTML. |
35 const char kInternalSourceURL[] = "chromium/internal-url"; | 36 const char kInternalSourceURL[] = "chromium/internal-url"; |
36 | 37 |
37 } // namespace | 38 } // namespace |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 void ClipboardMus::WriteData(const FormatType& format, | 330 void ClipboardMus::WriteData(const FormatType& format, |
330 const char* data_data, | 331 const char* data_data, |
331 size_t data_len) { | 332 size_t data_len) { |
332 DCHECK(current_clipboard_); | 333 DCHECK(current_clipboard_); |
333 current_clipboard_->insert( | 334 current_clipboard_->insert( |
334 GetMimeTypeFor(format), | 335 GetMimeTypeFor(format), |
335 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len))); | 336 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len))); |
336 } | 337 } |
337 | 338 |
338 } // namespace views | 339 } // namespace views |
OLD | NEW |