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::ViewHierarchyChanged(bool is_add, | |
| 42 View* parent, | |
| 43 View* child) { | |
| 44 if (is_add) | |
| 45 MakeViewHierarchyUnfocusable(child); | |
| 46 } | |
| 47 | |
| 48 void KeyboardContainerView::Layout() { | |
|
sky
2011/01/10 22:38:10
Order should match header.
| |
| 49 // TODO(bryeung): include a border between the keyboard and the client view | |
| 50 dom_view_->SetBounds(0, 0, width(), height()); | |
| 51 dom_view_->Layout(); | |
|
sky
2011/01/10 22:38:10
You shouldn't need this Layout. SetBounds invokes
| |
| 52 } | |
| OLD | NEW |