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 #ifndef UI_VIEWS_MUS_OS_EXCHANGE_DATA_PROVIDER_MUS_H_ | 5 #ifndef UI_VIEWS_MUS_OS_EXCHANGE_DATA_PROVIDER_MUS_H_ |
6 #define UI_VIEWS_MUS_OS_EXCHANGE_DATA_PROVIDER_MUS_H_ | 6 #define UI_VIEWS_MUS_OS_EXCHANGE_DATA_PROVIDER_MUS_H_ |
7 | 7 |
8 #include "ui/base/dragdrop/os_exchange_data.h" | 8 #include "ui/base/dragdrop/os_exchange_data.h" |
9 | 9 |
| 10 #include <map> |
| 11 #include <memory> |
| 12 #include <string> |
| 13 #include <utility> |
| 14 #include <vector> |
| 15 |
10 #include "mojo/public/cpp/bindings/map.h" | 16 #include "mojo/public/cpp/bindings/map.h" |
11 #include "ui/gfx/geometry/vector2d.h" | 17 #include "ui/gfx/geometry/vector2d.h" |
12 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
13 #include "ui/views/mus/mus_export.h" | 19 #include "ui/views/mus/mus_export.h" |
14 | 20 |
15 namespace views { | 21 namespace views { |
16 | 22 |
17 // Translates chrome's requests for various data types to a platform specific | 23 // Translates chrome's requests for various data types to a platform specific |
18 // type. In the case of mus, this is a mapping of MIME types to byte arrays. | 24 // type. In the case of mus, this is a mapping of MIME types to byte arrays. |
19 // | 25 // |
20 // TODO(erg): In the long run, there's a lot of optimizations that we can do | 26 // TODO(erg): In the long run, there's a lot of optimizations that we can do |
21 // once everything targets mus. The entire model of OSExchangeDataProvider | 27 // once everything targets mus. The entire model of OSExchangeDataProvider |
22 // shoves all data across the wire at once whether it is needed or not. | 28 // shoves all data across the wire at once whether it is needed or not. |
23 class VIEWS_MUS_EXPORT OSExchangeDataProviderMus | 29 class VIEWS_MUS_EXPORT OSExchangeDataProviderMus |
24 : public ui::OSExchangeData::Provider { | 30 : public ui::OSExchangeData::Provider { |
25 public: | 31 public: |
26 using Data = std::map<std::string, std::vector<uint8_t>>; | 32 using Data = std::map<std::string, std::vector<uint8_t>>; |
27 | 33 |
28 OSExchangeDataProviderMus(); | 34 OSExchangeDataProviderMus(); |
| 35 explicit OSExchangeDataProviderMus(Data data); |
29 ~OSExchangeDataProviderMus() override; | 36 ~OSExchangeDataProviderMus() override; |
30 | 37 |
31 // Returns the raw MIME type to data mapping. | 38 // Returns the raw MIME type to data mapping. |
32 Data GetData() const; | 39 Data GetData() const; |
33 | 40 |
34 // Overridden from OSExchangeData::Provider: | 41 // Overridden from OSExchangeData::Provider: |
35 std::unique_ptr<Provider> Clone() const override; | 42 std::unique_ptr<Provider> Clone() const override; |
36 | 43 |
37 void MarkOriginatedFromRenderer() override; | 44 void MarkOriginatedFromRenderer() override; |
38 bool DidOriginateFromRenderer() const override; | 45 bool DidOriginateFromRenderer() const override; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 gfx::Vector2d drag_image_offset_; | 109 gfx::Vector2d drag_image_offset_; |
103 | 110 |
104 Data mime_data_; | 111 Data mime_data_; |
105 | 112 |
106 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderMus); | 113 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderMus); |
107 }; | 114 }; |
108 | 115 |
109 } // namespace views | 116 } // namespace views |
110 | 117 |
111 #endif // UI_VIEWS_MUS_OS_EXCHANGE_DATA_PROVIDER_MUS_H_ | 118 #endif // UI_VIEWS_MUS_OS_EXCHANGE_DATA_PROVIDER_MUS_H_ |
OLD | NEW |