OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ | 5 #ifndef CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ |
6 #define CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ | 6 #define CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <wrl.h> | 10 #include <wrl.h> |
11 | 11 |
| 12 #include <memory> |
12 #include <utility> | 13 #include <utility> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
20 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class FakeFontCollection; | 24 class FakeFontCollection; |
25 | 25 |
26 // Creates a new FakeFontCollection, seeded with some basic data, and returns a | 26 // Creates a new FakeFontCollection, seeded with some basic data, and returns a |
27 // Sender that can be used to interact with the collection. | 27 // Sender that can be used to interact with the collection. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 IPC::Sender* GetTrackingSender(); | 90 IPC::Sender* GetTrackingSender(); |
91 | 91 |
92 protected: | 92 protected: |
93 // This class handles sending the reply message back to the "renderer" | 93 // This class handles sending the reply message back to the "renderer" |
94 class ReplySender : public IPC::Sender { | 94 class ReplySender : public IPC::Sender { |
95 public: | 95 public: |
96 explicit ReplySender(FakeFontCollection* collection); | 96 explicit ReplySender(FakeFontCollection* collection); |
97 | 97 |
98 ~ReplySender() override; | 98 ~ReplySender() override; |
99 | 99 |
100 scoped_ptr<IPC::Message>& OnMessageReceived(const IPC::Message& msg); | 100 std::unique_ptr<IPC::Message>& OnMessageReceived(const IPC::Message& msg); |
101 | 101 |
102 bool Send(IPC::Message* msg) override; | 102 bool Send(IPC::Message* msg) override; |
103 | 103 |
104 private: | 104 private: |
105 void OnFindFamily(const base::string16& family_name, uint32_t* index); | 105 void OnFindFamily(const base::string16& family_name, uint32_t* index); |
106 | 106 |
107 void OnGetFamilyCount(uint32_t* count); | 107 void OnGetFamilyCount(uint32_t* count); |
108 | 108 |
109 void OnGetFamilyNames( | 109 void OnGetFamilyNames( |
110 uint32_t family_index, | 110 uint32_t family_index, |
111 std::vector<std::pair<base::string16, base::string16>>* family_names); | 111 std::vector<std::pair<base::string16, base::string16>>* family_names); |
112 void OnGetFontFiles(uint32_t family_index, | 112 void OnGetFontFiles(uint32_t family_index, |
113 std::vector<base::string16>* file_paths_); | 113 std::vector<base::string16>* file_paths_); |
114 | 114 |
115 private: | 115 private: |
116 scoped_refptr<FakeFontCollection> collection_; | 116 scoped_refptr<FakeFontCollection> collection_; |
117 scoped_ptr<IPC::Message> reply_; | 117 std::unique_ptr<IPC::Message> reply_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(ReplySender); | 119 DISALLOW_COPY_AND_ASSIGN(ReplySender); |
120 }; | 120 }; |
121 | 121 |
122 // This class can be used by the "renderer" to send messages to the "browser" | 122 // This class can be used by the "renderer" to send messages to the "browser" |
123 class FakeSender : public IPC::Sender { | 123 class FakeSender : public IPC::Sender { |
124 public: | 124 public: |
125 FakeSender(FakeFontCollection* collection, bool track_messages); | 125 FakeSender(FakeFontCollection* collection, bool track_messages); |
126 | 126 |
127 ~FakeSender() override; | 127 ~FakeSender() override; |
(...skipping 26 matching lines...) Expand all Loading... |
154 | 154 |
155 std::vector<FakeFont> fonts_; | 155 std::vector<FakeFont> fonts_; |
156 std::vector<std::unique_ptr<IPC::Message>> messages_; | 156 std::vector<std::unique_ptr<IPC::Message>> messages_; |
157 | 157 |
158 DISALLOW_COPY_AND_ASSIGN(FakeFontCollection); | 158 DISALLOW_COPY_AND_ASSIGN(FakeFontCollection); |
159 }; | 159 }; |
160 | 160 |
161 } // namespace content | 161 } // namespace content |
162 | 162 |
163 #endif // CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ | 163 #endif // CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ |
OLD | NEW |