| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 for (auto& observer : shell_observers_) | 346 for (auto& observer : shell_observers_) |
| 347 observer.OnCastingSessionStartedOrStopped(started); | 347 observer.OnCastingSessionStartedOrStopped(started); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void Shell::OnRootWindowAdded(aura::Window* root_window) { | 350 void Shell::OnRootWindowAdded(aura::Window* root_window) { |
| 351 for (auto& observer : shell_observers_) | 351 for (auto& observer : shell_observers_) |
| 352 observer.OnRootWindowAdded(root_window); | 352 observer.OnRootWindowAdded(root_window); |
| 353 } | 353 } |
| 354 | 354 |
| 355 void Shell::CreateKeyboard() { | 355 void Shell::CreateKeyboard() { |
| 356 if (keyboard::IsKeyboardEnabled()) { | 356 InitKeyboard(); |
| 357 if (keyboard::KeyboardController::GetInstance()) { | |
| 358 RootWindowControllerList controllers = GetAllRootWindowControllers(); | |
| 359 for (RootWindowControllerList::iterator iter = controllers.begin(); | |
| 360 iter != controllers.end(); ++iter) { | |
| 361 (*iter)->DeactivateKeyboard( | |
| 362 keyboard::KeyboardController::GetInstance()); | |
| 363 } | |
| 364 } | |
| 365 keyboard::KeyboardController::ResetInstance( | |
| 366 new keyboard::KeyboardController(shell_delegate_->CreateKeyboardUI(), | |
| 367 virtual_keyboard_controller_.get())); | |
| 368 for (auto& observer : shell_observers_) | |
| 369 observer.OnKeyboardControllerCreated(); | |
| 370 } | |
| 371 | |
| 372 GetPrimaryRootWindowController()->ActivateKeyboard( | 357 GetPrimaryRootWindowController()->ActivateKeyboard( |
| 373 keyboard::KeyboardController::GetInstance()); | 358 keyboard::KeyboardController::GetInstance()); |
| 374 } | 359 } |
| 375 | 360 |
| 376 void Shell::DeactivateKeyboard() { | 361 void Shell::DeactivateKeyboard() { |
| 377 // TODO(jamescook): Move keyboard create and hide into ShellPort. | 362 // TODO(jamescook): Move keyboard create and hide into ShellPort. |
| 378 keyboard_ui_->Hide(); | 363 keyboard_ui_->Hide(); |
| 379 if (keyboard::KeyboardController::GetInstance()) { | 364 if (keyboard::KeyboardController::GetInstance()) { |
| 380 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 365 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 381 for (RootWindowControllerList::iterator iter = controllers.begin(); | 366 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 void Shell::OnPrefServiceInitialized( | 1277 void Shell::OnPrefServiceInitialized( |
| 1293 std::unique_ptr<::PrefService> pref_service) { | 1278 std::unique_ptr<::PrefService> pref_service) { |
| 1294 if (!instance_) | 1279 if (!instance_) |
| 1295 return; | 1280 return; |
| 1296 // |pref_service_| is null if can't connect to Chrome (as happens when | 1281 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1297 // running mash outside of chrome --mash and chrome isn't built). | 1282 // running mash outside of chrome --mash and chrome isn't built). |
| 1298 pref_service_ = std::move(pref_service); | 1283 pref_service_ = std::move(pref_service); |
| 1299 } | 1284 } |
| 1300 | 1285 |
| 1301 } // namespace ash | 1286 } // namespace ash |
| OLD | NEW |