parent
86d23cee40
commit
22d8f22cfb
100 changed files with 417 additions and 417 deletions
|
@ -28,7 +28,7 @@ namespace api {
|
|||
|
||||
namespace {
|
||||
|
||||
bool HasWordCharacters(const base::string16& text, int index) {
|
||||
bool HasWordCharacters(const std::u16string& text, int index) {
|
||||
const char16_t* data = text.data();
|
||||
int length = text.length();
|
||||
while (index < length) {
|
||||
|
@ -43,8 +43,8 @@ bool HasWordCharacters(const base::string16& text, int index) {
|
|||
|
||||
struct Word {
|
||||
blink::WebTextCheckingResult result;
|
||||
base::string16 text;
|
||||
std::vector<base::string16> contraction_words;
|
||||
std::u16string text;
|
||||
std::vector<std::u16string> contraction_words;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -52,19 +52,19 @@ struct Word {
|
|||
class SpellCheckClient::SpellcheckRequest {
|
||||
public:
|
||||
SpellcheckRequest(
|
||||
const base::string16& text,
|
||||
const std::u16string& text,
|
||||
std::unique_ptr<blink::WebTextCheckingCompletion> completion)
|
||||
: text_(text), completion_(std::move(completion)) {}
|
||||
SpellcheckRequest(const SpellcheckRequest&) = delete;
|
||||
SpellcheckRequest& operator=(const SpellcheckRequest&) = delete;
|
||||
~SpellcheckRequest() = default;
|
||||
|
||||
const base::string16& text() const { return text_; }
|
||||
const std::u16string& text() const { return text_; }
|
||||
blink::WebTextCheckingCompletion* completion() { return completion_.get(); }
|
||||
std::vector<Word>& wordlist() { return word_list_; }
|
||||
|
||||
private:
|
||||
base::string16 text_; // Text to be checked in this task.
|
||||
std::u16string text_; // Text to be checked in this task.
|
||||
std::vector<Word> word_list_; // List of Words found in text
|
||||
// The interface to send the misspelled ranges to WebKit.
|
||||
std::unique_ptr<blink::WebTextCheckingCompletion> completion_;
|
||||
|
@ -93,7 +93,7 @@ SpellCheckClient::~SpellCheckClient() {
|
|||
void SpellCheckClient::RequestCheckingOfText(
|
||||
const blink::WebString& textToCheck,
|
||||
std::unique_ptr<blink::WebTextCheckingCompletion> completionCallback) {
|
||||
base::string16 text(textToCheck.Utf16());
|
||||
std::u16string text(textToCheck.Utf16());
|
||||
// Ignore invalid requests.
|
||||
if (text.empty() || !HasWordCharacters(text, 0)) {
|
||||
completionCallback->DidCancelCheckingText();
|
||||
|
@ -151,10 +151,10 @@ void SpellCheckClient::SpellCheckText() {
|
|||
text_iterator_.SetText(text.c_str(), text.size());
|
||||
|
||||
SpellCheckScope scope(*this);
|
||||
base::string16 word;
|
||||
std::u16string word;
|
||||
size_t word_start;
|
||||
size_t word_length;
|
||||
std::set<base::string16> words;
|
||||
std::set<std::u16string> words;
|
||||
auto& word_list = pending_request_param_->wordlist();
|
||||
Word word_entry;
|
||||
for (;;) { // Run until end of text
|
||||
|
@ -186,9 +186,9 @@ void SpellCheckClient::SpellCheckText() {
|
|||
}
|
||||
|
||||
void SpellCheckClient::OnSpellCheckDone(
|
||||
const std::vector<base::string16>& misspelled_words) {
|
||||
const std::vector<std::u16string>& misspelled_words) {
|
||||
std::vector<blink::WebTextCheckingResult> results;
|
||||
std::unordered_set<base::string16> misspelled(misspelled_words.begin(),
|
||||
std::unordered_set<std::u16string> misspelled(misspelled_words.begin(),
|
||||
misspelled_words.end());
|
||||
|
||||
auto& word_list = pending_request_param_->wordlist();
|
||||
|
@ -216,7 +216,7 @@ void SpellCheckClient::OnSpellCheckDone(
|
|||
}
|
||||
|
||||
void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
|
||||
const std::set<base::string16>& words) {
|
||||
const std::set<std::u16string>& words) {
|
||||
DCHECK(!scope.spell_check_.IsEmpty());
|
||||
|
||||
v8::Local<v8::FunctionTemplate> templ = gin_helper::CreateFunctionTemplate(
|
||||
|
@ -238,13 +238,13 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope,
|
|||
// words in the contraction.
|
||||
bool SpellCheckClient::IsContraction(
|
||||
const SpellCheckScope& scope,
|
||||
const base::string16& contraction,
|
||||
std::vector<base::string16>* contraction_words) {
|
||||
const std::u16string& contraction,
|
||||
std::vector<std::u16string>* contraction_words) {
|
||||
DCHECK(contraction_iterator_.IsInitialized());
|
||||
|
||||
contraction_iterator_.SetText(contraction.c_str(), contraction.length());
|
||||
|
||||
base::string16 word;
|
||||
std::u16string word;
|
||||
size_t word_start;
|
||||
size_t word_length;
|
||||
for (auto status =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue