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
ash / quick_insert / model / quick_insert_model.h [blame]
// Copyright 2023 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_MODEL_QUICK_INSERT_MODEL_H_
#define ASH_QUICK_INSERT_MODEL_QUICK_INSERT_MODEL_H_
#include <vector>
#include "ash/ash_export.h"
#include "ash/quick_insert/quick_insert_category.h"
#include "ui/base/ime/text_input_type.h"
#include "ui/gfx/range/range.h"
class PrefService;
namespace ui {
class TextInputClient;
}
namespace ash {
namespace input_method {
class ImeKeyboard;
}
enum class QuickInsertModeType;
class ASH_EXPORT QuickInsertModel {
public:
enum class EditorStatus { kEnabled, kDisabled };
enum class LobsterStatus { kEnabled, kDisabled };
// `focused_client` is the input field that was focused when Quick Insert is
// opened. It can be null. `ime_keyboard` is used to monitor caps lock state.
// This cannot be null.
explicit QuickInsertModel(PrefService* prefs,
ui::TextInputClient* focused_client,
input_method::ImeKeyboard* ime_keyboard,
EditorStatus editor_status,
LobsterStatus lobster_status);
std::vector<QuickInsertCategory> GetAvailableCategories() const;
std::vector<QuickInsertCategory> GetRecentResultsCategories() const;
std::u16string_view selected_text() const;
bool should_do_learning() const;
bool is_caps_lock_enabled() const;
QuickInsertModeType GetMode() const;
bool IsGifsEnabled() const;
private:
bool has_focus_;
std::u16string selected_text_;
bool should_do_learning_;
gfx::Range selection_range_;
bool is_caps_lock_enabled_;
EditorStatus editor_status_;
LobsterStatus lobster_status_;
ui::TextInputType text_input_type_;
bool is_gifs_enabled_;
};
} // namespace ash
#endif // ASH_QUICK_INSERT_MODEL_QUICK_INSERT_MODEL_H_