Commit 0b95f286 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Run clang-tidy on c/b/chromeos/input_method.

Bug: 1148157
Change-Id: I96548155baa4226d32c2ab752cefd0326665d8e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537818Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Reviewed-by: default avatarJing Wang <jiwan@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827681}
parent 1848ee83
......@@ -133,7 +133,7 @@ InputMethodEngineBase::KeyboardEvent::KeyboardEvent() = default;
InputMethodEngineBase::KeyboardEvent::KeyboardEvent(
const KeyboardEvent& other) = default;
InputMethodEngineBase::KeyboardEvent::~KeyboardEvent() {}
InputMethodEngineBase::KeyboardEvent::~KeyboardEvent() = default;
InputMethodEngineBase::InputMethodEngineBase()
: current_input_type_(ui::TEXT_INPUT_TYPE_NONE),
......@@ -146,7 +146,7 @@ InputMethodEngineBase::InputMethodEngineBase()
handling_key_event_(false),
pref_change_registrar_(nullptr) {}
InputMethodEngineBase::~InputMethodEngineBase() {}
InputMethodEngineBase::~InputMethodEngineBase() = default;
void InputMethodEngineBase::Initialize(
std::unique_ptr<InputMethodEngineBase::Observer> observer,
......@@ -390,7 +390,7 @@ ui::KeyEvent InputMethodEngineBase::ConvertKeyboardEventToUIKeyEvent(
const KeyboardEvent& event) {
const ui::EventType type =
(event.type == "keyup") ? ui::ET_KEY_RELEASED : ui::ET_KEY_PRESSED;
ui::KeyboardCode key_code = static_cast<ui::KeyboardCode>(event.key_code);
auto key_code = static_cast<ui::KeyboardCode>(event.key_code);
int flags = ui::EF_NONE;
flags |= event.alt_key ? ui::EF_ALT_DOWN : ui::EF_NONE;
......@@ -422,8 +422,7 @@ bool InputMethodEngineBase::SendKeyEvents(
return false;
}
for (size_t i = 0; i < events.size(); ++i) {
const KeyboardEvent& event = events[i];
for (const auto& event : events) {
ui::KeyEvent ui_event = ConvertKeyboardEventToUIKeyEvent(event);
if (!SendKeyEvent(&ui_event, event.code, error))
return false;
......@@ -456,11 +455,11 @@ bool InputMethodEngineBase::SetComposition(
composition_text.selection.set_end(selection_end);
// TODO: Add support for displaying selected text in the composition string.
for (auto segment = segments.begin(); segment != segments.end(); ++segment) {
for (auto segment : segments) {
ui::ImeTextSpan ime_text_span;
ime_text_span.underline_color = SK_ColorTRANSPARENT;
switch (segment->style) {
switch (segment.style) {
case SEGMENT_STYLE_UNDERLINE:
ime_text_span.thickness = ui::ImeTextSpan::Thickness::kThin;
break;
......@@ -474,8 +473,8 @@ bool InputMethodEngineBase::SetComposition(
continue;
}
ime_text_span.start_offset = segment->start;
ime_text_span.end_offset = segment->end;
ime_text_span.start_offset = segment.start;
ime_text_span.end_offset = segment.end;
composition_text.ime_text_spans.push_back(ime_text_span);
}
......
......@@ -73,7 +73,7 @@ class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface,
class Observer {
public:
virtual ~Observer() {}
virtual ~Observer() = default;
// Called when the IME becomes the active IME.
virtual void OnActivate(const std::string& engine_id) = 0;
......
......@@ -136,7 +136,7 @@ class KeyEventDoneCallback {
public:
explicit KeyEventDoneCallback(bool expected_argument)
: expected_argument_(expected_argument) {}
~KeyEventDoneCallback() {}
~KeyEventDoneCallback() = default;
void Run(bool consumed) {
if (consumed == expected_argument_)
......
......@@ -351,8 +351,8 @@ class InputMethodManagerImpl : public InputMethodManager,
uint32_t features_enabled_state_;
// The engine map from extension_id to an engine.
typedef std::map<std::string, ui::IMEEngineHandlerInterface*> EngineMap;
typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap;
using EngineMap = std::map<std::string, ui::IMEEngineHandlerInterface*>;
using ProfileEngineMap = std::map<Profile*, EngineMap, ProfileCompare>;
ProfileEngineMap engine_map_;
content::NotificationRegistrar notification_registrar_;
......
......@@ -104,7 +104,7 @@ class TestPersonalDataManagerObserver
autofill::PersonalDataManagerFactory::GetForProfile(profile_)->AddObserver(
this);
}
~TestPersonalDataManagerObserver() override {}
~TestPersonalDataManagerObserver() override = default;
// Waits for the PersonalDataManager's list of profiles to be updated.
void Wait() {
......
......@@ -210,7 +210,7 @@ PersonalInfoSuggester::PersonalInfoSuggester(
ui::ime::AssistiveWindowType::kPersonalInfoSuggestion;
}
PersonalInfoSuggester::~PersonalInfoSuggester() {}
PersonalInfoSuggester::~PersonalInfoSuggester() = default;
void PersonalInfoSuggester::OnFocus(int context_id) {
context_id_ = context_id;
......
......@@ -17,7 +17,7 @@ namespace chromeos {
// suggestion according to the user action.
class Suggester {
public:
virtual ~Suggester() {}
virtual ~Suggester() = default;
// Called when a text field gains focus, and suggester starts working.
virtual void OnFocus(int context_id) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment