diff options
author | ben <ben@chromium.org> | 2015-10-09 17:45:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-10 00:45:50 +0000 |
commit | 974286a2cb68813b64c27c0fcd99cdfd899a007a (patch) | |
tree | a7d987599a5551deb75d0bef9877712e3e47db2f /ui/keyboard/keyboard_controller_proxy.h | |
parent | 77970f1c3cd71d535a248d6e15f14081312b300a (diff) | |
download | chromium_src-974286a2cb68813b64c27c0fcd99cdfd899a007a.zip chromium_src-974286a2cb68813b64c27c0fcd99cdfd899a007a.tar.gz chromium_src-974286a2cb68813b64c27c0fcd99cdfd899a007a.tar.bz2 |
Extract content dependency from keyboard code
Move content specific stuff to content subdir.
KeyboardControllerProxy -> KeyboardUI
Restructure targets.
R=sky@chromium.org
http://crbug.com/332504
Review URL: https://codereview.chromium.org/1392713002
Cr-Commit-Position: refs/heads/master@{#353441}
Diffstat (limited to 'ui/keyboard/keyboard_controller_proxy.h')
-rw-r--r-- | ui/keyboard/keyboard_controller_proxy.h | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/ui/keyboard/keyboard_controller_proxy.h b/ui/keyboard/keyboard_controller_proxy.h deleted file mode 100644 index 98051fa..0000000 --- a/ui/keyboard/keyboard_controller_proxy.h +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2013 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 UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ -#define UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ - -#include "base/memory/scoped_ptr.h" -#include "content/public/common/media_stream_request.h" -#include "ui/aura/window_observer.h" -#include "ui/base/ime/text_input_type.h" -#include "ui/keyboard/keyboard_export.h" - -namespace aura { -class Window; -} -namespace content { -class BrowserContext; -class SiteInstance; -class WebContents; -} -namespace gfx { -class Rect; -} -namespace ui { -class InputMethod; -} -namespace wm { -class Shadow; -} - -namespace keyboard { - -class KeyboardController; - -// A proxy used by the KeyboardController to get access to the virtual -// keyboard window. -class KEYBOARD_EXPORT KeyboardControllerProxy : public aura::WindowObserver { - public: - class TestApi { - public: - explicit TestApi(KeyboardControllerProxy* proxy) : proxy_(proxy) {} - - const content::WebContents* keyboard_contents() { - return proxy_->keyboard_contents_.get(); - } - - private: - KeyboardControllerProxy* proxy_; - - DISALLOW_COPY_AND_ASSIGN(TestApi); - }; - - explicit KeyboardControllerProxy(content::BrowserContext* context); - ~KeyboardControllerProxy() override; - - // Gets the virtual keyboard window. Ownership of the returned Window remains - // with the proxy. - virtual aura::Window* GetKeyboardWindow(); - - // Whether the keyboard window is created. The keyboard window is tied to a - // WebContent so we can just check if the WebContent is created or not. - virtual bool HasKeyboardWindow() const; - - // Gets the InputMethod that will provide notifications about changes in the - // text input context. - virtual ui::InputMethod* GetInputMethod() = 0; - - // Requests the audio input from microphone for speech input. - virtual void RequestAudioInput(content::WebContents* web_contents, - const content::MediaStreamRequest& request, - const content::MediaResponseCallback& callback) = 0; - - // Shows the container window of the keyboard. The default implementation - // simply shows the container. An overridden implementation can set up - // necessary animation, or delay the visibility change as it desires. - virtual void ShowKeyboardContainer(aura::Window* container); - - // Hides the container window of the keyboard. The default implementation - // simply hides the container. An overridden implementation can set up - // necesasry animation, or delay the visibility change as it desires. - virtual void HideKeyboardContainer(aura::Window* container); - - // Updates the type of the focused text input box. - virtual void SetUpdateInputType(ui::TextInputType type); - - // Ensures caret in current work area (not occluded by virtual keyboard - // window). - virtual void EnsureCaretInWorkArea(); - - // Loads system virtual keyboard. Noop if the current virtual keyboard is - // system virtual keyboard. - virtual void LoadSystemKeyboard(); - - // Reloads virtual keyboard URL if the current keyboard's web content URL is - // different. The URL can be different if user switch from password field to - // any other type input field. - // At password field, the system virtual keyboard is forced to load even if - // the current IME provides a customized virtual keyboard. This is needed to - // prevent IME virtual keyboard logging user's password. Once user switch to - // other input fields, the virtual keyboard should switch back to the IME - // provided keyboard, or keep using the system virtual keyboard if IME doesn't - // provide one. - virtual void ReloadKeyboardIfNeeded(); - - // KeyboardController owns KeyboardControllerProxy so KeyboardControllerProxy - // or its subclasses should not take ownership of the |controller|. - // |controller| can be null when KeyboardController is destroying. - virtual void SetController(KeyboardController* controller); - - protected: - // The implementation can choose to setup the WebContents before the virtual - // keyboard page is loaded (e.g. install a WebContentsObserver). - // SetupWebContents() is called right after creating the WebContents, before - // loading the keyboard page. - virtual void SetupWebContents(content::WebContents* contents); - - // aura::WindowObserver overrides: - void OnWindowBoundsChanged(aura::Window* window, - const gfx::Rect& old_bounds, - const gfx::Rect& new_bounds) override; - void OnWindowDestroyed(aura::Window* window) override; - - content::BrowserContext* browser_context() { return browser_context_; } - KeyboardController* keyboard_controller() { return keyboard_controller_; } - - private: - friend class TestApi; - - // Loads the web contents for the given |url|. - void LoadContents(const GURL& url); - - // Gets the virtual keyboard URL (either the default URL or IME override URL). - const GURL& GetVirtualKeyboardUrl(); - - // The BrowserContext to use for creating the WebContents hosting the - // keyboard. - content::BrowserContext* browser_context_; - - const GURL default_url_; - keyboard::KeyboardController* keyboard_controller_; - - scoped_ptr<content::WebContents> keyboard_contents_; - scoped_ptr<wm::Shadow> shadow_; - - DISALLOW_COPY_AND_ASSIGN(KeyboardControllerProxy); -}; - -} // namespace keyboard - -#endif // UI_KEYBOARD_KEYBOARD_CONTROLLER_PROXY_H_ |