| 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 InitKeyboard(); | 356 if (keyboard::IsKeyboardEnabled()) { |
| 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 |
| 357 GetPrimaryRootWindowController()->ActivateKeyboard( | 372 GetPrimaryRootWindowController()->ActivateKeyboard( |
| 358 keyboard::KeyboardController::GetInstance()); | 373 keyboard::KeyboardController::GetInstance()); |
| 359 } | 374 } |
| 360 | 375 |
| 361 void Shell::DeactivateKeyboard() { | 376 void Shell::DeactivateKeyboard() { |
| 362 // TODO(jamescook): Move keyboard create and hide into ShellPort. | 377 // TODO(jamescook): Move keyboard create and hide into ShellPort. |
| 363 keyboard_ui_->Hide(); | 378 keyboard_ui_->Hide(); |
| 364 if (keyboard::KeyboardController::GetInstance()) { | 379 if (keyboard::KeyboardController::GetInstance()) { |
| 365 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 380 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 366 for (RootWindowControllerList::iterator iter = controllers.begin(); | 381 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 void Shell::OnPrefServiceInitialized( | 1292 void Shell::OnPrefServiceInitialized( |
| 1278 std::unique_ptr<::PrefService> pref_service) { | 1293 std::unique_ptr<::PrefService> pref_service) { |
| 1279 if (!instance_) | 1294 if (!instance_) |
| 1280 return; | 1295 return; |
| 1281 // |pref_service_| is null if can't connect to Chrome (as happens when | 1296 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1282 // running mash outside of chrome --mash and chrome isn't built). | 1297 // running mash outside of chrome --mash and chrome isn't built). |
| 1283 pref_service_ = std::move(pref_service); | 1298 pref_service_ = std::move(pref_service); |
| 1284 } | 1299 } |
| 1285 | 1300 |
| 1286 } // namespace ash | 1301 } // namespace ash |
| OLD | NEW |