mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefRenderHandler::OnVirtualKeyboardRequested (issue #2607)
This commit is contained in:
committed by
Marshall Greenblatt
parent
c72d57aa60
commit
379fb8d39e
@@ -396,6 +396,9 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
|
||||
// Do this last because it may result in a call to SetNeedsBeginFrames.
|
||||
render_widget_host_->SetView(this);
|
||||
|
||||
if (GetTextInputManager())
|
||||
GetTextInputManager()->AddObserver(this);
|
||||
}
|
||||
|
||||
CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||
@@ -425,6 +428,9 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||
DCHECK(popup_host_view_ == NULL);
|
||||
DCHECK(child_host_view_ == NULL);
|
||||
DCHECK(guest_host_views_.empty());
|
||||
|
||||
if (text_input_manager_)
|
||||
text_input_manager_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
// Called for full-screen widgets.
|
||||
@@ -1424,6 +1430,31 @@ void CefRenderWidgetHostViewOSR::SendFocusEvent(bool focus) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnUpdateTextInputStateCalled(
|
||||
content::TextInputManager* text_input_manager,
|
||||
content::RenderWidgetHostViewBase* updated_view,
|
||||
bool did_update_state) {
|
||||
const content::TextInputState* state =
|
||||
text_input_manager->GetTextInputState();
|
||||
if (state && !state->show_ime_if_needed)
|
||||
return;
|
||||
|
||||
CefRenderHandler::TextInputMode mode = CEF_TEXT_INPUT_MODE_NONE;
|
||||
if (state && state->type != ui::TEXT_INPUT_TYPE_NONE) {
|
||||
static_assert(
|
||||
static_cast<int>(CEF_TEXT_INPUT_MODE_MAX) ==
|
||||
static_cast<int>(ui::TEXT_INPUT_MODE_MAX),
|
||||
"Enum values in cef_text_input_mode_t must match ui::TextInputMode");
|
||||
mode = static_cast<CefRenderHandler::TextInputMode>(state->mode);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRenderHandler> handler =
|
||||
browser_impl_->GetClient()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
|
||||
handler->OnVirtualKeyboardRequested(browser_impl_->GetBrowser(), mode);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateFrameRate() {
|
||||
frame_rate_threshold_us_ = 0;
|
||||
SetFrameRate();
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
|
||||
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "content/browser/renderer_host/text_input_manager.h"
|
||||
#include "content/public/common/widget_type.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
#include "ui/compositor/external_begin_frame_client.h"
|
||||
@@ -96,7 +97,8 @@ class MacHelper;
|
||||
|
||||
class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
public ui::ExternalBeginFrameClient,
|
||||
public ui::CompositorDelegate {
|
||||
public ui::CompositorDelegate,
|
||||
public content::TextInputManager::Observer {
|
||||
public:
|
||||
CefRenderWidgetHostViewOSR(SkColor background_color,
|
||||
bool use_shared_texture,
|
||||
@@ -205,6 +207,12 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||
ui::Compositor* compositor) override;
|
||||
|
||||
// TextInputManager::Observer implementation.
|
||||
void OnUpdateTextInputStateCalled(
|
||||
content::TextInputManager* text_input_manager,
|
||||
RenderWidgetHostViewBase* updated_view,
|
||||
bool did_update_state) override;
|
||||
|
||||
bool InstallTransparency();
|
||||
|
||||
void SynchronizeVisualProperties();
|
||||
|
Reference in New Issue
Block a user