summaryrefslogtreecommitdiffstats
path: root/mash
diff options
context:
space:
mode:
authorsky <sky@chromium.org>2016-01-21 10:59:47 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-21 19:01:42 +0000
commitad19bf46a6bea7ad579a19e044de847a9fd08e7d (patch)
treea2708ffa268959b4affdb4cb2fb1c92453e11ea3 /mash
parent09a677695eeb5a3631cf50386cbb612e3da0b833 (diff)
downloadchromium_src-ad19bf46a6bea7ad579a19e044de847a9fd08e7d.zip
chromium_src-ad19bf46a6bea7ad579a19e044de847a9fd08e7d.tar.gz
chromium_src-ad19bf46a6bea7ad579a19e044de847a9fd08e7d.tar.bz2
Reduce boilerplate needed to configure mojo::Binding
BUG=579645 TEST=none R=yzshen@chromium.org Review URL: https://codereview.chromium.org/1614553002 Cr-Commit-Position: refs/heads/master@{#370741}
Diffstat (limited to 'mash')
-rw-r--r--mash/browser_driver/browser_driver_application_delegate.cc4
-rw-r--r--mash/shelf/shelf_view.cc7
-rw-r--r--mash/wm/accelerator_registrar_apptest.cc4
3 files changed, 4 insertions, 11 deletions
diff --git a/mash/browser_driver/browser_driver_application_delegate.cc b/mash/browser_driver/browser_driver_application_delegate.cc
index 62fdccf..8e1b633 100644
--- a/mash/browser_driver/browser_driver_application_delegate.cc
+++ b/mash/browser_driver/browser_driver_application_delegate.cc
@@ -84,14 +84,12 @@ void BrowserDriverApplicationDelegate::AddAccelerators() {
if (binding_.is_bound())
binding_.Unbind();
- mus::mojom::AcceleratorHandlerPtr handler;
- binding_.Bind(GetProxy(&handler));
// If the window manager restarts, the handler pipe will close and we'll need
// to re-add our accelerators when the window manager comes back up.
binding_.set_connection_error_handler(
base::Bind(&BrowserDriverApplicationDelegate::AddAccelerators,
base::Unretained(this)));
- registrar->SetHandler(std::move(handler));
+ registrar->SetHandler(binding_.CreateInterfacePtrAndBind());
for (const AcceleratorSpec& spec : g_spec) {
registrar->AddAccelerator(
diff --git a/mash/shelf/shelf_view.cc b/mash/shelf/shelf_view.cc
index c477aac..d25f48c 100644
--- a/mash/shelf/shelf_view.cc
+++ b/mash/shelf/shelf_view.cc
@@ -18,11 +18,8 @@ namespace shelf {
ShelfView::ShelfView(mojo::ApplicationImpl* app) : binding_(this) {
app->ConnectToService("mojo:desktop_wm", &user_window_controller_);
- mash::wm::mojom::UserWindowObserverPtr observer;
- mojo::InterfaceRequest<mash::wm::mojom::UserWindowObserver> request =
- mojo::GetProxy(&observer);
- user_window_controller_->AddUserWindowObserver(std::move(observer));
- binding_.Bind(std::move(request));
+ user_window_controller_->AddUserWindowObserver(
+ binding_.CreateInterfacePtrAndBind());
SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
diff --git a/mash/wm/accelerator_registrar_apptest.cc b/mash/wm/accelerator_registrar_apptest.cc
index 083f8c8..5f8aa06 100644
--- a/mash/wm/accelerator_registrar_apptest.cc
+++ b/mash/wm/accelerator_registrar_apptest.cc
@@ -29,9 +29,7 @@ class TestAcceleratorHandler : public AcceleratorHandler {
: binding_(this),
registrar_(std::move(registrar)),
add_accelerator_result_(false) {
- AcceleratorHandlerPtr handler;
- binding_.Bind(GetProxy(&handler));
- registrar_->SetHandler(std::move(handler));
+ registrar_->SetHandler(binding_.CreateInterfacePtrAndBind());
}
~TestAcceleratorHandler() override {}