Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine.cc

Issue 1657593007: Implement chrome.input.ime.setComposition/commitText API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Devlin's comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/input_method/input_method_engine.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #undef FocusIn 9 #undef FocusIn
10 #undef FocusOut 10 #undef FocusOut
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 case MENU_ITEM_STYLE_SEPARATOR: 337 case MENU_ITEM_STYLE_SEPARATOR:
338 // TODO(nona): Implement it. 338 // TODO(nona): Implement it.
339 break; 339 break;
340 } 340 }
341 } 341 }
342 } 342 }
343 343
344 // TODO(nona): Support item.children. 344 // TODO(nona): Support item.children.
345 } 345 }
346 346
347 void InputMethodEngine::UpdateComposition(
348 const ui::CompositionText& composition_text,
349 uint32_t cursor_pos,
350 bool is_visible) {
351 ui::IMEInputContextHandlerInterface* input_context =
352 ui::IMEBridge::Get()->GetInputContextHandler();
353 if (input_context)
354 input_context->UpdateCompositionText(composition_text, cursor_pos,
355 is_visible);
356 }
357
358 void InputMethodEngine::CommitTextToInputContext(int context_id,
359 const std::string& text) {
360 ui::IMEBridge::Get()->GetInputContextHandler()->CommitText(text);
361
362 // Records histograms for committed characters.
363 if (!composition_text_->text.empty()) {
364 UMA_HISTOGRAM_CUSTOM_COUNTS("InputMethod.CommitLength", text.length(), 1,
365 25, 25);
366 composition_text_.reset(new ui::CompositionText());
367 }
368 }
369
347 } // namespace chromeos 370 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698