diff options
author | Inna Palant <ipalant@google.com> | 2023-12-12 19:56:22 -0800 |
---|---|---|
committer | Inna Palant <ipalant@google.com> | 2023-12-12 19:56:22 -0800 |
commit | 1ee1f36e3b492d7a6a0bf2367fe509365853aeaa (patch) | |
tree | a5790e155ff0d998639beb6172dfa0feb294aac9 /libcef/browser/views/textfield_view.cc | |
parent | 1e76199e6f0ded437fca14eb9e512e0c6bd0fc1e (diff) | |
parent | c33b736614ef77e4048cee551999a656a5ef465f (diff) | |
download | cef-1ee1f36e3b492d7a6a0bf2367fe509365853aeaa.tar.gz |
Merge remote-tracking branch 'origin/upstream'main
Import b/312293934
Diffstat (limited to 'libcef/browser/views/textfield_view.cc')
-rw-r--r-- | libcef/browser/views/textfield_view.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libcef/browser/views/textfield_view.cc b/libcef/browser/views/textfield_view.cc new file mode 100644 index 00000000..103d108a --- /dev/null +++ b/libcef/browser/views/textfield_view.cc @@ -0,0 +1,42 @@ +// Copyright 2016 The Chromium Embedded Framework Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be found +// in the LICENSE file. + +#include "libcef/browser/views/textfield_view.h" + +#include "libcef/browser/browser_util.h" + +CefTextfieldView::CefTextfieldView(CefTextfieldDelegate* cef_delegate) + : ParentClass(cef_delegate) { + set_controller(this); +} + +void CefTextfieldView::Initialize() { + ParentClass::Initialize(); + + // Use our defaults instead of the Views framework defaults. + SetFontList(gfx::FontList(view_util::kDefaultFontList)); +} + +bool CefTextfieldView::HandleKeyEvent(views::Textfield* sender, + const ui::KeyEvent& key_event) { + DCHECK_EQ(sender, this); + + if (!cef_delegate()) { + return false; + } + + CefKeyEvent cef_key_event; + if (!browser_util::GetCefKeyEvent(key_event, cef_key_event)) { + return false; + } + + return cef_delegate()->OnKeyEvent(GetCefTextfield(), cef_key_event); +} + +void CefTextfieldView::OnAfterUserAction(views::Textfield* sender) { + DCHECK_EQ(sender, this); + if (cef_delegate()) { + cef_delegate()->OnAfterUserAction(GetCefTextfield()); + } +} |