Mandoline: Enable Android software keyboard for the Omnibox.
BUG=498624 Review URL: https://codereview.chromium.org/1286383003 Cr-Commit-Position: refs/heads/master@{#343679}
This commit is contained in:
components
html_viewer
view_manager
mandoline/ui
aura
omnibox
mojo/converters/ime
ui
@@ -34,16 +34,16 @@ TEXT_INPUT_TYPE_ASSERT(TEXT_AREA, TextArea);
|
|||||||
static_cast<int32>(blink::WebTextInputFlag##Name), \
|
static_cast<int32>(blink::WebTextInputFlag##Name), \
|
||||||
text_input_flag_should_match)
|
text_input_flag_should_match)
|
||||||
TEXT_INPUT_FLAG_ASSERT(NONE, None);
|
TEXT_INPUT_FLAG_ASSERT(NONE, None);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_COMPLETE_ON, AutocompleteOn);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCOMPLETE_ON, AutocompleteOn);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_COMPLETE_OFF, AutocompleteOff);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCOMPLETE_OFF, AutocompleteOff);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CORRECT_ON, AutocorrectOn);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCORRECT_ON, AutocorrectOn);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CORRECT_OFF, AutocorrectOff);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCORRECT_OFF, AutocorrectOff);
|
||||||
TEXT_INPUT_FLAG_ASSERT(SPELL_CHECK_ON, SpellcheckOn);
|
TEXT_INPUT_FLAG_ASSERT(SPELLCHECK_ON, SpellcheckOn);
|
||||||
TEXT_INPUT_FLAG_ASSERT(SPELL_CHECK_OFF, SpellcheckOff);
|
TEXT_INPUT_FLAG_ASSERT(SPELLCHECK_OFF, SpellcheckOff);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_NONE, AutocapitalizeNone);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_NONE, AutocapitalizeNone);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_CHARACTERS, AutocapitalizeCharacters);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_CHARACTERS, AutocapitalizeCharacters);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_WORDS, AutocapitalizeWords);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_WORDS, AutocapitalizeWords);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_SENTENCES, AutocapitalizeSentences);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_SENTENCES, AutocapitalizeSentences);
|
||||||
|
|
||||||
TextInputType
|
TextInputType
|
||||||
TypeConverter<TextInputType, blink::WebTextInputType>::Convert(
|
TypeConverter<TextInputType, blink::WebTextInputType>::Convert(
|
||||||
|
@@ -90,8 +90,6 @@ source_set("lib") {
|
|||||||
"server_view_drawn_tracker.h",
|
"server_view_drawn_tracker.h",
|
||||||
"server_view_drawn_tracker_observer.h",
|
"server_view_drawn_tracker_observer.h",
|
||||||
"server_view_observer.h",
|
"server_view_observer.h",
|
||||||
"type_converters.cc",
|
|
||||||
"type_converters.h",
|
|
||||||
"view_coordinate_conversions.cc",
|
"view_coordinate_conversions.cc",
|
||||||
"view_coordinate_conversions.h",
|
"view_coordinate_conversions.h",
|
||||||
"view_locator.cc",
|
"view_locator.cc",
|
||||||
@@ -123,6 +121,7 @@ source_set("lib") {
|
|||||||
"//mojo/application/public/cpp",
|
"//mojo/application/public/cpp",
|
||||||
"//mojo/common:tracing_impl",
|
"//mojo/common:tracing_impl",
|
||||||
"//mojo/converters/geometry",
|
"//mojo/converters/geometry",
|
||||||
|
"//mojo/converters/ime",
|
||||||
"//mojo/converters/input_events",
|
"//mojo/converters/input_events",
|
||||||
"//mojo/converters/surfaces",
|
"//mojo/converters/surfaces",
|
||||||
"//third_party/mojo/src/mojo/public/cpp/bindings:callback",
|
"//third_party/mojo/src/mojo/public/cpp/bindings:callback",
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
// Copyright 2015 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 COMPONENTS_VIEW_MANAGER_TYPE_CONVERTERS_H_
|
|
||||||
#define COMPONENTS_VIEW_MANAGER_TYPE_CONVERTERS_H_
|
|
||||||
|
|
||||||
#include "ui/mojo/ime/text_input_state.mojom.h"
|
|
||||||
#include "ui/platform_window/text_input_state.h"
|
|
||||||
|
|
||||||
namespace mojo {
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct TypeConverter<ui::TextInputType, TextInputType> {
|
|
||||||
static ui::TextInputType Convert(const TextInputType& input);
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
struct TypeConverter<ui::TextInputState, TextInputStatePtr> {
|
|
||||||
static ui::TextInputState Convert(const TextInputStatePtr& input);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace mojo
|
|
||||||
|
|
||||||
#endif // COMPONENTS_VIEW_MANAGER_TYPE_CONVERTERS_H_
|
|
@@ -10,9 +10,9 @@
|
|||||||
#include "components/view_manager/default_access_policy.h"
|
#include "components/view_manager/default_access_policy.h"
|
||||||
#include "components/view_manager/display_manager.h"
|
#include "components/view_manager/display_manager.h"
|
||||||
#include "components/view_manager/server_view.h"
|
#include "components/view_manager/server_view.h"
|
||||||
#include "components/view_manager/type_converters.h"
|
|
||||||
#include "components/view_manager/window_manager_access_policy.h"
|
#include "components/view_manager/window_manager_access_policy.h"
|
||||||
#include "mojo/converters/geometry/geometry_type_converters.h"
|
#include "mojo/converters/geometry/geometry_type_converters.h"
|
||||||
|
#include "mojo/converters/ime/ime_type_converters.h"
|
||||||
#include "mojo/converters/input_events/input_events_type_converters.h"
|
#include "mojo/converters/input_events/input_events_type_converters.h"
|
||||||
#include "mojo/converters/surfaces/surfaces_type_converters.h"
|
#include "mojo/converters/surfaces/surfaces_type_converters.h"
|
||||||
#include "ui/platform_window/text_input_state.h"
|
#include "ui/platform_window/text_input_state.h"
|
||||||
|
@@ -38,6 +38,7 @@ source_set("aura") {
|
|||||||
"//mojo/application/public/interfaces",
|
"//mojo/application/public/interfaces",
|
||||||
"//mojo/cc",
|
"//mojo/cc",
|
||||||
"//mojo/converters/geometry",
|
"//mojo/converters/geometry",
|
||||||
|
"//mojo/converters/ime",
|
||||||
"//mojo/converters/input_events",
|
"//mojo/converters/input_events",
|
||||||
"//mojo/converters/surfaces",
|
"//mojo/converters/surfaces",
|
||||||
"//third_party/mojo/src/mojo/public/c/gles2",
|
"//third_party/mojo/src/mojo/public/c/gles2",
|
||||||
@@ -47,6 +48,7 @@ source_set("aura") {
|
|||||||
"//ui/events",
|
"//ui/events",
|
||||||
"//ui/events:events_base",
|
"//ui/events:events_base",
|
||||||
"//ui/gl",
|
"//ui/gl",
|
||||||
|
"//ui/mojo/ime:interfaces_cpp_sources",
|
||||||
"//ui/mojo/init",
|
"//ui/mojo/init",
|
||||||
"//ui/views",
|
"//ui/views",
|
||||||
"//ui/wm",
|
"//ui/wm",
|
||||||
|
@@ -15,6 +15,7 @@ include_rules = [
|
|||||||
"+ui/events",
|
"+ui/events",
|
||||||
"+ui/gfx",
|
"+ui/gfx",
|
||||||
"+ui/gl",
|
"+ui/gl",
|
||||||
|
"+ui/mojo/ime",
|
||||||
"+ui/mojo/init",
|
"+ui/mojo/init",
|
||||||
"+ui/views",
|
"+ui/views",
|
||||||
"+ui/wm",
|
"+ui/wm",
|
||||||
|
@@ -4,8 +4,11 @@
|
|||||||
|
|
||||||
#include "mandoline/ui/aura/input_method_mandoline.h"
|
#include "mandoline/ui/aura/input_method_mandoline.h"
|
||||||
|
|
||||||
|
#include "components/view_manager/public/cpp/view.h"
|
||||||
|
#include "mojo/converters/ime/ime_type_converters.h"
|
||||||
#include "ui/base/ime/text_input_client.h"
|
#include "ui/base/ime/text_input_client.h"
|
||||||
#include "ui/events/event.h"
|
#include "ui/events/event.h"
|
||||||
|
#include "ui/mojo/ime/text_input_state.mojom.h"
|
||||||
|
|
||||||
namespace mandoline {
|
namespace mandoline {
|
||||||
|
|
||||||
@@ -13,7 +16,9 @@ namespace mandoline {
|
|||||||
// InputMethodMandoline, public:
|
// InputMethodMandoline, public:
|
||||||
|
|
||||||
InputMethodMandoline::InputMethodMandoline(
|
InputMethodMandoline::InputMethodMandoline(
|
||||||
ui::internal::InputMethodDelegate* delegate) {
|
ui::internal::InputMethodDelegate* delegate,
|
||||||
|
mojo::View* view)
|
||||||
|
: view_(view) {
|
||||||
SetDelegate(delegate);
|
SetDelegate(delegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,6 +27,16 @@ InputMethodMandoline::~InputMethodMandoline() {}
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// InputMethodMandoline, ui::InputMethod implementation:
|
// InputMethodMandoline, ui::InputMethod implementation:
|
||||||
|
|
||||||
|
void InputMethodMandoline::OnFocus() {
|
||||||
|
InputMethodBase::OnFocus();
|
||||||
|
UpdateTextInputType();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputMethodMandoline::OnBlur() {
|
||||||
|
InputMethodBase::OnBlur();
|
||||||
|
UpdateTextInputType();
|
||||||
|
}
|
||||||
|
|
||||||
bool InputMethodMandoline::OnUntranslatedIMEMessage(
|
bool InputMethodMandoline::OnUntranslatedIMEMessage(
|
||||||
const base::NativeEvent& event,
|
const base::NativeEvent& event,
|
||||||
NativeEventResult* result) {
|
NativeEventResult* result) {
|
||||||
@@ -51,6 +66,13 @@ void InputMethodMandoline::DispatchKeyEvent(ui::KeyEvent* event) {
|
|||||||
ignore_result(DispatchKeyEventPostIME(event));
|
ignore_result(DispatchKeyEventPostIME(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputMethodMandoline::OnTextInputTypeChanged(
|
||||||
|
const ui::TextInputClient* client) {
|
||||||
|
if (IsTextInputClientFocused(client))
|
||||||
|
UpdateTextInputType();
|
||||||
|
InputMethodBase::OnTextInputTypeChanged(client);
|
||||||
|
}
|
||||||
|
|
||||||
void InputMethodMandoline::OnCaretBoundsChanged(
|
void InputMethodMandoline::OnCaretBoundsChanged(
|
||||||
const ui::TextInputClient* client) {
|
const ui::TextInputClient* client) {
|
||||||
}
|
}
|
||||||
@@ -70,4 +92,21 @@ bool InputMethodMandoline::IsCandidatePopupOpen() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputMethodMandoline::OnDidChangeFocusedClient(
|
||||||
|
ui::TextInputClient* focused_before,
|
||||||
|
ui::TextInputClient* focused) {
|
||||||
|
InputMethodBase::OnDidChangeFocusedClient(focused_before, focused);
|
||||||
|
UpdateTextInputType();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputMethodMandoline::UpdateTextInputType() {
|
||||||
|
ui::TextInputType type = GetTextInputType();
|
||||||
|
mojo::TextInputStatePtr state = mojo::TextInputState::New();
|
||||||
|
state->type = mojo::ConvertTo<mojo::TextInputType>(type);
|
||||||
|
if (type != ui::TEXT_INPUT_TYPE_NONE)
|
||||||
|
view_->SetImeVisibility(true, state.Pass());
|
||||||
|
else
|
||||||
|
view_->SetTextInputState(state.Pass());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mandoline
|
} // namespace mandoline
|
||||||
|
@@ -7,24 +7,41 @@
|
|||||||
#ifndef MANDOLINE_UI_AURA_INPUT_METHOD_MANDOLINE_H_
|
#ifndef MANDOLINE_UI_AURA_INPUT_METHOD_MANDOLINE_H_
|
||||||
#define MANDOLINE_UI_AURA_INPUT_METHOD_MANDOLINE_H_
|
#define MANDOLINE_UI_AURA_INPUT_METHOD_MANDOLINE_H_
|
||||||
|
|
||||||
|
namespace mojo {
|
||||||
|
class View;
|
||||||
|
} // namespace mojo
|
||||||
|
|
||||||
namespace mandoline {
|
namespace mandoline {
|
||||||
|
|
||||||
class InputMethodMandoline : public ui::InputMethodBase {
|
class InputMethodMandoline : public ui::InputMethodBase {
|
||||||
public:
|
public:
|
||||||
explicit InputMethodMandoline(ui::internal::InputMethodDelegate* delegate);
|
InputMethodMandoline(ui::internal::InputMethodDelegate* delegate,
|
||||||
|
mojo::View* view);
|
||||||
~InputMethodMandoline() override;
|
~InputMethodMandoline() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Overridden from ui::InputMethod:
|
// Overridden from ui::InputMethod:
|
||||||
|
void OnFocus() override;
|
||||||
|
void OnBlur() override;
|
||||||
bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
|
bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
|
||||||
NativeEventResult* result) override;
|
NativeEventResult* result) override;
|
||||||
void DispatchKeyEvent(ui::KeyEvent* event) override;
|
void DispatchKeyEvent(ui::KeyEvent* event) override;
|
||||||
|
void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
|
||||||
void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
|
void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
|
||||||
void CancelComposition(const ui::TextInputClient* client) override;
|
void CancelComposition(const ui::TextInputClient* client) override;
|
||||||
void OnInputLocaleChanged() override;
|
void OnInputLocaleChanged() override;
|
||||||
std::string GetInputLocale() override;
|
std::string GetInputLocale() override;
|
||||||
bool IsCandidatePopupOpen() const override;
|
bool IsCandidatePopupOpen() const override;
|
||||||
|
|
||||||
|
// Overridden from ui::InputMethodBase:
|
||||||
|
void OnDidChangeFocusedClient(ui::TextInputClient* focused_before,
|
||||||
|
ui::TextInputClient* focused) override;
|
||||||
|
|
||||||
|
void UpdateTextInputType();
|
||||||
|
|
||||||
|
// The toplevel view which is not owned by this class.
|
||||||
|
mojo::View* view_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(InputMethodMandoline);
|
DISALLOW_COPY_AND_ASSIGN(InputMethodMandoline);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ WindowTreeHostMojo::WindowTreeHostMojo(mojo::Shell* shell, mojo::View* view)
|
|||||||
aura::Env::GetInstance()->set_context_factory(default_context_factory);
|
aura::Env::GetInstance()->set_context_factory(default_context_factory);
|
||||||
DCHECK_EQ(context_factory_.get(), compositor()->context_factory());
|
DCHECK_EQ(context_factory_.get(), compositor()->context_factory());
|
||||||
|
|
||||||
input_method_.reset(new InputMethodMandoline(this));
|
input_method_.reset(new InputMethodMandoline(this, view_));
|
||||||
SetSharedInputMethod(input_method_.get());
|
SetSharedInputMethod(input_method_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,6 +56,7 @@ void OmniboxImpl::OnEmbed(mojo::View* root) {
|
|||||||
aura_init_.reset(new AuraInit(root, app_impl_->shell()));
|
aura_init_.reset(new AuraInit(root, app_impl_->shell()));
|
||||||
edit_ = new views::Textfield;
|
edit_ = new views::Textfield;
|
||||||
edit_->set_controller(this);
|
edit_->set_controller(this);
|
||||||
|
edit_->SetTextInputType(ui::TEXT_INPUT_TYPE_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int kOpacity = 0xC0;
|
const int kOpacity = 0xC0;
|
||||||
|
28
mojo/converters/ime/BUILD.gn
Normal file
28
mojo/converters/ime/BUILD.gn
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Copyright 2015 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.
|
||||||
|
|
||||||
|
# This target does NOT depend on skia. One can depend on this target to avoid
|
||||||
|
# picking up a dependency on skia.
|
||||||
|
component("ime") {
|
||||||
|
output_name = "mojo_ime_lib"
|
||||||
|
|
||||||
|
public_deps = [
|
||||||
|
"//ui/base/ime",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
"//base",
|
||||||
|
"//mojo/environment:chromium",
|
||||||
|
"//third_party/mojo/src/mojo/public/c/system:for_component",
|
||||||
|
"//ui/mojo/ime:interfaces",
|
||||||
|
"//ui/platform_window",
|
||||||
|
]
|
||||||
|
|
||||||
|
defines = [ "MOJO_IME_IMPLEMENTATION" ]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"ime_type_converters.cc",
|
||||||
|
"ime_type_converters.h",
|
||||||
|
"mojo_ime_export.h",
|
||||||
|
]
|
||||||
|
}
|
6
mojo/converters/ime/DEPS
Normal file
6
mojo/converters/ime/DEPS
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
include_rules = [
|
||||||
|
"+ui/base/ime/text_input_flags.h",
|
||||||
|
"+ui/base/ime/text_input_type.h",
|
||||||
|
"+ui/mojo/ime",
|
||||||
|
"+ui/platform_window/text_input_state.h",
|
||||||
|
]
|
@@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "components/view_manager/type_converters.h"
|
#include "mojo/converters/ime/ime_type_converters.h"
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
@@ -28,24 +28,28 @@ TEXT_INPUT_TYPE_ASSERT(MONTH);
|
|||||||
TEXT_INPUT_TYPE_ASSERT(TIME);
|
TEXT_INPUT_TYPE_ASSERT(TIME);
|
||||||
TEXT_INPUT_TYPE_ASSERT(WEEK);
|
TEXT_INPUT_TYPE_ASSERT(WEEK);
|
||||||
TEXT_INPUT_TYPE_ASSERT(TEXT_AREA);
|
TEXT_INPUT_TYPE_ASSERT(TEXT_AREA);
|
||||||
TEXT_INPUT_TYPE_ASSERT(LAST);
|
|
||||||
|
|
||||||
#define TEXT_INPUT_FLAG_ASSERT(NAME) \
|
#define TEXT_INPUT_FLAG_ASSERT(NAME) \
|
||||||
COMPILE_ASSERT(static_cast<int32>(TEXT_INPUT_FLAG_##NAME) == \
|
COMPILE_ASSERT(static_cast<int32>(TEXT_INPUT_FLAG_##NAME) == \
|
||||||
static_cast<int32>(ui::TEXT_INPUT_FLAG_##NAME), \
|
static_cast<int32>(ui::TEXT_INPUT_FLAG_##NAME), \
|
||||||
text_input_flag_should_match)
|
text_input_flag_should_match)
|
||||||
TEXT_INPUT_FLAG_ASSERT(NONE);
|
TEXT_INPUT_FLAG_ASSERT(NONE);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_COMPLETE_ON);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCOMPLETE_ON);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_COMPLETE_OFF);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCOMPLETE_OFF);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CORRECT_ON);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCORRECT_ON);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CORRECT_OFF);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCORRECT_OFF);
|
||||||
TEXT_INPUT_FLAG_ASSERT(SPELL_CHECK_ON);
|
TEXT_INPUT_FLAG_ASSERT(SPELLCHECK_ON);
|
||||||
TEXT_INPUT_FLAG_ASSERT(SPELL_CHECK_OFF);
|
TEXT_INPUT_FLAG_ASSERT(SPELLCHECK_OFF);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_NONE);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_NONE);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_CHARACTERS);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_CHARACTERS);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_WORDS);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_WORDS);
|
||||||
TEXT_INPUT_FLAG_ASSERT(AUTO_CAPITALIZE_SENTENCES);
|
TEXT_INPUT_FLAG_ASSERT(AUTOCAPITALIZE_SENTENCES);
|
||||||
TEXT_INPUT_FLAG_ASSERT(ALL);
|
|
||||||
|
// static
|
||||||
|
TextInputType TypeConverter<TextInputType, ui::TextInputType>::Convert(
|
||||||
|
const ui::TextInputType& input) {
|
||||||
|
return static_cast<TextInputType>(input);
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
ui::TextInputType TypeConverter<ui::TextInputType, TextInputType>::Convert(
|
ui::TextInputType TypeConverter<ui::TextInputType, TextInputType>::Convert(
|
31
mojo/converters/ime/ime_type_converters.h
Normal file
31
mojo/converters/ime/ime_type_converters.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// Copyright 2015 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 MOJO_CONVERTERS_IME_IME_TYPE_CONVERTERS_H_
|
||||||
|
#define MOJO_CONVERTERS_IME_IME_TYPE_CONVERTERS_H_
|
||||||
|
|
||||||
|
#include "mojo/converters/ime/mojo_ime_export.h"
|
||||||
|
#include "ui/mojo/ime/text_input_state.mojom.h"
|
||||||
|
#include "ui/platform_window/text_input_state.h"
|
||||||
|
|
||||||
|
namespace mojo {
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct MOJO_IME_EXPORT TypeConverter<TextInputType, ui::TextInputType> {
|
||||||
|
static TextInputType Convert(const ui::TextInputType& input);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct MOJO_IME_EXPORT TypeConverter<ui::TextInputType, TextInputType> {
|
||||||
|
static ui::TextInputType Convert(const TextInputType& input);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct MOJO_IME_EXPORT TypeConverter<ui::TextInputState, TextInputStatePtr> {
|
||||||
|
static ui::TextInputState Convert(const TextInputStatePtr& input);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace mojo
|
||||||
|
|
||||||
|
#endif // MOJO_CONVERTERS_IME_IME_TYPE_CONVERTERS_H_
|
32
mojo/converters/ime/mojo_ime_export.h
Normal file
32
mojo/converters/ime/mojo_ime_export.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2015 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 MOJO_CONVERTERS_IME_MOJO_IME_EXPORT_H_
|
||||||
|
#define MOJO_CONVERTERS_IME_MOJO_IME_EXPORT_H_
|
||||||
|
|
||||||
|
#if defined(COMPONENT_BUILD)
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
|
||||||
|
#if defined(MOJO_IME_IMPLEMENTATION)
|
||||||
|
#define MOJO_IME_EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define MOJO_IME_EXPORT __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else // !defined(WIN32)
|
||||||
|
|
||||||
|
#if defined(MOJO_IME_IMPLEMENTATION)
|
||||||
|
#define MOJO_IME_EXPORT __attribute__((visibility("default")))
|
||||||
|
#else
|
||||||
|
#define MOJO_IME_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // defined(WIN32)
|
||||||
|
|
||||||
|
#else // !defined(COMPONENT_BUILD)
|
||||||
|
#define MOJO_IME_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // MOJO_CONVERTERS_IME_MOJO_IME_EXPORT_H_
|
@@ -27,16 +27,16 @@ enum TextInputType {
|
|||||||
// Text input flag which is based on blink::WebTextInputFlags.
|
// Text input flag which is based on blink::WebTextInputFlags.
|
||||||
enum TextInputFlag {
|
enum TextInputFlag {
|
||||||
NONE,
|
NONE,
|
||||||
AUTO_COMPLETE_ON = 0x001,
|
AUTOCOMPLETE_ON = 0x001,
|
||||||
AUTO_COMPLETE_OFF = 0x002,
|
AUTOCOMPLETE_OFF = 0x002,
|
||||||
AUTO_CORRECT_ON = 0x004,
|
AUTOCORRECT_ON = 0x004,
|
||||||
AUTO_CORRECT_OFF = 0x008,
|
AUTOCORRECT_OFF = 0x008,
|
||||||
SPELL_CHECK_ON = 0x010,
|
SPELLCHECK_ON = 0x010,
|
||||||
SPELL_CHECK_OFF = 0x020,
|
SPELLCHECK_OFF = 0x020,
|
||||||
AUTO_CAPITALIZE_NONE = 0x040,
|
AUTOCAPITALIZE_NONE = 0x040,
|
||||||
AUTO_CAPITALIZE_CHARACTERS = 0x080,
|
AUTOCAPITALIZE_CHARACTERS = 0x080,
|
||||||
AUTO_CAPITALIZE_WORDS = 0x100,
|
AUTOCAPITALIZE_WORDS = 0x100,
|
||||||
AUTO_CAPITALIZE_SENTENCES = 0x200,
|
AUTOCAPITALIZE_SENTENCES = 0x200,
|
||||||
ALL = 0x3FF,
|
ALL = 0x3FF,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ struct TextInputState {
|
|||||||
int32 flags;
|
int32 flags;
|
||||||
|
|
||||||
// The value of the input field.
|
// The value of the input field.
|
||||||
string text;
|
string? text;
|
||||||
|
|
||||||
// The cursor position of the current selection start, or the caret position
|
// The cursor position of the current selection start, or the caret position
|
||||||
// if nothing is selected.
|
// if nothing is selected.
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
include_rules = [
|
include_rules = [
|
||||||
"+ui/base/cursor",
|
"+ui/base/cursor",
|
||||||
|
"+ui/base/ime",
|
||||||
"+ui/gfx",
|
"+ui/gfx",
|
||||||
]
|
]
|
||||||
|
@@ -7,44 +7,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "ui/base/ime/text_input_flags.h"
|
||||||
|
#include "ui/base/ime/text_input_type.h"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
// Text input type which is based on blink::WebTextInputType.
|
|
||||||
enum TextInputType {
|
|
||||||
TEXT_INPUT_TYPE_NONE,
|
|
||||||
TEXT_INPUT_TYPE_TEXT,
|
|
||||||
TEXT_INPUT_TYPE_PASSWORD,
|
|
||||||
TEXT_INPUT_TYPE_SEARCH,
|
|
||||||
TEXT_INPUT_TYPE_EMAIL,
|
|
||||||
TEXT_INPUT_TYPE_NUMBER,
|
|
||||||
TEXT_INPUT_TYPE_TELEPHONE,
|
|
||||||
TEXT_INPUT_TYPE_URL,
|
|
||||||
TEXT_INPUT_TYPE_DATE,
|
|
||||||
TEXT_INPUT_TYPE_DATE_TIME,
|
|
||||||
TEXT_INPUT_TYPE_DATE_TIME_LOCAL,
|
|
||||||
TEXT_INPUT_TYPE_MONTH,
|
|
||||||
TEXT_INPUT_TYPE_TIME,
|
|
||||||
TEXT_INPUT_TYPE_WEEK,
|
|
||||||
TEXT_INPUT_TYPE_TEXT_AREA,
|
|
||||||
TEXT_INPUT_TYPE_LAST = TEXT_INPUT_TYPE_TEXT_AREA,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Text input flag which is based on blink::WebTextInputFlags.
|
|
||||||
enum TextInputFlag {
|
|
||||||
TEXT_INPUT_FLAG_NONE,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_COMPLETE_ON = 1 << 0,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_COMPLETE_OFF = 1 << 1,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_CORRECT_ON = 1 << 2,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_CORRECT_OFF = 1 << 3,
|
|
||||||
TEXT_INPUT_FLAG_SPELL_CHECK_ON = 1 << 4,
|
|
||||||
TEXT_INPUT_FLAG_SPELL_CHECK_OFF = 1 << 5,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_CAPITALIZE_NONE = 1 << 6,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_CAPITALIZE_CHARACTERS = 1 << 7,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_CAPITALIZE_WORDS = 1 << 8,
|
|
||||||
TEXT_INPUT_FLAG_AUTO_CAPITALIZE_SENTENCES = 1 << 9,
|
|
||||||
TEXT_INPUT_FLAG_ALL = (TEXT_INPUT_FLAG_AUTO_CAPITALIZE_SENTENCES << 1) - 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Text input info which is based on blink::WebTextInputInfo.
|
// Text input info which is based on blink::WebTextInputInfo.
|
||||||
struct TextInputState {
|
struct TextInputState {
|
||||||
TextInputState();
|
TextInputState();
|
||||||
|
Reference in New Issue
Block a user