| 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 "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 "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 uint32_t id) { | 60 uint32_t id) { |
| 61 connector_ = connector; | 61 connector_ = connector; |
| 62 AddAccelerators(); | 62 AddAccelerators(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool BrowserDriverApplicationDelegate::AcceptConnection( | 65 bool BrowserDriverApplicationDelegate::AcceptConnection( |
| 66 mojo::Connection* connection) { | 66 mojo::Connection* connection) { |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool BrowserDriverApplicationDelegate::ShellConnectionLost() { | 70 void BrowserDriverApplicationDelegate::ShellConnectionLost() { |
| 71 // Prevent the code in AddAccelerators() from keeping this app alive. | 71 // Prevent the code in AddAccelerators() from keeping this app alive. |
| 72 binding_.set_connection_error_handler(base::Bind(&DoNothing)); | 72 binding_.set_connection_error_handler(base::Bind(&DoNothing)); |
| 73 return true; | 73 base::MessageLoop::current()->QuitWhenIdle(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void BrowserDriverApplicationDelegate::OnAccelerator( | 76 void BrowserDriverApplicationDelegate::OnAccelerator( |
| 77 uint32_t id, mus::mojom::EventPtr event) { | 77 uint32_t id, mus::mojom::EventPtr event) { |
| 78 switch (static_cast<Accelerator>(id)) { | 78 switch (static_cast<Accelerator>(id)) { |
| 79 case Accelerator::NewWindow: | 79 case Accelerator::NewWindow: |
| 80 case Accelerator::NewTab: | 80 case Accelerator::NewTab: |
| 81 case Accelerator::NewIncognitoWindow: | 81 case Accelerator::NewIncognitoWindow: |
| 82 connector_->Connect("exe:chrome"); | 82 connector_->Connect("exe:chrome"); |
| 83 // TODO(beng): have Chrome export a service that allows it to be driven by | 83 // TODO(beng): have Chrome export a service that allows it to be driven by |
| (...skipping 23 matching lines...) Expand all Loading... |
| 107 for (const AcceleratorSpec& spec : g_spec) { | 107 for (const AcceleratorSpec& spec : g_spec) { |
| 108 registrar->AddAccelerator( | 108 registrar->AddAccelerator( |
| 109 static_cast<uint32_t>(spec.id), | 109 static_cast<uint32_t>(spec.id), |
| 110 mus::CreateKeyMatcher(spec.keyboard_code, spec.event_flags), | 110 mus::CreateKeyMatcher(spec.keyboard_code, spec.event_flags), |
| 111 base::Bind(&AssertTrue)); | 111 base::Bind(&AssertTrue)); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace browser_driver | 115 } // namespace browser_driver |
| 116 } // namespace main | 116 } // namespace main |
| OLD | NEW |