OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/extensions/global_shortcut_listener.h" | 5 #include "chrome/browser/extensions/global_shortcut_listener.h" |
6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
7 #include "ui/base/accelerators/accelerator.h" | 7 #include "ui/base/accelerators/accelerator.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 | 10 |
11 GlobalShortcutListener::GlobalShortcutListener() { | 11 GlobalShortcutListener::GlobalShortcutListener() { |
| 12 LOG(ERROR) << "GlobalShortcutListener Constructor"; |
12 } | 13 } |
13 | 14 |
14 GlobalShortcutListener::~GlobalShortcutListener() { | 15 GlobalShortcutListener::~GlobalShortcutListener() { |
15 DCHECK(accelerator_map_.empty()); // Make sure we've cleaned up. | 16 DCHECK(accelerator_map_.empty()); // Make sure we've cleaned up. |
16 } | 17 } |
17 | 18 |
18 void GlobalShortcutListener::RegisterAccelerator( | 19 void GlobalShortcutListener::RegisterAccelerator( |
19 const ui::Accelerator& accelerator, Observer* observer) { | 20 const ui::Accelerator& accelerator, Observer* observer) { |
20 AcceleratorMap::const_iterator it = accelerator_map_.find(accelerator); | 21 AcceleratorMap::const_iterator it = accelerator_map_.find(accelerator); |
21 if (it == accelerator_map_.end()) { | 22 if (it == accelerator_map_.end()) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 NOTREACHED(); | 54 NOTREACHED(); |
54 return; // No-one is listening to this key. | 55 return; // No-one is listening to this key. |
55 } | 56 } |
56 // The observer list should not be empty. | 57 // The observer list should not be empty. |
57 DCHECK(iter->second->might_have_observers()); | 58 DCHECK(iter->second->might_have_observers()); |
58 | 59 |
59 FOR_EACH_OBSERVER(Observer, *(iter->second), OnKeyPressed(accelerator)); | 60 FOR_EACH_OBSERVER(Observer, *(iter->second), OnKeyPressed(accelerator)); |
60 } | 61 } |
61 | 62 |
62 } // namespace extensions | 63 } // namespace extensions |
OLD | NEW |