cef/libcef/browser/views/textfield_view.cc
Marshall Greenblatt cd3f617171 Rename browser_util to browser_event_util (seee #3685)
Use more specific file naming. This change is a functional no-op.
2024-07-03 12:16:26 -04:00

43 lines
1.2 KiB
C++

// 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 "cef/libcef/browser/views/textfield_view.h"
#include "cef/libcef/browser/browser_event_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 (!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());
}
}