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

Side by Side Diff: chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.cc

Issue 1191783002: Support Compat mode inside of the desktop tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@commands_alt
Patch Set: Resolve focus. Created 5 years, 6 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 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 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 27 matching lines...) Expand all
38 extension_misc::kChromeVoxExtensionId); 38 extension_misc::kChromeVoxExtensionId);
39 if (!extension) 39 if (!extension)
40 return ui::EVENT_REWRITE_CONTINUE; 40 return ui::EVENT_REWRITE_CONTINUE;
41 41
42 const extensions::CommandMap* commands = 42 const extensions::CommandMap* commands =
43 extensions::CommandsInfo::GetNamedCommands(extension); 43 extensions::CommandsInfo::GetNamedCommands(extension);
44 if (!commands) 44 if (!commands)
45 return ui::EVENT_REWRITE_CONTINUE; 45 return ui::EVENT_REWRITE_CONTINUE;
46 46
47 const ui::KeyEvent key_event = static_cast<const ui::KeyEvent&>(event); 47 const ui::KeyEvent key_event = static_cast<const ui::KeyEvent&>(event);
48 int modifiers = key_event.flags() & (ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN |
49 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN);
48 std::string command_name; 50 std::string command_name;
49 for (extensions::CommandMap::const_iterator iter = commands->begin(); 51 for (extensions::CommandMap::const_iterator iter = commands->begin();
50 iter != commands->end(); ++iter) { 52 iter != commands->end(); ++iter) {
51 if (iter->second.accelerator().key_code() == key_event.key_code() && 53 if (iter->second.accelerator().key_code() == key_event.key_code() &&
52 iter->second.accelerator().modifiers() == key_event.flags()) 54 iter->second.accelerator().modifiers() == modifiers)
dmazzoni 2015/06/17 19:29:58 Should you be filtering the second accelerator mod
David Tseng 2015/06/17 21:15:13 Done. Done for the key event to make the test pass
53 command_name = iter->second.command_name(); 55 command_name = iter->second.command_name();
54 } 56 }
55 57
56 if (command_name.empty()) 58 if (command_name.empty())
57 return ui::EVENT_REWRITE_CONTINUE; 59 return ui::EVENT_REWRITE_CONTINUE;
58 60
59 scoped_ptr<base::ListValue> args(new base::ListValue()); 61 scoped_ptr<base::ListValue> args(new base::ListValue());
60 args->Append(new base::StringValue(command_name)); 62 args->Append(new base::StringValue(command_name));
61 63
62 scoped_ptr<extensions::Event> extension_event( 64 scoped_ptr<extensions::Event> extension_event(
63 new extensions::Event("commands.onCommand", args.Pass())); 65 new extensions::Event("commands.onCommand", args.Pass()));
64 extension_event->restrict_to_browser_context = context; 66 extension_event->restrict_to_browser_context = context;
65 67
66 extensions::EventRouter::Get(context)->DispatchEventToExtension( 68 extensions::EventRouter::Get(context)->DispatchEventToExtension(
67 extension_misc::kChromeVoxExtensionId, extension_event.Pass()); 69 extension_misc::kChromeVoxExtensionId, extension_event.Pass());
68 70
69 return ui::EVENT_REWRITE_DISCARD; 71 return ui::EVENT_REWRITE_DISCARD;
70 } 72 }
71 73
72 ui::EventRewriteStatus SpokenFeedbackEventRewriter::NextDispatchEvent( 74 ui::EventRewriteStatus SpokenFeedbackEventRewriter::NextDispatchEvent(
73 const ui::Event& last_event, 75 const ui::Event& last_event,
74 scoped_ptr<ui::Event>* new_event) { 76 scoped_ptr<ui::Event>* new_event) {
75 return ui::EVENT_REWRITE_CONTINUE; 77 return ui::EVENT_REWRITE_CONTINUE;
76 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698