Chromium Code Reviews

Unified Diff: chrome/browser/ui/touch/frame/keyboard_container_view.cc

Issue 6020013: Wrap the virtual keyboard in a container view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lint Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: chrome/browser/ui/touch/frame/keyboard_container_view.cc
diff --git a/chrome/browser/ui/touch/frame/keyboard_container_view.cc b/chrome/browser/ui/touch/frame/keyboard_container_view.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b071eb824cc12030caf870b081449666ba0c9535
--- /dev/null
+++ b/chrome/browser/ui/touch/frame/keyboard_container_view.cc
@@ -0,0 +1,49 @@
+// 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.
+
+#include "chrome/browser/ui/touch/frame/keyboard_container_view.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/renderer_host/site_instance.h"
+#include "chrome/browser/ui/views/dom_view.h"
+#include "chrome/common/url_constants.h"
+
+namespace {
+
+// Make the provided view and all of its descendents unfocusable.
+void MakeViewHierarchyUnfocusable(views::View* view) {
+ view->SetFocusable(false);
+ for (int i = 0; i < view->GetChildViewCount(); ++i) {
+ MakeViewHierarchyUnfocusable(view->GetChildViewAt(i));
+ }
+}
+
+} // namepsace
+
+///////////////////////////////////////////////////////////////////////////////
+// KeyboardContainerView, public:
+
+KeyboardContainerView::KeyboardContainerView(Profile* profile)
+ : dom_view_(new DOMView) {
+ GURL keyboard_url(chrome::kChromeUIKeyboardURL);
+ dom_view_->Init(profile,
+ SiteInstance::CreateSiteInstanceForURL(profile, keyboard_url));
+ dom_view_->LoadURL(keyboard_url);
+
+ dom_view_->SetVisible(true);
+ AddChildView(dom_view_);
+}
+
+KeyboardContainerView::~KeyboardContainerView() {
+}
+
+void KeyboardContainerView::Layout() {
+ // TODO(bryeung): include a border between the keyboard and the client view
+ dom_view_->SetBounds(0, 0, width(), height());
sky 2011/01/05 16:52:51 Use FillLayout instead of this.
bryeung 2011/01/10 22:32:19 I switched to FillLayout but that causes rendering
+ dom_view_->Layout();
+
+ // The keyboard must never be focusable, or it will steal the focus from
+ // the page the user is trying to type into.
+ MakeViewHierarchyUnfocusable(this);
sky 2011/01/05 16:52:51 Can you do this once? Say in the constructor or in
bryeung 2011/01/10 22:32:19 Seems to work in ViewHierarchyChanged. Good sugge
+}

Powered by Google App Engine