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 <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 // The source URL of copied HTML. | 40 // The source URL of copied HTML. |
41 const char kInternalSourceURL[] = "chromium/internal-url"; | 41 const char kInternalSourceURL[] = "chromium/internal-url"; |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 ClipboardMus::ClipboardMus() {} | 45 ClipboardMus::ClipboardMus() {} |
46 | 46 |
47 ClipboardMus::~ClipboardMus() {} | 47 ClipboardMus::~ClipboardMus() {} |
48 | 48 |
49 void ClipboardMus::Init(service_manager::Connector* connector) { | 49 void ClipboardMus::Init(service_manager::Connector* connector) { |
50 connector->ConnectToInterface(ui::mojom::kServiceName, &clipboard_); | 50 connector->BindInterface(ui::mojom::kServiceName, &clipboard_); |
51 } | 51 } |
52 | 52 |
53 // TODO(erg): This isn't optimal. It would be better to move the entire | 53 // TODO(erg): This isn't optimal. It would be better to move the entire |
54 // FormatType system to mime types throughout chrome, but that's a very large | 54 // FormatType system to mime types throughout chrome, but that's a very large |
55 // change. | 55 // change. |
56 std::string ClipboardMus::GetMimeTypeFor(const FormatType& format) { | 56 std::string ClipboardMus::GetMimeTypeFor(const FormatType& format) { |
57 if (format.Equals(GetUrlFormatType()) || format.Equals(GetUrlWFormatType())) | 57 if (format.Equals(GetUrlFormatType()) || format.Equals(GetUrlWFormatType())) |
58 return ui::mojom::kMimeTypeURIList; | 58 return ui::mojom::kMimeTypeURIList; |
59 if (format.Equals(GetMozUrlFormatType())) | 59 if (format.Equals(GetMozUrlFormatType())) |
60 return ui::mojom::kMimeTypeMozillaURL; | 60 return ui::mojom::kMimeTypeMozillaURL; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 void ClipboardMus::WriteData(const FormatType& format, | 336 void ClipboardMus::WriteData(const FormatType& format, |
337 const char* data_data, | 337 const char* data_data, |
338 size_t data_len) { | 338 size_t data_len) { |
339 DCHECK(current_clipboard_); | 339 DCHECK(current_clipboard_); |
340 current_clipboard_.value()[GetMimeTypeFor(format)] = | 340 current_clipboard_.value()[GetMimeTypeFor(format)] = |
341 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len)) | 341 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len)) |
342 .PassStorage(); | 342 .PassStorage(); |
343 } | 343 } |
344 | 344 |
345 } // namespace views | 345 } // namespace views |
OLD | NEW |