Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

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: last patch was missing changes Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..60f81427a9b399825af4d7fe18cb2daee9e3fb82
--- /dev/null
+++ b/chrome/browser/ui/touch/frame/keyboard_container_view.cc
@@ -0,0 +1,56 @@
+// 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());
+
+ // TODO(anicolao): This shouldn't be necessary: the DOMView should be laid
+ // out by the call to SetBounds above.
+ dom_view_->Layout();
+}
+
+void KeyboardContainerView::ViewHierarchyChanged(bool is_add,
+ View* parent,
+ View* child) {
+ if (is_add)
+ MakeViewHierarchyUnfocusable(child);
+}
+
« no previous file with comments | « chrome/browser/ui/touch/frame/keyboard_container_view.h ('k') | chrome/browser/ui/touch/frame/touch_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698