1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
ash / quick_insert / quick_insert_search_result.h [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_QUICK_INSERT_QUICK_INSERT_SEARCH_RESULT_H_
#define ASH_QUICK_INSERT_QUICK_INSERT_SEARCH_RESULT_H_
#include <cstddef>
#include <optional>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
#include "ash/ash_export.h"
#include "ash/quick_insert/quick_insert_category.h"
#include "base/files/file_path.h"
#include "base/unguessable_token.h"
#include "ui/base/models/image_model.h"
#include "url/gurl.h"
namespace chromeos::editor_menu {
enum class PresetQueryCategory;
}
namespace ash {
struct ASH_EXPORT QuickInsertTextResult {
enum class Source {
kUnknown, // This should only be used for tests.
kDate,
kMath,
kCaseTransform,
kOmnibox,
};
std::u16string primary_text;
std::u16string secondary_text;
ui::ImageModel icon;
Source source;
explicit QuickInsertTextResult(std::u16string_view text,
QuickInsertTextResult::Source source =
QuickInsertTextResult::Source::kUnknown);
explicit QuickInsertTextResult(std::u16string_view primary_text,
std::u16string_view secondary_text,
ui::ImageModel icon,
Source source);
QuickInsertTextResult(const QuickInsertTextResult&);
QuickInsertTextResult& operator=(const QuickInsertTextResult&);
QuickInsertTextResult(QuickInsertTextResult&&);
QuickInsertTextResult& operator=(QuickInsertTextResult&&);
~QuickInsertTextResult();
bool operator==(const QuickInsertTextResult&) const;
};
struct ASH_EXPORT QuickInsertSearchRequestResult {
std::u16string primary_text;
std::u16string secondary_text;
ui::ImageModel icon;
explicit QuickInsertSearchRequestResult(std::u16string_view primary_text,
std::u16string_view secondary_text,
ui::ImageModel icon);
QuickInsertSearchRequestResult(const QuickInsertSearchRequestResult&);
QuickInsertSearchRequestResult& operator=(
const QuickInsertSearchRequestResult&);
QuickInsertSearchRequestResult(QuickInsertSearchRequestResult&&);
QuickInsertSearchRequestResult& operator=(QuickInsertSearchRequestResult&&);
~QuickInsertSearchRequestResult();
bool operator==(const QuickInsertSearchRequestResult&) const;
};
struct ASH_EXPORT QuickInsertEmojiResult {
enum class Type { kEmoji, kSymbol, kEmoticon };
Type type;
std::u16string text;
std::u16string name;
static QuickInsertEmojiResult Emoji(std::u16string_view text,
std::u16string name = u"");
static QuickInsertEmojiResult Symbol(std::u16string_view text,
std::u16string name = u"");
static QuickInsertEmojiResult Emoticon(std::u16string_view text,
std::u16string name = u"");
explicit QuickInsertEmojiResult(Type type,
std::u16string_view text,
std::u16string name);
QuickInsertEmojiResult(const QuickInsertEmojiResult&);
QuickInsertEmojiResult& operator=(const QuickInsertEmojiResult&);
QuickInsertEmojiResult(QuickInsertEmojiResult&&);
QuickInsertEmojiResult& operator=(QuickInsertEmojiResult&&);
~QuickInsertEmojiResult();
bool operator==(const QuickInsertEmojiResult&) const;
};
struct ASH_EXPORT QuickInsertGifResult {
QuickInsertGifResult(const GURL& preview_url,
const GURL& preview_image_url,
const gfx::Size& preview_dimensions,
const GURL& full_url,
const gfx::Size& full_dimensions,
std::u16string content_description);
QuickInsertGifResult(const QuickInsertGifResult&);
QuickInsertGifResult& operator=(const QuickInsertGifResult&);
QuickInsertGifResult(QuickInsertGifResult&&);
QuickInsertGifResult& operator=(QuickInsertGifResult&&);
~QuickInsertGifResult();
// A url to an animated preview gif media source.
GURL preview_url;
// A url to an unanimated preview image of the gif media source.
GURL preview_image_url;
// Width and height of the GIF at `preview_url`.
gfx::Size preview_dimensions;
// A url to a full-sized gif media source.
GURL full_url;
// Width and height of the GIF at `full_url`.
gfx::Size full_dimensions;
// A textual description of the content, primarily used for accessibility
// features.
std::u16string content_description;
bool operator==(const QuickInsertGifResult&) const;
};
struct ASH_EXPORT QuickInsertClipboardResult {
enum class DisplayFormat {
kFile,
kText,
kImage,
kHtml,
};
// Unique ID that specifies which item in the clipboard this refers to.
base::UnguessableToken item_id;
DisplayFormat display_format;
// If this is 1, `display_text` should be the filename of the file.
size_t file_count;
std::u16string display_text;
std::optional<ui::ImageModel> display_image;
bool is_recent;
explicit QuickInsertClipboardResult(
base::UnguessableToken item_id,
DisplayFormat display_format,
size_t file_count,
std::u16string display_text,
std::optional<ui::ImageModel> display_image,
bool is_recent);
QuickInsertClipboardResult(const QuickInsertClipboardResult&);
QuickInsertClipboardResult& operator=(const QuickInsertClipboardResult&);
QuickInsertClipboardResult(QuickInsertClipboardResult&&);
QuickInsertClipboardResult& operator=(QuickInsertClipboardResult&&);
~QuickInsertClipboardResult();
bool operator==(const QuickInsertClipboardResult&) const;
};
struct ASH_EXPORT QuickInsertBrowsingHistoryResult {
GURL url;
std::u16string title;
ui::ImageModel icon;
bool best_match;
explicit QuickInsertBrowsingHistoryResult(GURL url,
std::u16string title,
ui::ImageModel icon,
bool best_match = false);
QuickInsertBrowsingHistoryResult(const QuickInsertBrowsingHistoryResult&);
QuickInsertBrowsingHistoryResult& operator=(
const QuickInsertBrowsingHistoryResult&);
QuickInsertBrowsingHistoryResult(QuickInsertBrowsingHistoryResult&&);
QuickInsertBrowsingHistoryResult& operator=(
QuickInsertBrowsingHistoryResult&&);
~QuickInsertBrowsingHistoryResult();
bool operator==(const QuickInsertBrowsingHistoryResult&) const;
};
struct ASH_EXPORT QuickInsertLocalFileResult {
std::u16string title;
base::FilePath file_path;
bool best_match;
explicit QuickInsertLocalFileResult(std::u16string title,
base::FilePath file_path,
bool best_match = false);
QuickInsertLocalFileResult(const QuickInsertLocalFileResult&);
QuickInsertLocalFileResult& operator=(const QuickInsertLocalFileResult&);
QuickInsertLocalFileResult(QuickInsertLocalFileResult&&);
QuickInsertLocalFileResult& operator=(QuickInsertLocalFileResult&&);
~QuickInsertLocalFileResult();
bool operator==(const QuickInsertLocalFileResult&) const;
};
struct ASH_EXPORT QuickInsertDriveFileResult {
std::optional<std::string> id;
std::u16string title;
GURL url;
base::FilePath file_path;
bool best_match;
explicit QuickInsertDriveFileResult(std::optional<std::string> id,
std::u16string title,
GURL url,
base::FilePath file_path,
bool best_match = false);
QuickInsertDriveFileResult(const QuickInsertDriveFileResult&);
QuickInsertDriveFileResult& operator=(const QuickInsertDriveFileResult&);
QuickInsertDriveFileResult(QuickInsertDriveFileResult&&);
QuickInsertDriveFileResult& operator=(QuickInsertDriveFileResult&&);
~QuickInsertDriveFileResult();
bool operator==(const QuickInsertDriveFileResult&) const;
};
struct ASH_EXPORT QuickInsertCategoryResult {
QuickInsertCategory category;
explicit QuickInsertCategoryResult(QuickInsertCategory category);
QuickInsertCategoryResult(const QuickInsertCategoryResult&);
QuickInsertCategoryResult& operator=(const QuickInsertCategoryResult&);
QuickInsertCategoryResult(QuickInsertCategoryResult&&);
QuickInsertCategoryResult& operator=(QuickInsertCategoryResult&&);
~QuickInsertCategoryResult();
bool operator==(const QuickInsertCategoryResult&) const;
};
struct ASH_EXPORT QuickInsertEditorResult {
enum class Mode { kWrite, kRewrite };
Mode mode;
std::u16string display_name;
std::optional<chromeos::editor_menu::PresetQueryCategory> category;
std::optional<std::string> preset_query_id;
QuickInsertEditorResult(
Mode mode,
std::u16string display_name,
std::optional<chromeos::editor_menu::PresetQueryCategory> category,
std::optional<std::string> preset_query_id);
QuickInsertEditorResult(const QuickInsertEditorResult&);
QuickInsertEditorResult& operator=(const QuickInsertEditorResult&);
QuickInsertEditorResult(QuickInsertEditorResult&&);
QuickInsertEditorResult& operator=(QuickInsertEditorResult&&);
~QuickInsertEditorResult();
bool operator==(const QuickInsertEditorResult&) const;
};
struct ASH_EXPORT QuickInsertLobsterResult {
enum class Mode { kNoSelection, kWithSelection };
Mode mode;
std::u16string display_name;
QuickInsertLobsterResult(Mode mode, std::u16string display_name);
QuickInsertLobsterResult(const QuickInsertLobsterResult&);
QuickInsertLobsterResult& operator=(const QuickInsertLobsterResult&);
QuickInsertLobsterResult(QuickInsertLobsterResult&&);
QuickInsertLobsterResult& operator=(QuickInsertLobsterResult&&);
~QuickInsertLobsterResult();
bool operator==(const QuickInsertLobsterResult&) const;
};
struct ASH_EXPORT QuickInsertNewWindowResult {
enum Type {
kDoc,
kSheet,
kSlide,
kChrome,
};
Type type;
explicit QuickInsertNewWindowResult(Type type);
QuickInsertNewWindowResult(const QuickInsertNewWindowResult&);
QuickInsertNewWindowResult& operator=(const QuickInsertNewWindowResult&);
QuickInsertNewWindowResult(QuickInsertNewWindowResult&&);
QuickInsertNewWindowResult& operator=(QuickInsertNewWindowResult&&);
~QuickInsertNewWindowResult();
bool operator==(const QuickInsertNewWindowResult&) const;
};
struct ASH_EXPORT QuickInsertCapsLockResult {
enum class Shortcut {
kAltLauncher,
kAltSearch,
kFnQuickInsert,
};
bool enabled;
Shortcut shortcut;
explicit QuickInsertCapsLockResult(bool enabled, Shortcut shortcut);
QuickInsertCapsLockResult(const QuickInsertCapsLockResult&);
QuickInsertCapsLockResult& operator=(const QuickInsertCapsLockResult&);
QuickInsertCapsLockResult(QuickInsertCapsLockResult&&);
QuickInsertCapsLockResult& operator=(QuickInsertCapsLockResult&&);
~QuickInsertCapsLockResult();
bool operator==(const QuickInsertCapsLockResult&) const;
};
struct ASH_EXPORT QuickInsertCaseTransformResult {
enum Type {
kUpperCase,
kLowerCase,
kTitleCase,
};
Type type;
explicit QuickInsertCaseTransformResult(Type type);
QuickInsertCaseTransformResult(const QuickInsertCaseTransformResult&);
QuickInsertCaseTransformResult& operator=(
const QuickInsertCaseTransformResult&);
QuickInsertCaseTransformResult(QuickInsertCaseTransformResult&&);
QuickInsertCaseTransformResult& operator=(QuickInsertCaseTransformResult&&);
~QuickInsertCaseTransformResult();
bool operator==(const QuickInsertCaseTransformResult&) const;
};
using QuickInsertSearchResult = std::variant<QuickInsertTextResult,
QuickInsertSearchRequestResult,
QuickInsertEmojiResult,
QuickInsertGifResult,
QuickInsertClipboardResult,
QuickInsertBrowsingHistoryResult,
QuickInsertLocalFileResult,
QuickInsertDriveFileResult,
QuickInsertCategoryResult,
QuickInsertEditorResult,
QuickInsertLobsterResult,
QuickInsertNewWindowResult,
QuickInsertCapsLockResult,
QuickInsertCaseTransformResult>;
} // namespace ash
#endif // ASH_QUICK_INSERT_QUICK_INSERT_SEARCH_RESULT_H_