summaryrefslogtreecommitdiffstats
path: root/mandoline
diff options
context:
space:
mode:
authorsadrul <sadrul@chromium.org>2015-10-22 14:19:58 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-22 21:20:57 +0000
commite3726ec7b5baa4fe0619aeaeae55ba948f2d8605 (patch)
tree45fe12352d26427adde520d1e9411bca23dceab1 /mandoline
parent65ee4346123cb72b9860408dee37c51886281730 (diff)
downloadchromium_src-e3726ec7b5baa4fe0619aeaeae55ba948f2d8605.zip
chromium_src-e3726ec7b5baa4fe0619aeaeae55ba948f2d8605.tar.gz
chromium_src-e3726ec7b5baa4fe0619aeaeae55ba948f2d8605.tar.bz2
mus: Introduce EventMatcher.
EventMatcher: Clients can send an EventMatcher to the server, and associate some command with it. If an input event matches an EventMatcher, then mus sends the event and the associated command back to the client. Update the accelerator handling in mus to use EventMatcher. BUG=546707 Review URL: https://codereview.chromium.org/1420813002 Cr-Commit-Position: refs/heads/master@{#355644}
Diffstat (limited to 'mandoline')
-rw-r--r--mandoline/ui/desktop_ui/browser_window.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/mandoline/ui/desktop_ui/browser_window.cc b/mandoline/ui/desktop_ui/browser_window.cc
index 3195be3..413ddd3 100644
--- a/mandoline/ui/desktop_ui/browser_window.cc
+++ b/mandoline/ui/desktop_ui/browser_window.cc
@@ -8,6 +8,7 @@
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
+#include "components/mus/public/cpp/event_matcher.h"
#include "components/mus/public/cpp/scoped_window_ptr.h"
#include "components/mus/public/cpp/window_tree_host_factory.h"
#include "mandoline/ui/desktop_ui/browser_commands.h"
@@ -176,18 +177,23 @@ void BrowserWindow::OnEmbed(mus::Window* root) {
web_view_.Init(app_, content_);
host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::CLOSE),
- mojo::KEYBOARD_CODE_W, mojo::EVENT_FLAGS_CONTROL_DOWN);
+ mus::CreateKeyMatcher(mojo::KEYBOARD_CODE_W,
+ mojo::EVENT_FLAGS_CONTROL_DOWN));
host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::FOCUS_OMNIBOX),
- mojo::KEYBOARD_CODE_L, mojo::EVENT_FLAGS_CONTROL_DOWN);
+ mus::CreateKeyMatcher(mojo::KEYBOARD_CODE_L,
+ mojo::EVENT_FLAGS_CONTROL_DOWN));
host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::NEW_WINDOW),
- mojo::KEYBOARD_CODE_N, mojo::EVENT_FLAGS_CONTROL_DOWN);
+ mus::CreateKeyMatcher(mojo::KEYBOARD_CODE_N,
+ mojo::EVENT_FLAGS_CONTROL_DOWN));
host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::SHOW_FIND),
- mojo::KEYBOARD_CODE_F, mojo::EVENT_FLAGS_CONTROL_DOWN);
+ mus::CreateKeyMatcher(mojo::KEYBOARD_CODE_F,
+ mojo::EVENT_FLAGS_CONTROL_DOWN));
host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::GO_BACK),
- mojo::KEYBOARD_CODE_LEFT, mojo::EVENT_FLAGS_ALT_DOWN);
+ mus::CreateKeyMatcher(mojo::KEYBOARD_CODE_LEFT,
+ mojo::EVENT_FLAGS_ALT_DOWN));
host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::GO_FORWARD),
- mojo::KEYBOARD_CODE_RIGHT, mojo::EVENT_FLAGS_ALT_DOWN);
-
+ mus::CreateKeyMatcher(mojo::KEYBOARD_CODE_RIGHT,
+ mojo::EVENT_FLAGS_ALT_DOWN));
// Now that we're ready, load the default url.
LoadURL(default_url_);