summaryrefslogtreecommitdiffstats
path: root/ui/keyboard/keyboard_controller_proxy.cc
diff options
context:
space:
mode:
authorshuchen@chromium.org <shuchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-29 03:31:09 +0000
committershuchen@chromium.org <shuchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-29 03:31:09 +0000
commit112f658dd4ee5ead677ab818fe4efe14ac8d501e (patch)
treed8a2364dcd6753e72adf3397e648b95b76b4da89 /ui/keyboard/keyboard_controller_proxy.cc
parentb520e13a9cddc9089d5ff0bf1c168a0abb6b7ec9 (diff)
downloadchromium_src-112f658dd4ee5ead677ab818fe4efe14ac8d501e.zip
chromium_src-112f658dd4ee5ead677ab818fe4efe14ac8d501e.tar.gz
chromium_src-112f658dd4ee5ead677ab818fe4efe14ac8d501e.tar.bz2
[IME API] Implement input view which reuses virtual keyboard window.
BUG=chromium:316524 TEST=Locally verified on sandbox of ChromeOS on Linux. Review URL: https://codereview.chromium.org/91443002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237868 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/keyboard/keyboard_controller_proxy.cc')
-rw-r--r--ui/keyboard/keyboard_controller_proxy.cc38
1 files changed, 28 insertions, 10 deletions
diff --git a/ui/keyboard/keyboard_controller_proxy.cc b/ui/keyboard/keyboard_controller_proxy.cc
index 1cfb99d..2d1bb4b 100644
--- a/ui/keyboard/keyboard_controller_proxy.cc
+++ b/ui/keyboard/keyboard_controller_proxy.cc
@@ -93,28 +93,46 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate,
namespace keyboard {
-KeyboardControllerProxy::KeyboardControllerProxy() {
+KeyboardControllerProxy::KeyboardControllerProxy()
+ : default_url_(kKeyboardWebUIURL) {
}
KeyboardControllerProxy::~KeyboardControllerProxy() {
}
+const GURL& KeyboardControllerProxy::GetValidUrl() {
+ return override_url_.is_valid() ? override_url_ : default_url_;
+}
+
+void KeyboardControllerProxy::SetOverrideContentUrl(const GURL& url) {
+ if (override_url_ == url)
+ return;
+ override_url_ = url;
+
+ ReloadContents();
+}
+
+void KeyboardControllerProxy::ReloadContents() {
+ if (keyboard_contents_) {
+ content::OpenURLParams params(
+ GetValidUrl(),
+ content::Referrer(),
+ SINGLETON_TAB,
+ content::PAGE_TRANSITION_AUTO_TOPLEVEL,
+ false);
+ keyboard_contents_->OpenURL(params);
+ }
+}
+
aura::Window* KeyboardControllerProxy::GetKeyboardWindow() {
if (!keyboard_contents_) {
content::BrowserContext* context = GetBrowserContext();
- GURL url(kKeyboardWebUIURL);
keyboard_contents_.reset(content::WebContents::Create(
content::WebContents::CreateParams(context,
- content::SiteInstance::CreateForURL(context, url))));
+ content::SiteInstance::CreateForURL(context, GetValidUrl()))));
keyboard_contents_->SetDelegate(new KeyboardContentsDelegate(this));
SetupWebContents(keyboard_contents_.get());
-
- content::OpenURLParams params(url,
- content::Referrer(),
- SINGLETON_TAB,
- content::PAGE_TRANSITION_AUTO_TOPLEVEL,
- false);
- keyboard_contents_->OpenURL(params);
+ ReloadContents();
}
return keyboard_contents_->GetView()->GetNativeView();