OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/accessibility/spoken_feedback_event_rewriter.h
" | 5 #include "chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.h
" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return false; | 46 return false; |
47 | 47 |
48 extensions::ExtensionHost* host = | 48 extensions::ExtensionHost* host = |
49 extensions::ProcessManager::Get(context) | 49 extensions::ProcessManager::Get(context) |
50 ->GetBackgroundHostForExtension(extension->id()); | 50 ->GetBackgroundHostForExtension(extension->id()); |
51 if (!host) | 51 if (!host) |
52 return false; | 52 return false; |
53 | 53 |
54 content::RenderViewHost* rvh = host->render_view_host(); | 54 content::RenderViewHost* rvh = host->render_view_host(); |
55 | 55 |
| 56 // Always capture the Search key. |
| 57 capture |= key_event.IsCommandDown(); |
| 58 |
56 // Listen for any unhandled keyboard events from ChromeVox's background page | 59 // Listen for any unhandled keyboard events from ChromeVox's background page |
57 // when capturing keys to reinject. | 60 // when capturing keys to reinject. |
58 if (capture) | 61 if (capture) |
59 host->host_contents()->SetDelegate(this); | 62 host->host_contents()->SetDelegate(this); |
60 else | 63 else |
61 host->host_contents()->SetDelegate(nullptr); | 64 host->host_contents()->SetDelegate(nullptr); |
62 | 65 |
63 // Forward all key events to ChromeVox's background page. | 66 // Forward all key events to ChromeVox's background page. |
64 const content::NativeWebKeyboardEvent web_event(key_event); | 67 const content::NativeWebKeyboardEvent web_event(key_event); |
65 rvh->GetWidget()->ForwardKeyboardEvent(web_event); | 68 rvh->GetWidget()->ForwardKeyboardEvent(web_event); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 if (delegate_->DispatchKeyEventToChromeVox(key_event, capture)) | 140 if (delegate_->DispatchKeyEventToChromeVox(key_event, capture)) |
138 return ui::EVENT_REWRITE_DISCARD; | 141 return ui::EVENT_REWRITE_DISCARD; |
139 return ui::EVENT_REWRITE_CONTINUE; | 142 return ui::EVENT_REWRITE_CONTINUE; |
140 } | 143 } |
141 | 144 |
142 ui::EventRewriteStatus SpokenFeedbackEventRewriter::NextDispatchEvent( | 145 ui::EventRewriteStatus SpokenFeedbackEventRewriter::NextDispatchEvent( |
143 const ui::Event& last_event, | 146 const ui::Event& last_event, |
144 scoped_ptr<ui::Event>* new_event) { | 147 scoped_ptr<ui::Event>* new_event) { |
145 return ui::EVENT_REWRITE_CONTINUE; | 148 return ui::EVENT_REWRITE_CONTINUE; |
146 } | 149 } |
OLD | NEW |