summaryrefslogtreecommitdiffstats
path: root/ui/keyboard
diff options
context:
space:
mode:
Diffstat (limited to 'ui/keyboard')
-rw-r--r--ui/keyboard/keyboard_controller.cc57
-rw-r--r--ui/keyboard/keyboard_controller_proxy.cc18
-rw-r--r--ui/keyboard/keyboard_controller_proxy.h10
-rw-r--r--ui/keyboard/keyboard_controller_unittest.cc54
-rw-r--r--ui/keyboard/keyboard_layout_manager.h16
-rw-r--r--ui/keyboard/test/run_all_unittests.cc4
-rw-r--r--ui/keyboard/webui/vk_mojo_handler.h33
-rw-r--r--ui/keyboard/webui/vk_webui_controller.h19
8 files changed, 99 insertions, 112 deletions
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 396ac49..4fdf8f0 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -57,12 +57,11 @@ class KeyboardContainerTargeter : public wm::MaskedWindowTargeter {
proxy_(proxy) {
}
- virtual ~KeyboardContainerTargeter() {}
+ ~KeyboardContainerTargeter() override {}
private:
// wm::MaskedWindowTargeter:
- virtual bool GetHitTestMask(aura::Window* window,
- gfx::Path* mask) const override {
+ bool GetHitTestMask(aura::Window* window, gfx::Path* mask) const override {
if (proxy_ && !proxy_->HasKeyboardWindow())
return true;
gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() :
@@ -84,38 +83,38 @@ class KeyboardWindowDelegate : public aura::WindowDelegate {
public:
explicit KeyboardWindowDelegate(keyboard::KeyboardControllerProxy* proxy)
: proxy_(proxy) {}
- virtual ~KeyboardWindowDelegate() {}
+ ~KeyboardWindowDelegate() override {}
private:
// Overridden from aura::WindowDelegate:
- virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); }
- virtual gfx::Size GetMaximumSize() const override { return gfx::Size(); }
- virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override {
+ gfx::Size GetMinimumSize() const override { return gfx::Size(); }
+ gfx::Size GetMaximumSize() const override { return gfx::Size(); }
+ void OnBoundsChanged(const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override {
bounds_ = new_bounds;
}
- virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override {
+ gfx::NativeCursor GetCursor(const gfx::Point& point) override {
return gfx::kNullCursor;
}
- virtual int GetNonClientComponent(const gfx::Point& point) const override {
+ int GetNonClientComponent(const gfx::Point& point) const override {
return HTNOWHERE;
}
- virtual bool ShouldDescendIntoChildForEventHandling(
+ bool ShouldDescendIntoChildForEventHandling(
aura::Window* child,
const gfx::Point& location) override {
return true;
}
- virtual bool CanFocus() override { return false; }
- virtual void OnCaptureLost() override {}
- virtual void OnPaint(gfx::Canvas* canvas) override {}
- virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override {}
- virtual void OnWindowDestroying(aura::Window* window) override {}
- virtual void OnWindowDestroyed(aura::Window* window) override { delete this; }
- virtual void OnWindowTargetVisibilityChanged(bool visible) override {}
- virtual bool HasHitTestMask() const override {
+ bool CanFocus() override { return false; }
+ void OnCaptureLost() override {}
+ void OnPaint(gfx::Canvas* canvas) override {}
+ void OnDeviceScaleFactorChanged(float device_scale_factor) override {}
+ void OnWindowDestroying(aura::Window* window) override {}
+ void OnWindowDestroyed(aura::Window* window) override { delete this; }
+ void OnWindowTargetVisibilityChanged(bool visible) override {}
+ bool HasHitTestMask() const override {
return !proxy_ || proxy_->HasKeyboardWindow();
}
- virtual void GetHitTestMask(gfx::Path* mask) const override {
+ void GetHitTestMask(gfx::Path* mask) const override {
if (proxy_ && !proxy_->HasKeyboardWindow())
return;
gfx::Rect keyboard_bounds = proxy_ ? proxy_->GetKeyboardWindow()->bounds() :
@@ -167,15 +166,13 @@ class CallbackAnimationObserver : public ui::LayerAnimationObserver {
public:
CallbackAnimationObserver(ui::LayerAnimator* animator,
base::Callback<void(void)> callback);
- virtual ~CallbackAnimationObserver();
+ ~CallbackAnimationObserver() override;
private:
// Overridden from ui::LayerAnimationObserver:
- virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override;
- virtual void OnLayerAnimationAborted(
- ui::LayerAnimationSequence* seq) override;
- virtual void OnLayerAnimationScheduled(
- ui::LayerAnimationSequence* seq) override {}
+ void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override;
+ void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override;
+ void OnLayerAnimationScheduled(ui::LayerAnimationSequence* seq) override {}
ui::LayerAnimator* animator_;
base::Callback<void(void)> callback_;
@@ -207,10 +204,10 @@ void CallbackAnimationObserver::OnLayerAnimationAborted(
class WindowBoundsChangeObserver : public aura::WindowObserver {
public:
- virtual void OnWindowBoundsChanged(aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override;
- virtual void OnWindowDestroyed(aura::Window* window) override;
+ void OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override;
+ void OnWindowDestroyed(aura::Window* window) override;
void AddObservedWindow(aura::Window* window);
void RemoveAllObservedWindows();
diff --git a/ui/keyboard/keyboard_controller_proxy.cc b/ui/keyboard/keyboard_controller_proxy.cc
index 37f655d..6a28869 100644
--- a/ui/keyboard/keyboard_controller_proxy.cc
+++ b/ui/keyboard/keyboard_controller_proxy.cc
@@ -31,11 +31,11 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate,
public:
KeyboardContentsDelegate(keyboard::KeyboardControllerProxy* proxy)
: proxy_(proxy) {}
- virtual ~KeyboardContentsDelegate() {}
+ ~KeyboardContentsDelegate() override {}
private:
// Overridden from content::WebContentsDelegate:
- virtual content::WebContents* OpenURLFromTab(
+ content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override {
source->GetController().LoadURL(
@@ -44,13 +44,12 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate,
return source;
}
- virtual bool IsPopupOrPanel(
- const content::WebContents* source) const override {
+ bool IsPopupOrPanel(const content::WebContents* source) const override {
return true;
}
- virtual void MoveContents(content::WebContents* source,
- const gfx::Rect& pos) override {
+ void MoveContents(content::WebContents* source,
+ const gfx::Rect& pos) override {
aura::Window* keyboard = proxy_->GetKeyboardWindow();
// keyboard window must have been added to keyboard container window at this
// point. Otherwise, wrong keyboard bounds is used and may cause problem as
@@ -68,16 +67,15 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate,
}
// Overridden from content::WebContentsDelegate:
- virtual void RequestMediaAccessPermission(content::WebContents* web_contents,
+ void RequestMediaAccessPermission(
+ content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override {
proxy_->RequestAudioInput(web_contents, request, callback);
}
// Overridden from content::WebContentsObserver:
- virtual void WebContentsDestroyed() override {
- delete this;
- }
+ void WebContentsDestroyed() override { delete this; }
keyboard::KeyboardControllerProxy* proxy_;
diff --git a/ui/keyboard/keyboard_controller_proxy.h b/ui/keyboard/keyboard_controller_proxy.h
index f893eea..86d95b4 100644
--- a/ui/keyboard/keyboard_controller_proxy.h
+++ b/ui/keyboard/keyboard_controller_proxy.h
@@ -50,7 +50,7 @@ class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver {
};
KeyboardControllerProxy();
- virtual ~KeyboardControllerProxy();
+ ~KeyboardControllerProxy() override;
// Gets the virtual keyboard window. Ownership of the returned Window remains
// with the proxy.
@@ -113,10 +113,10 @@ class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver {
virtual void SetupWebContents(content::WebContents* contents);
// aura::WindowObserver overrides:
- virtual void OnWindowBoundsChanged(aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override;
- virtual void OnWindowDestroyed(aura::Window* window) override;
+ void OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override;
+ void OnWindowDestroyed(aura::Window* window) override;
private:
friend class TestApi;
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc
index 9c3ccb6..b2db69c 100644
--- a/ui/keyboard/keyboard_controller_unittest.cc
+++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -62,13 +62,11 @@ class TestFocusController : public ui::EventHandler {
root_->AddPreTargetHandler(this);
}
- virtual ~TestFocusController() {
- root_->RemovePreTargetHandler(this);
- }
+ ~TestFocusController() override { root_->RemovePreTargetHandler(this); }
private:
// Overridden from ui::EventHandler:
- virtual void OnEvent(ui::Event* event) override {
+ void OnEvent(ui::Event* event) override {
aura::Window* target = static_cast<aura::Window*>(event->target());
if (event->type() == ui::ET_MOUSE_PRESSED ||
event->type() == ui::ET_TOUCH_PRESSED) {
@@ -86,14 +84,14 @@ class TestKeyboardControllerProxy : public KeyboardControllerProxy {
: input_method_(
ui::CreateInputMethod(NULL, gfx::kNullAcceleratedWidget)) {}
- virtual ~TestKeyboardControllerProxy() {
+ ~TestKeyboardControllerProxy() override {
// Destroy the window before the delegate.
window_.reset();
}
// Overridden from KeyboardControllerProxy:
- virtual bool HasKeyboardWindow() const override { return window_; }
- virtual aura::Window* GetKeyboardWindow() override {
+ bool HasKeyboardWindow() const override { return window_; }
+ aura::Window* GetKeyboardWindow() override {
if (!window_) {
window_.reset(new aura::Window(&delegate_));
window_->Init(aura::WINDOW_LAYER_NOT_DRAWN);
@@ -101,15 +99,16 @@ class TestKeyboardControllerProxy : public KeyboardControllerProxy {
}
return window_.get();
}
- virtual content::BrowserContext* GetBrowserContext() override { return NULL; }
- virtual ui::InputMethod* GetInputMethod() override {
- return input_method_.get();
- }
- virtual void RequestAudioInput(content::WebContents* web_contents,
+ content::BrowserContext* GetBrowserContext() override { return NULL; }
+ ui::InputMethod* GetInputMethod() override { return input_method_.get(); }
+ void RequestAudioInput(
+ content::WebContents* web_contents,
const content::MediaStreamRequest& request,
- const content::MediaResponseCallback& callback) override { return; }
- virtual void LoadSystemKeyboard() override {};
- virtual void ReloadKeyboardIfNeeded() override {};
+ const content::MediaResponseCallback& callback) override {
+ return;
+ }
+ void LoadSystemKeyboard() override{};
+ void ReloadKeyboardIfNeeded() override{};
private:
scoped_ptr<aura::Window> window_;
@@ -123,7 +122,7 @@ class TestKeyboardControllerProxy : public KeyboardControllerProxy {
class EventObserver : public ui::EventHandler {
public:
EventObserver() {}
- virtual ~EventObserver() {}
+ ~EventObserver() override {}
int GetEventCount(ui::EventType type) {
return event_counts_[type];
@@ -131,7 +130,7 @@ class EventObserver : public ui::EventHandler {
private:
// Overridden from ui::EventHandler:
- virtual void OnEvent(ui::Event* event) override {
+ void OnEvent(ui::Event* event) override {
ui::EventHandler::OnEvent(event);
event_counts_[event->type()]++;
}
@@ -145,13 +144,10 @@ class KeyboardContainerObserver : public aura::WindowObserver {
explicit KeyboardContainerObserver(aura::Window* window) : window_(window) {
window_->AddObserver(this);
}
- virtual ~KeyboardContainerObserver() {
- window_->RemoveObserver(this);
- }
+ ~KeyboardContainerObserver() override { window_->RemoveObserver(this); }
private:
- virtual void OnWindowVisibilityChanged(aura::Window* window,
- bool visible) override {
+ void OnWindowVisibilityChanged(aura::Window* window, bool visible) override {
if (!visible)
base::MessageLoop::current()->Quit();
}
@@ -166,9 +162,9 @@ class KeyboardContainerObserver : public aura::WindowObserver {
class KeyboardControllerTest : public testing::Test {
public:
KeyboardControllerTest() {}
- virtual ~KeyboardControllerTest() {}
+ ~KeyboardControllerTest() override {}
- virtual void SetUp() override {
+ void SetUp() override {
// The ContextFactory must exist before any Compositors are created.
bool enable_pixel_output = false;
ui::ContextFactory* context_factory =
@@ -185,7 +181,7 @@ class KeyboardControllerTest : public testing::Test {
controller_.reset(new KeyboardController(proxy_));
}
- virtual void TearDown() override {
+ void TearDown() override {
controller_.reset();
focus_controller_.reset();
if (::switches::IsTextInputFocusManagerEnabled())
@@ -497,9 +493,9 @@ class KeyboardControllerAnimationTest : public KeyboardControllerTest,
public KeyboardControllerObserver {
public:
KeyboardControllerAnimationTest() {}
- virtual ~KeyboardControllerAnimationTest() {}
+ ~KeyboardControllerAnimationTest() override {}
- virtual void SetUp() override {
+ void SetUp() override {
// We cannot short-circuit animations for this test.
ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
@@ -512,14 +508,14 @@ class KeyboardControllerAnimationTest : public KeyboardControllerTest,
controller()->AddObserver(this);
}
- virtual void TearDown() override {
+ void TearDown() override {
controller()->RemoveObserver(this);
KeyboardControllerTest::TearDown();
}
protected:
// KeyboardControllerObserver overrides
- virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override {
+ void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override {
notified_bounds_ = new_bounds;
}
diff --git a/ui/keyboard/keyboard_layout_manager.h b/ui/keyboard/keyboard_layout_manager.h
index b93665f..1500d51 100644
--- a/ui/keyboard/keyboard_layout_manager.h
+++ b/ui/keyboard/keyboard_layout_manager.h
@@ -22,14 +22,14 @@ class KeyboardLayoutManager : public aura::LayoutManager {
}
// Overridden from aura::LayoutManager
- virtual void OnWindowResized() override;
- virtual void OnWindowAddedToLayout(aura::Window* child) override;
- virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {}
- virtual void OnWindowRemovedFromLayout(aura::Window* child) override {}
- virtual void OnChildWindowVisibilityChanged(aura::Window* child,
- bool visible) override {}
- virtual void SetChildBounds(aura::Window* child,
- const gfx::Rect& requested_bounds) override;
+ void OnWindowResized() override;
+ void OnWindowAddedToLayout(aura::Window* child) override;
+ void OnWillRemoveWindowFromLayout(aura::Window* child) override {}
+ void OnWindowRemovedFromLayout(aura::Window* child) override {}
+ void OnChildWindowVisibilityChanged(aura::Window* child,
+ bool visible) override {}
+ void SetChildBounds(aura::Window* child,
+ const gfx::Rect& requested_bounds) override;
private:
KeyboardController* controller_;
diff --git a/ui/keyboard/test/run_all_unittests.cc b/ui/keyboard/test/run_all_unittests.cc
index 519f69f..c81e199 100644
--- a/ui/keyboard/test/run_all_unittests.cc
+++ b/ui/keyboard/test/run_all_unittests.cc
@@ -20,7 +20,7 @@ class KeyboardTestSuite : public base::TestSuite {
KeyboardTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
protected:
- virtual void Initialize() override {
+ void Initialize() override {
base::TestSuite::Initialize();
gfx::GLSurface::InitializeOneOffForTests();
ui::RegisterPathProvider();
@@ -30,7 +30,7 @@ class KeyboardTestSuite : public base::TestSuite {
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
}
- virtual void Shutdown() override {
+ void Shutdown() override {
ui::ResourceBundle::CleanupSharedInstance();
base::TestSuite::Shutdown();
}
diff --git a/ui/keyboard/webui/vk_mojo_handler.h b/ui/keyboard/webui/vk_mojo_handler.h
index a7985db..5a25abd 100644
--- a/ui/keyboard/webui/vk_mojo_handler.h
+++ b/ui/keyboard/webui/vk_mojo_handler.h
@@ -15,33 +15,30 @@ class VKMojoHandler : public mojo::InterfaceImpl<KeyboardUIHandlerMojo>,
public ui::InputMethodObserver {
public:
VKMojoHandler();
- virtual ~VKMojoHandler();
+ ~VKMojoHandler() override;
private:
ui::InputMethod* GetInputMethod();
// mojo::InterfaceImpl<>:
- virtual void OnConnectionEstablished() override;
+ void OnConnectionEstablished() override;
// KeyboardUIHandlerMojo:
- virtual void SendKeyEvent(const mojo::String& event_type,
- int32_t char_value,
- int32_t key_code,
- const mojo::String& key_name,
- int32_t modifiers) override;
- virtual void HideKeyboard() override;
+ void SendKeyEvent(const mojo::String& event_type,
+ int32_t char_value,
+ int32_t key_code,
+ const mojo::String& key_name,
+ int32_t modifiers) override;
+ void HideKeyboard() override;
// ui::InputMethodObserver:
- virtual void OnTextInputTypeChanged(
- const ui::TextInputClient* client) override;
- virtual void OnFocus() override;
- virtual void OnBlur() override;
- virtual void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
- virtual void OnTextInputStateChanged(
- const ui::TextInputClient* text_client) override;
- virtual void OnInputMethodDestroyed(
- const ui::InputMethod* input_method) override;
- virtual void OnShowImeIfNeeded() override;
+ void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
+ void OnFocus() override;
+ void OnBlur() override;
+ void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
+ void OnTextInputStateChanged(const ui::TextInputClient* text_client) override;
+ void OnInputMethodDestroyed(const ui::InputMethod* input_method) override;
+ void OnShowImeIfNeeded() override;
DISALLOW_COPY_AND_ASSIGN(VKMojoHandler);
};
diff --git a/ui/keyboard/webui/vk_webui_controller.h b/ui/keyboard/webui/vk_webui_controller.h
index 97ee5a56..30d1e25 100644
--- a/ui/keyboard/webui/vk_webui_controller.h
+++ b/ui/keyboard/webui/vk_webui_controller.h
@@ -26,14 +26,14 @@ class VKMojoHandler;
class VKWebUIController : public content::WebUIController {
public:
explicit VKWebUIController(content::WebUI* web_ui);
- virtual ~VKWebUIController();
+ ~VKWebUIController() override;
private:
void CreateAndStoreUIHandler(
mojo::InterfaceRequest<KeyboardUIHandlerMojo> request);
// content::WebUIController:
- virtual void RenderViewCreated(content::RenderViewHost* host) override;
+ void RenderViewCreated(content::RenderViewHost* host) override;
scoped_ptr<VKMojoHandler> ui_handler_;
base::WeakPtrFactory<VKWebUIController> weak_factory_;
@@ -45,14 +45,13 @@ class KEYBOARD_EXPORT VKWebUIControllerFactory
: public content::WebUIControllerFactory {
public:
// WebUIControllerFactory:
- virtual content::WebUI::TypeID GetWebUIType(
- content::BrowserContext* browser_context,
- const GURL& url) const override;
- virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
- const GURL& url) const override;
- virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
+ content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
const GURL& url) const override;
- virtual content::WebUIController* CreateWebUIControllerForURL(
+ bool UseWebUIForURL(content::BrowserContext* browser_context,
+ const GURL& url) const override;
+ bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
+ const GURL& url) const override;
+ content::WebUIController* CreateWebUIControllerForURL(
content::WebUI* web_ui,
const GURL& url) const override;
@@ -60,7 +59,7 @@ class KEYBOARD_EXPORT VKWebUIControllerFactory
protected:
VKWebUIControllerFactory();
- virtual ~VKWebUIControllerFactory();
+ ~VKWebUIControllerFactory() override;
private:
friend struct DefaultSingletonTraits<VKWebUIControllerFactory>;