Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: ash/accelerators/focus_manager_factory.cc

Issue 838253004: MacViews: Fix duplicate definition of ExtensionKeyBindingRegistry::SetShortcutHandlingSuspended (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DragBookmarks2
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/focus_manager_factory.h" 5 #include "ash/accelerators/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 "ui/views/focus/focus_manager.h" 9 #include "ui/views/focus/focus_manager.h"
10 10
11 namespace ash { 11 namespace ash {
12 12
13 AshFocusManagerFactory::AshFocusManagerFactory() {} 13 AshFocusManagerFactory::AshFocusManagerFactory() {}
14 AshFocusManagerFactory::~AshFocusManagerFactory() {} 14 AshFocusManagerFactory::~AshFocusManagerFactory() {}
15 15
16 views::FocusManager* AshFocusManagerFactory::CreateFocusManager( 16 views::FocusManager* AshFocusManagerFactory::CreateFocusManager(
17 views::Widget* widget, 17 views::Widget* widget,
18 bool desktop_widget) { 18 bool desktop_widget) {
19 return new views::FocusManager(widget, desktop_widget ? NULL : new Delegate); 19 views::FocusManager* focus_manager = new views::FocusManager(widget);
20 if (!desktop_widget)
21 accelerator_processor_.reset(new AcceleratorProcessor(focus_manager));
22 return focus_manager;
20 } 23 }
21 24
22 bool AshFocusManagerFactory::Delegate::ProcessAccelerator( 25 AshFocusManagerFactory::AcceleratorProcessor::AcceleratorProcessor(
26 views::FocusManager* focus_manager)
27 : focus_manager_(focus_manager) {
28 focus_manager_->AddAcceleratorPostProcessor(this);
29 }
30
31 AshFocusManagerFactory::AcceleratorProcessor::~AcceleratorProcessor() {
32 }
33
34 bool AshFocusManagerFactory::AcceleratorProcessor::ProcessAccelerator(
23 const ui::Accelerator& accelerator) { 35 const ui::Accelerator& accelerator) {
24 AcceleratorController* controller = 36 AcceleratorController* controller =
25 Shell::GetInstance()->accelerator_controller(); 37 Shell::GetInstance()->accelerator_controller();
26 if (controller) 38 if (controller)
27 return controller->Process(accelerator); 39 return controller->Process(accelerator);
28 return false; 40 return false;
29 } 41 }
30 42
31 ui::AcceleratorTarget* 43 ui::AcceleratorTarget*
32 AshFocusManagerFactory::Delegate::GetCurrentTargetForAccelerator( 44 AshFocusManagerFactory::AcceleratorProcessor::GetTargetForAccelerator(
33 const ui::Accelerator& accelerator) const { 45 const ui::Accelerator& accelerator) const {
34 AcceleratorController* controller = 46 AcceleratorController* controller =
35 Shell::GetInstance()->accelerator_controller(); 47 Shell::GetInstance()->accelerator_controller();
36 if (controller && controller->IsRegistered(accelerator)) 48 if (controller && controller->IsRegistered(accelerator))
37 return controller; 49 return controller;
38 return NULL; 50 return NULL;
39 } 51 }
40 52
41 } // namespace ash 53 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698