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

Side by Side Diff: mash/browser_driver/browser_driver_application_delegate.cc

Issue 1641003002: [exp] ash: Ash in Mus. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot-merge Created 4 years, 10 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
« no previous file with comments | « components/nacl/loader/nacl_helper_linux.cc ('k') | mash/shell/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "mash/browser_driver/browser_driver_application_delegate.h" 5 #include "mash/browser_driver/browser_driver_application_delegate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "components/mus/public/cpp/event_matcher.h" 10 #include "components/mus/public/cpp/event_matcher.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 mojo::ApplicationConnection* connection) { 59 mojo::ApplicationConnection* connection) {
60 return false; 60 return false;
61 } 61 }
62 62
63 void BrowserDriverApplicationDelegate::OnAccelerator( 63 void BrowserDriverApplicationDelegate::OnAccelerator(
64 uint32_t id, mus::mojom::EventPtr event) { 64 uint32_t id, mus::mojom::EventPtr event) {
65 switch (static_cast<Accelerator>(id)) { 65 switch (static_cast<Accelerator>(id)) {
66 case Accelerator::NewWindow: 66 case Accelerator::NewWindow:
67 case Accelerator::NewTab: 67 case Accelerator::NewTab:
68 case Accelerator::NewIncognitoWindow: 68 case Accelerator::NewIncognitoWindow:
69 app_->ConnectToApplication("exe:chrome"); 69 app_->ConnectToApplication("mojo:task_viewer");
70 // TODO(beng): have Chrome export a service that allows it to be driven by 70 // TODO(beng): have Chrome export a service that allows it to be driven by
71 // this driver, e.g. to open new tabs, incognito windows, etc. 71 // this driver, e.g. to open new tabs, incognito windows, etc.
72 break; 72 break;
73 default: 73 default:
74 NOTREACHED(); 74 NOTREACHED();
75 break; 75 break;
76 } 76 }
77 } 77 }
78 78
79 void BrowserDriverApplicationDelegate::AddAccelerators() { 79 void BrowserDriverApplicationDelegate::AddAccelerators() {
80 // TODO(beng): find some other way to get the window manager. I don't like 80 // TODO(beng): find some other way to get the window manager. I don't like
81 // having to specify it by URL because it may differ per display. 81 // having to specify it by URL because it may differ per display.
82 mus::mojom::AcceleratorRegistrarPtr registrar; 82 mus::mojom::AcceleratorRegistrarPtr registrar;
83 app_->ConnectToService("mojo:desktop_wm", &registrar); 83 app_->ConnectToService("mojo:ash_wm", &registrar);
84 84
85 if (binding_.is_bound()) 85 if (binding_.is_bound())
86 binding_.Unbind(); 86 binding_.Unbind();
87 registrar->SetHandler(binding_.CreateInterfacePtrAndBind()); 87 registrar->SetHandler(binding_.CreateInterfacePtrAndBind());
88 // If the window manager restarts, the handler pipe will close and we'll need 88 // If the window manager restarts, the handler pipe will close and we'll need
89 // to re-add our accelerators when the window manager comes back up. 89 // to re-add our accelerators when the window manager comes back up.
90 binding_.set_connection_error_handler( 90 binding_.set_connection_error_handler(
91 base::Bind(&BrowserDriverApplicationDelegate::AddAccelerators, 91 base::Bind(&BrowserDriverApplicationDelegate::AddAccelerators,
92 base::Unretained(this))); 92 base::Unretained(this)));
93 93
94 for (const AcceleratorSpec& spec : g_spec) { 94 for (const AcceleratorSpec& spec : g_spec) {
95 registrar->AddAccelerator( 95 registrar->AddAccelerator(
96 static_cast<uint32_t>(spec.id), 96 static_cast<uint32_t>(spec.id),
97 mus::CreateKeyMatcher(spec.keyboard_code, spec.event_flags), 97 mus::CreateKeyMatcher(spec.keyboard_code, spec.event_flags),
98 base::Bind(&AssertTrue)); 98 base::Bind(&AssertTrue));
99 } 99 }
100 } 100 }
101 101
102 } // namespace browser_driver 102 } // namespace browser_driver
103 } // namespace main 103 } // namespace main
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_helper_linux.cc ('k') | mash/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698