Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/touch/frame/keyboard_container_view.h" | |
| 6 | |
| 7 #include "chrome/browser/profiles/profile.h" | |
| 8 #include "chrome/browser/renderer_host/site_instance.h" | |
| 9 #include "chrome/browser/ui/views/dom_view.h" | |
| 10 #include "chrome/common/url_constants.h" | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 // Make the provided view and all of its descendents unfocusable. | |
| 15 void MakeViewHierarchyUnfocusable(views::View* view) { | |
| 16 view->SetFocusable(false); | |
| 17 for (int i = 0; i < view->GetChildViewCount(); ++i) { | |
| 18 MakeViewHierarchyUnfocusable(view->GetChildViewAt(i)); | |
| 19 } | |
| 20 } | |
| 21 | |
| 22 } // namepsace | |
| 23 | |
| 24 /////////////////////////////////////////////////////////////////////////////// | |
| 25 // KeyboardContainerView, public: | |
| 26 | |
| 27 KeyboardContainerView::KeyboardContainerView(Profile* profile) | |
| 28 : dom_view_(new DOMView) { | |
| 29 GURL keyboard_url(chrome::kChromeUIKeyboardURL); | |
| 30 dom_view_->Init(profile, | |
| 31 SiteInstance::CreateSiteInstanceForURL(profile, keyboard_url)); | |
| 32 dom_view_->LoadURL(keyboard_url); | |
| 33 | |
| 34 dom_view_->SetVisible(true); | |
| 35 AddChildView(dom_view_); | |
| 36 } | |
| 37 | |
| 38 KeyboardContainerView::~KeyboardContainerView() { | |
| 39 } | |
| 40 | |
| 41 void KeyboardContainerView::Layout() { | |
| 42 // TODO(bryeung): include a border between the keyboard and the client view | |
| 43 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
| |
| 44 dom_view_->Layout(); | |
| 45 | |
| 46 // The keyboard must never be focusable, or it will steal the focus from | |
| 47 // the page the user is trying to type into. | |
| 48 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
| |
| 49 } | |
| OLD | NEW |