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()); |
| 44 |
| 45 // TODO(anicolao): This shouldn't be necessary: the DOMView should be laid |
| 46 // out by the call to SetBounds above. |
| 47 dom_view_->Layout(); |
| 48 } |
| 49 |
| 50 void KeyboardContainerView::ViewHierarchyChanged(bool is_add, |
| 51 View* parent, |
| 52 View* child) { |
| 53 if (is_add) |
| 54 MakeViewHierarchyUnfocusable(child); |
| 55 } |
| 56 |
OLD | NEW |