diff options
author | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 10:16:42 +0000 |
---|---|---|
committer | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-11 10:16:42 +0000 |
commit | 0f9849e82a0bc7edb42503f68fb9c795c32b919c (patch) | |
tree | 43c47a36bdda7a8fd9f61df9eb2733352699ea87 /views | |
parent | 8e61ffa98aa33169d655b2284be271f56f64bd25 (diff) | |
download | chromium_src-0f9849e82a0bc7edb42503f68fb9c795c32b919c.zip chromium_src-0f9849e82a0bc7edb42503f68fb9c795c32b919c.tar.gz chromium_src-0f9849e82a0bc7edb42503f68fb9c795c32b919c.tar.bz2 |
Move views/ime/text_input_client.h to ui/base/ime/.
- Remove Views dependencies from text_input_client.h.
- Change namespace from views:: to ui::.
This change is necessary for RenderWidgetHostViewAura to support IME since RWHVA is Views agnostic and cannot directly use classes under views/ime/.
BUG=chromium:97261
TEST=try
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=109583
Review URL: http://codereview.chromium.org/8509034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
25 files changed, 62 insertions, 173 deletions
diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc index b4a98f8..d2a353a 100644 --- a/views/controls/textfield/native_textfield_gtk.cc +++ b/views/controls/textfield/native_textfield_gtk.cc @@ -288,7 +288,7 @@ void NativeTextfieldGtk::HandleFocus() { void NativeTextfieldGtk::HandleBlur() { } -TextInputClient* NativeTextfieldGtk::GetTextInputClient() { +ui::TextInputClient* NativeTextfieldGtk::GetTextInputClient() { return NULL; } diff --git a/views/controls/textfield/native_textfield_gtk.h b/views/controls/textfield/native_textfield_gtk.h index e7be873..33b067e 100644 --- a/views/controls/textfield/native_textfield_gtk.h +++ b/views/controls/textfield/native_textfield_gtk.h @@ -62,7 +62,7 @@ class NativeTextfieldGtk : public NativeControlGtk, virtual bool HandleKeyReleased(const views::KeyEvent& e) OVERRIDE; virtual void HandleFocus() OVERRIDE; virtual void HandleBlur() OVERRIDE; - virtual TextInputClient* GetTextInputClient() OVERRIDE; + virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; virtual void ApplyStyleRange(const gfx::StyleRange& style) OVERRIDE; virtual void ApplyDefaultStyle() OVERRIDE; virtual void ClearEditHistory() OVERRIDE; diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc index 07725ff..107c95b 100644 --- a/views/controls/textfield/native_textfield_views.cc +++ b/views/controls/textfield/native_textfield_views.cc @@ -555,7 +555,7 @@ void NativeTextfieldViews::HandleBlur() { touch_selection_controller_->ClientViewLostFocus(); } -TextInputClient* NativeTextfieldViews::GetTextInputClient() { +ui::TextInputClient* NativeTextfieldViews::GetTextInputClient() { return textfield_->read_only() ? NULL : this; } @@ -652,7 +652,7 @@ void NativeTextfieldViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { } /////////////////////////////////////////////////////////////////////////////// -// NativeTextfieldViews, TextInputClient implementation, private: +// NativeTextfieldViews, ui::TextInputClient implementation, private: void NativeTextfieldViews::SetCompositionText( const ui::CompositionText& composition) { @@ -813,10 +813,6 @@ bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( return false; } -View* NativeTextfieldViews::GetOwnerViewOfTextInputClient() { - return textfield_; -} - void NativeTextfieldViews::OnCompositionTextConfirmedOrCleared() { if (skip_input_method_cancel_composition_) return; diff --git a/views/controls/textfield/native_textfield_views.h b/views/controls/textfield/native_textfield_views.h index 17967bb..9f149d8 100644 --- a/views/controls/textfield/native_textfield_views.h +++ b/views/controls/textfield/native_textfield_views.h @@ -8,6 +8,7 @@ #include "base/memory/weak_ptr.h" #include "base/string16.h" +#include "ui/base/ime/text_input_client.h" #include "ui/base/models/simple_menu_model.h" #include "ui/gfx/font.h" #include "views/border.h" @@ -15,7 +16,6 @@ #include "views/controls/textfield/native_textfield_wrapper.h" #include "views/controls/textfield/textfield_views_model.h" #include "views/drag_controller.h" -#include "views/ime/text_input_client.h" #include "views/touchui/touch_selection_controller.h" #include "views/view.h" @@ -46,7 +46,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public TouchSelectionClientView, public ContextMenuController, public DragController, public NativeTextfieldWrapper, - public TextInputClient, + public ui::TextInputClient, public TextfieldViewsModel::Delegate { public: explicit NativeTextfieldViews(Textfield* parent); @@ -119,7 +119,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public TouchSelectionClientView, virtual bool HandleKeyReleased(const KeyEvent& e) OVERRIDE; virtual void HandleFocus() OVERRIDE; virtual void HandleBlur() OVERRIDE; - virtual TextInputClient* GetTextInputClient() OVERRIDE; + virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; virtual void ApplyStyleRange(const gfx::StyleRange& style) OVERRIDE; virtual void ApplyDefaultStyle() OVERRIDE; virtual void ClearEditHistory() OVERRIDE; @@ -143,7 +143,7 @@ class VIEWS_EXPORT NativeTextfieldViews : public TouchSelectionClientView, friend class NativeTextfieldViewsTest; friend class TouchSelectionControllerImplTest; - // Overridden from TextInputClient: + // Overridden from ui::TextInputClient: virtual void SetCompositionText( const ui::CompositionText& composition) OVERRIDE; virtual void ConfirmCompositionText() OVERRIDE; @@ -163,7 +163,6 @@ class VIEWS_EXPORT NativeTextfieldViews : public TouchSelectionClientView, virtual void OnInputMethodChanged() OVERRIDE; virtual bool ChangeTextDirectionAndLayoutAlignment( base::i18n::TextDirection direction) OVERRIDE; - virtual View* GetOwnerViewOfTextInputClient() OVERRIDE; // Overridden from TextfieldViewsModel::Delegate: virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc index f0c24b7..f3a046a 100644 --- a/views/controls/textfield/native_textfield_views_unittest.cc +++ b/views/controls/textfield/native_textfield_views_unittest.cc @@ -17,6 +17,7 @@ #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/dragdrop/drag_drop_types.h" +#include "ui/base/ime/text_input_client.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/render_text.h" @@ -27,7 +28,6 @@ #include "views/events/event.h" #include "views/focus/focus_manager.h" #include "views/ime/mock_input_method.h" -#include "views/ime/text_input_client.h" #include "views/test/test_views_delegate.h" #include "views/test/views_test_base.h" #include "views/views_delegate.h" @@ -91,7 +91,7 @@ class TestTextfield : public views::Textfield { DISALLOW_COPY_AND_ASSIGN(TestTextfield); }; -// A helper class for use with TextInputClient::GetTextFromRange(). +// A helper class for use with ui::TextInputClient::GetTextFromRange(). class GetTextHelper { public: GetTextHelper() { @@ -1019,7 +1019,7 @@ TEST_F(NativeTextfieldViewsTest, ReadOnlyTest) { TEST_F(NativeTextfieldViewsTest, TextInputClientTest) { InitTextfield(Textfield::STYLE_DEFAULT); - TextInputClient* client = textfield_->GetTextInputClient(); + ui::TextInputClient* client = textfield_->GetTextInputClient(); EXPECT_TRUE(client); EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, client->GetTextInputType()); diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index 025fc40..f1c2dc0 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -374,7 +374,7 @@ void NativeTextfieldWin::HandleFocus() { void NativeTextfieldWin::HandleBlur() { } -TextInputClient* NativeTextfieldWin::GetTextInputClient() { +ui::TextInputClient* NativeTextfieldWin::GetTextInputClient() { return NULL; } diff --git a/views/controls/textfield/native_textfield_win.h b/views/controls/textfield/native_textfield_win.h index bb8cb96..459c095 100644 --- a/views/controls/textfield/native_textfield_win.h +++ b/views/controls/textfield/native_textfield_win.h @@ -92,7 +92,7 @@ class NativeTextfieldWin virtual bool HandleKeyReleased(const views::KeyEvent& event) OVERRIDE; virtual void HandleFocus() OVERRIDE; virtual void HandleBlur() OVERRIDE; - virtual TextInputClient* GetTextInputClient() OVERRIDE; + virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; virtual void ApplyStyleRange(const gfx::StyleRange& style) OVERRIDE; virtual void ApplyDefaultStyle() OVERRIDE; virtual void ClearEditHistory() OVERRIDE; diff --git a/views/controls/textfield/native_textfield_wrapper.h b/views/controls/textfield/native_textfield_wrapper.h index f6b0f8a..f4439da 100644 --- a/views/controls/textfield/native_textfield_wrapper.h +++ b/views/controls/textfield/native_textfield_wrapper.h @@ -18,13 +18,13 @@ struct StyleRange; namespace ui { class Range; +class TextInputClient; } // namespace ui namespace views { class KeyEvent; class Textfield; -class TextInputClient; class View; // An interface implemented by an object that provides a platform-native @@ -132,7 +132,7 @@ class VIEWS_EXPORT NativeTextfieldWrapper { // Returns the View's TextInputClient instance or NULL if the View doesn't // support text input. - virtual TextInputClient* GetTextInputClient() = 0; + virtual ui::TextInputClient* GetTextInputClient() = 0; // Applies the |style| to the text specified by its range. // See |Textfield::ApplyStyleRange| for detail. diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc index 8eaa0de..a8e041e 100644 --- a/views/controls/textfield/textfield.cc +++ b/views/controls/textfield/textfield.cc @@ -410,7 +410,7 @@ void Textfield::GetAccessibleState(ui::AccessibleViewState* state) { state->selection_end = range.end(); } -TextInputClient* Textfield::GetTextInputClient() { +ui::TextInputClient* Textfield::GetTextInputClient() { return native_wrapper_ ? native_wrapper_->GetTextInputClient() : NULL; } diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h index 7e73caf..f6f3567 100644 --- a/views/controls/textfield/textfield.h +++ b/views/controls/textfield/textfield.h @@ -31,6 +31,7 @@ struct StyleRange; namespace ui { class Range; +class TextInputClient; } // namespace ui namespace views { @@ -235,7 +236,7 @@ class VIEWS_EXPORT Textfield : public View { virtual void OnFocus() OVERRIDE; virtual void OnBlur() OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; - virtual TextInputClient* GetTextInputClient() OVERRIDE; + virtual ui::TextInputClient* GetTextInputClient() OVERRIDE; protected: virtual void ViewHierarchyChanged(bool is_add, View* parent, diff --git a/views/ime/input_method.h b/views/ime/input_method.h index 1c7df22..4ec9523 100644 --- a/views/ime/input_method.h +++ b/views/ime/input_method.h @@ -13,6 +13,10 @@ #include "ui/base/ime/text_input_type.h" #include "views/views_export.h" +namespace ui { +class TextInputClient; +} // namespace ui + namespace views { namespace internal { @@ -20,7 +24,6 @@ class InputMethodDelegate; } // namespace internal class KeyEvent; -class TextInputClient; class View; class Widget; @@ -96,7 +99,7 @@ class VIEWS_EXPORT InputMethod { // Gets the focused text input client. Returns NULL if the Widget is not // focused, or there is no focused View or the focused View doesn't support // text input. - virtual TextInputClient* GetTextInputClient() const = 0; + virtual ui::TextInputClient* GetTextInputClient() const = 0; // Gets the text input type of the focused text input client. Returns // ui::TEXT_INPUT_TYPE_NONE if there is no focused text input client. diff --git a/views/ime/input_method_base.cc b/views/ime/input_method_base.cc index 6155ccd..1fb0a15 100644 --- a/views/ime/input_method_base.cc +++ b/views/ime/input_method_base.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "ui/base/ime/text_input_client.h" #include "views/ime/input_method_base.h" #include "views/ime/text_input_type_tracker.h" #include "views/view.h" @@ -70,13 +71,13 @@ void InputMethodBase::OnTextInputTypeChanged(View* view) { } } -TextInputClient* InputMethodBase::GetTextInputClient() const { +ui::TextInputClient* InputMethodBase::GetTextInputClient() const { return (widget_focused_ && GetFocusedView()) ? GetFocusedView()->GetTextInputClient() : NULL; } ui::TextInputType InputMethodBase::GetTextInputType() const { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); return client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; } @@ -103,7 +104,7 @@ bool InputMethodBase::IsTextInputTypeNone() const { } void InputMethodBase::OnInputMethodChanged() const { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client && client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) client->OnInputMethodChanged(); } @@ -115,7 +116,7 @@ void InputMethodBase::DispatchKeyEventPostIME(const KeyEvent& key) const { bool InputMethodBase::GetCaretBoundsInWidget(gfx::Rect* rect) const { DCHECK(rect); - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (!client || client->GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) return false; diff --git a/views/ime/input_method_base.h b/views/ime/input_method_base.h index e657e22..751757a 100644 --- a/views/ime/input_method_base.h +++ b/views/ime/input_method_base.h @@ -11,7 +11,14 @@ #include "views/focus/focus_manager.h" #include "views/ime/input_method.h" #include "views/ime/input_method_delegate.h" -#include "views/ime/text_input_client.h" + +namespace gfx { +class Rect; +} // namespace gfx + +namespace ui { +class TextInputClient; +} // namespace ui namespace views { @@ -46,7 +53,7 @@ class VIEWS_EXPORT InputMethodBase : public InputMethod, // implementation. virtual void OnTextInputTypeChanged(View* view) OVERRIDE; - virtual TextInputClient* GetTextInputClient() const OVERRIDE; + virtual ui::TextInputClient* GetTextInputClient() const OVERRIDE; virtual ui::TextInputType GetTextInputType() const OVERRIDE; virtual bool IsMock() const OVERRIDE; diff --git a/views/ime/input_method_gtk.cc b/views/ime/input_method_gtk.cc index ee1dabb..50fd37e 100644 --- a/views/ime/input_method_gtk.cc +++ b/views/ime/input_method_gtk.cc @@ -209,7 +209,7 @@ void InputMethodGtk::OnDidChangeFocus(View* focused_before, View* focused) { } void InputMethodGtk::ConfirmCompositionText() { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client && client->HasCompositionText()) client->ConfirmCompositionText(); @@ -297,14 +297,14 @@ void InputMethodGtk::ProcessUnfilteredKeyPressEvent(const KeyEvent& key) { // event (ctrl-a, return, tab, etc.). We need to send the character to the // focused text input client by calling TextInputClient::InsertChar(). char16 ch = key.GetCharacter(); - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (ch && client) client->InsertChar(ch, key.flags()); } void InputMethodGtk::ProcessInputMethodResult(const KeyEvent& key, bool filtered) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); DCHECK(client); if (result_text_.length()) { @@ -427,7 +427,7 @@ void InputMethodGtk::OnPreeditEnd(GtkIMContext* context) { composition_.Clear(); if (!handling_key_event_) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client && client->HasCompositionText()) client->ClearCompositionText(); } diff --git a/views/ime/input_method_gtk.h b/views/ime/input_method_gtk.h index fe323ea..4e40409 100644 --- a/views/ime/input_method_gtk.h +++ b/views/ime/input_method_gtk.h @@ -11,6 +11,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/base/gtk/gtk_signal.h" +#include "ui/base/ime/composition_text.h" +#include "ui/base/ime/text_input_client.h" #include "views/ime/input_method_base.h" #include "views/view.h" diff --git a/views/ime/input_method_ibus.cc b/views/ime/input_method_ibus.cc index a9fa1c3..c9090ff 100644 --- a/views/ime/input_method_ibus.cc +++ b/views/ime/input_method_ibus.cc @@ -596,7 +596,7 @@ void InputMethodIBus::DestroyContext() { } void InputMethodIBus::ConfirmCompositionText() { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client && client->HasCompositionText()) client->ConfirmCompositionText(); @@ -744,7 +744,7 @@ void InputMethodIBus::ProcessUnfilteredKeyPressEvent(const KeyEvent& key, if (character_composer_.FilterKeyPress(ibus_keyval)) { string16 composed = character_composer_.composed_character(); if (!composed.empty()) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client) client->InsertText(composed); } @@ -754,7 +754,7 @@ void InputMethodIBus::ProcessUnfilteredKeyPressEvent(const KeyEvent& key, // then it means the key event didn't generate any result text. So we need // to send corresponding character to the focused text input client. - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); char16 ch = key.GetCharacter(); if (ch && client) client->InsertChar(ch, key.flags()); @@ -762,7 +762,7 @@ void InputMethodIBus::ProcessUnfilteredKeyPressEvent(const KeyEvent& key, void InputMethodIBus::ProcessInputMethodResult(const KeyEvent& key, bool filtered) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); DCHECK(client); if (result_text_.length()) { @@ -939,7 +939,7 @@ void InputMethodIBus::OnHidePreeditText(IBusInputContext* context) { composition_.Clear(); if (pending_key_events_.empty()) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client && client->HasCompositionText()) client->ClearCompositionText(); composition_changed_ = false; diff --git a/views/ime/input_method_ibus.h b/views/ime/input_method_ibus.h index d07a457..c9fd102 100644 --- a/views/ime/input_method_ibus.h +++ b/views/ime/input_method_ibus.h @@ -15,6 +15,8 @@ #include "ui/base/glib/glib_integers.h" #include "ui/base/glib/glib_signal.h" #include "ui/base/ime/character_composer.h" +#include "ui/base/ime/composition_text.h" +#include "ui/base/ime/text_input_client.h" #include "views/events/event.h" #include "views/ime/input_method_base.h" #include "views/view.h" diff --git a/views/ime/input_method_wayland.cc b/views/ime/input_method_wayland.cc index 20d3ff2..4b90b2b 100644 --- a/views/ime/input_method_wayland.cc +++ b/views/ime/input_method_wayland.cc @@ -68,7 +68,7 @@ void InputMethodWayland::ProcessKeyPressEvent(const KeyEvent& key) { // event (ctrl-a, return, tab, etc.). We need to send the character to the // focused text input client by calling TextInputClient::InsertChar(). char16 ch = key.GetCharacter(); - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (ch && client) client->InsertChar(ch, key.flags()); } diff --git a/views/ime/input_method_win.cc b/views/ime/input_method_win.cc index 12ae2f4..748df76 100644 --- a/views/ime/input_method_win.cc +++ b/views/ime/input_method_win.cc @@ -7,6 +7,8 @@ #include "base/basictypes.h" #include "base/logging.h" #include "base/string_util.h" +#include "ui/base/ime/composition_text.h" +#include "ui/base/ime/text_input_client.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/events/event.h" @@ -285,7 +287,7 @@ LRESULT InputMethodWin::OnDeadChar( } LRESULT InputMethodWin::OnDocumentFeed(RECONVERTSTRING* reconv) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (!client) return 0; @@ -348,7 +350,7 @@ LRESULT InputMethodWin::OnDocumentFeed(RECONVERTSTRING* reconv) { } LRESULT InputMethodWin::OnReconvertString(RECONVERTSTRING* reconv) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (!client) return 0; diff --git a/views/ime/mock_input_method.cc b/views/ime/mock_input_method.cc index 07dca3ac..5a227b7 100644 --- a/views/ime/mock_input_method.cc +++ b/views/ime/mock_input_method.cc @@ -6,6 +6,7 @@ #include "base/basictypes.h" #include "base/logging.h" +#include "ui/base/ime/text_input_client.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/events/event.h" #include "views/widget/widget.h" @@ -57,7 +58,7 @@ void MockInputMethod::DispatchKeyEvent(const KeyEvent& key) { if (focus_changed_) return; - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client) { if (handled) { if (result_text_.length()) @@ -112,7 +113,7 @@ bool MockInputMethod::IsMock() const { } void MockInputMethod::OnWillChangeFocus(View* focused_before, View* focused) { - TextInputClient* client = GetTextInputClient(); + ui::TextInputClient* client = GetTextInputClient(); if (client && client->HasCompositionText()) client->ConfirmCompositionText(); focus_changed_ = true; diff --git a/views/ime/mock_input_method.h b/views/ime/mock_input_method.h index 01373eb..b3392c1 100644 --- a/views/ime/mock_input_method.h +++ b/views/ime/mock_input_method.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "ui/base/ime/composition_text.h" #include "views/ime/input_method_base.h" #include "views/view.h" diff --git a/views/ime/text_input_client.h b/views/ime/text_input_client.h deleted file mode 100644 index a0dd86a3..0000000 --- a/views/ime/text_input_client.h +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef VIEWS_IME_TEXT_INPUT_CLIENT_H_ -#define VIEWS_IME_TEXT_INPUT_CLIENT_H_ -#pragma once - -#include <vector> - -#include "base/basictypes.h" -#include "base/string16.h" -#include "ui/base/ime/composition_text.h" -#include "ui/base/ime/text_input_type.h" -#include "ui/base/range/range.h" -#include "views/views_export.h" - -namespace gfx { -class Rect; -} - -namespace views { - -class View; - -// An interface implemented by a View that needs text input support. -class VIEWS_EXPORT TextInputClient { - public: - virtual ~TextInputClient() {} - - // Input method result ------------------------------------------------------- - - // Sets composition text and attributes. If there is composition text already, - // it’ll be replaced by the new one. Otherwise, current selection will be - // replaced. If there is no selection, the composition text will be inserted - // at the insertion point. - virtual void SetCompositionText(const ui::CompositionText& composition) = 0; - - // Converts current composition text into final content. - virtual void ConfirmCompositionText() = 0; - - // Removes current composition text. - virtual void ClearCompositionText() = 0; - - // Inserts a given text at the insertion point. Current composition text or - // selection will be removed. This method should never be called when the - // current text input type is TEXT_INPUT_TYPE_NONE. - virtual void InsertText(const string16& text) = 0; - - // Inserts a single char at the insertion point. Unlike above InsertText() - // method, this method has an extra |flags| parameter indicating the modifier - // key states when the character is generated. This method should only be - // called when a key press is not handled by the input method but still - // generates a character (eg. by the keyboard driver). In another word, the - // preceding key press event should not be a VKEY_PROCESSKEY. - // This method will be called whenever a char is generated by the keyboard, - // even if the current text input type is TEXT_INPUT_TYPE_NONE. - virtual void InsertChar(char16 ch, int flags) = 0; - - // Input context information ------------------------------------------------- - - // Returns current text input type. It could be changed and even becomes - // TEXT_INPUT_TYPE_NONE at runtime. - virtual ui::TextInputType GetTextInputType() const = 0; - - // Returns current caret (insertion point) bounds relative to the View’s - // coordinates. If there is selection, then the selection bounds will be - // returned. - virtual gfx::Rect GetCaretBounds() = 0; - - // Returns true if there is composition text. - virtual bool HasCompositionText() = 0; - - // Document content operations ---------------------------------------------- - - // Retrieves the UTF-16 based character range containing accessibled text in - // the View. It must cover the composition and selection range. - // Returns false if the information cannot be retrieved right now. - virtual bool GetTextRange(ui::Range* range) = 0; - - // Retrieves the UTF-16 based character range of current composition text. - // Returns false if the information cannot be retrieved right now. - virtual bool GetCompositionTextRange(ui::Range* range) = 0; - - // Retrieves the UTF-16 based character range of current selection. - // Returns false if the information cannot be retrieved right now. - virtual bool GetSelectionRange(ui::Range* range) = 0; - - // Selects the given UTF-16 based character range. Current composition text - // will be confirmed before selecting the range. - // Returns false if the operation is not supported. - virtual bool SetSelectionRange(const ui::Range& range) = 0; - - // Deletes contents in the given UTF-16 based character range. Current - // composition text will be confirmed before deleting the range. - // The input caret will be moved to the place where the range gets deleted. - // Returns false if the oepration is not supported. - virtual bool DeleteRange(const ui::Range& range) = 0; - - // Retrieves the text content in a given UTF-16 based character range. - // The result will be stored into |*text|. - // Returns false if the operation is not supported or the specified range - // is out of the text range returned by GetTextRange(). - virtual bool GetTextFromRange(const ui::Range& range, string16* text) = 0; - - // Miscellaneous ------------------------------------------------------------ - - // Called whenever current keyboard layout or input method is changed, - // especially the change of input locale and text direction. - virtual void OnInputMethodChanged() = 0; - - // Called whenever the user requests to change the text direction and layout - // alignment of the current text box. It’s for supporting ctrl-shift on - // Windows. - // Returns false if the operation is not supported. - virtual bool ChangeTextDirectionAndLayoutAlignment( - base::i18n::TextDirection direction) = 0; - - // Gets the View object who owns this TextInputClient instance. - virtual View* GetOwnerViewOfTextInputClient() = 0; -}; - -} // namespace views - -#endif // VIEWS_IME_TEXT_INPUT_CLIENT_H_ diff --git a/views/view.cc b/views/view.cc index b3644dc..698caba 100644 --- a/views/view.cc +++ b/views/view.cc @@ -793,7 +793,7 @@ bool View::OnMouseWheel(const MouseWheelEvent& event) { return false; } -TextInputClient* View::GetTextInputClient() { +ui::TextInputClient* View::GetTextInputClient() { return NULL; } diff --git a/views/view.h b/views/view.h index 6c49097..222833a 100644 --- a/views/view.h +++ b/views/view.h @@ -42,6 +42,7 @@ struct AccessibleViewState; class Compositor; class Layer; class LayerAnimationSequence; +class TextInputClient; class Texture; class ThemeProvider; class Transform; @@ -64,7 +65,6 @@ class FocusTraversable; class InputMethod; class LayoutManager; class ScrollView; -class TextInputClient; class Widget; namespace internal { @@ -623,7 +623,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, // Returns the View's TextInputClient instance or NULL if the View doesn't // support text input. - virtual TextInputClient* GetTextInputClient(); + virtual ui::TextInputClient* GetTextInputClient(); // Convenience method to retrieve the InputMethod associated with the // Widget that contains this view. Returns NULL if this view is not part of a diff --git a/views/views.gyp b/views/views.gyp index fb115d9..6f4da62 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -304,7 +304,6 @@ 'ime/input_method_win.h', 'ime/mock_input_method.cc', 'ime/mock_input_method.h', - 'ime/text_input_client.h', 'ime/text_input_type_tracker.h', 'ime/text_input_type_tracker.cc', 'layout/box_layout.cc', |