| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "athena/virtual_keyboard/public/virtual_keyboard_manager.h" | 5 #include "athena/virtual_keyboard/public/virtual_keyboard_manager.h" |
| 6 | 6 |
| 7 #include "athena/common/container_priorities.h" | 7 #include "athena/common/container_priorities.h" |
| 8 #include "athena/common/fill_layout_manager.h" | 8 #include "athena/common/fill_layout_manager.h" |
| 9 #include "athena/screen/public/screen_manager.h" | 9 #include "athena/screen/public/screen_manager.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 keyboard::KeyboardController::ResetInstance(NULL); | 76 keyboard::KeyboardController::ResetInstance(NULL); |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 void Init() { | 80 void Init() { |
| 81 athena::ScreenManager::ContainerParams params("VirtualKeyboardContainer", | 81 athena::ScreenManager::ContainerParams params("VirtualKeyboardContainer", |
| 82 CP_VIRTUAL_KEYBOARD); | 82 CP_VIRTUAL_KEYBOARD); |
| 83 container_ = athena::ScreenManager::Get()->CreateContainer(params); | 83 container_ = athena::ScreenManager::Get()->CreateContainer(params); |
| 84 container_->SetLayoutManager(new FillLayoutManager(container_)); | 84 container_->SetLayoutManager(new FillLayoutManager(container_)); |
| 85 | 85 |
| 86 keyboard_controller_.reset(new keyboard::KeyboardController( | 86 keyboard::KeyboardController* controller = new keyboard::KeyboardController( |
| 87 new BasicKeyboardControllerProxy(browser_context_, | 87 new BasicKeyboardControllerProxy(browser_context_, |
| 88 container_->GetRootWindow()))); | 88 container_->GetRootWindow())); |
| 89 keyboard::KeyboardController::ResetInstance(keyboard_controller_.get()); | 89 // ResetInstance takes ownership. |
| 90 aura::Window* kb_container = keyboard_controller_->GetContainerWindow(); | 90 keyboard::KeyboardController::ResetInstance(controller); |
| 91 aura::Window* kb_container = controller->GetContainerWindow(); |
| 91 container_->AddChild(kb_container); | 92 container_->AddChild(kb_container); |
| 92 kb_container->Show(); | 93 kb_container->Show(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 content::BrowserContext* browser_context_; | 96 content::BrowserContext* browser_context_; |
| 96 aura::Window* container_; | 97 aura::Window* container_; |
| 97 scoped_ptr<keyboard::KeyboardController> keyboard_controller_; | |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardManagerImpl); | 99 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardManagerImpl); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 } // namespace | 102 } // namespace |
| 103 | 103 |
| 104 // static | 104 // static |
| 105 VirtualKeyboardManager* VirtualKeyboardManager::Create( | 105 VirtualKeyboardManager* VirtualKeyboardManager::Create( |
| 106 content::BrowserContext* browser_context) { | 106 content::BrowserContext* browser_context) { |
| 107 CHECK(!instance); | 107 CHECK(!instance); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 118 return instance; | 118 return instance; |
| 119 } | 119 } |
| 120 | 120 |
| 121 void VirtualKeyboardManager::Shutdown() { | 121 void VirtualKeyboardManager::Shutdown() { |
| 122 CHECK(instance); | 122 CHECK(instance); |
| 123 delete instance; | 123 delete instance; |
| 124 CHECK(!instance); | 124 CHECK(!instance); |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace athena | 127 } // namespace athena |
| OLD | NEW |