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

content / browser / renderer_host / text_input_host_impl.mm [blame]

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/renderer_host/text_input_host_impl.h"

#include "content/browser/renderer_host/text_input_client_mac.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"

namespace content {

TextInputHostImpl::TextInputHostImpl() = default;
TextInputHostImpl::~TextInputHostImpl() = default;

void TextInputHostImpl::Create(
    mojo::PendingReceiver<blink::mojom::TextInputHost> receiver) {
  DCHECK_CURRENTLY_ON(BrowserThread::IO);
  mojo::MakeSelfOwnedReceiver(std::make_unique<TextInputHostImpl>(),
                              std::move(receiver));
}

void TextInputHostImpl::GotCharacterIndexAtPoint(uint32_t index) {
  DCHECK_CURRENTLY_ON(BrowserThread::IO);
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  TextInputClientMac* service = TextInputClientMac::GetInstance();
  service->SetCharacterIndexAndSignal(index);
}

void TextInputHostImpl::GotFirstRectForRange(const gfx::Rect& rect) {
  DCHECK_CURRENTLY_ON(BrowserThread::IO);
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  TextInputClientMac* service = TextInputClientMac::GetInstance();
  service->SetFirstRectAndSignal(rect);
}

}  // namespace content