| 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/accelerators/ash_focus_manager_factory.h" | 5 #include "ash/accelerators/ash_focus_manager_factory.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "ui/views/focus/focus_manager.h" | 10 #include "ui/views/focus/focus_manager.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 | 13 |
| 14 AshFocusManagerFactory::AshFocusManagerFactory() {} | 14 AshFocusManagerFactory::AshFocusManagerFactory() {} |
| 15 AshFocusManagerFactory::~AshFocusManagerFactory() {} | 15 AshFocusManagerFactory::~AshFocusManagerFactory() {} |
| 16 | 16 |
| 17 views::FocusManager* AshFocusManagerFactory::CreateFocusManager( | 17 std::unique_ptr<views::FocusManager> AshFocusManagerFactory::CreateFocusManager( |
| 18 views::Widget* widget, | 18 views::Widget* widget, |
| 19 bool desktop_widget) { | 19 bool desktop_widget) { |
| 20 return new views::FocusManager( | 20 return base::MakeUnique<views::FocusManager>( |
| 21 widget, | 21 widget, desktop_widget ? nullptr : base::MakeUnique<Delegate>()); |
| 22 desktop_widget ? nullptr : base::WrapUnique<Delegate>(new Delegate)); | |
| 23 } | 22 } |
| 24 | 23 |
| 24 AshFocusManagerFactory::Delegate::Delegate() {} |
| 25 AshFocusManagerFactory::Delegate::~Delegate() {} |
| 26 |
| 25 bool AshFocusManagerFactory::Delegate::ProcessAccelerator( | 27 bool AshFocusManagerFactory::Delegate::ProcessAccelerator( |
| 26 const ui::Accelerator& accelerator) { | 28 const ui::Accelerator& accelerator) { |
| 27 AcceleratorController* controller = Shell::Get()->accelerator_controller(); | 29 AcceleratorController* controller = Shell::Get()->accelerator_controller(); |
| 28 if (controller) | 30 return controller && controller->Process(accelerator); |
| 29 return controller->Process(accelerator); | |
| 30 return false; | |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace ash | 33 } // namespace ash |
| OLD | NEW |