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/app_driver/app_driver.h" | 5 #include "mash/app_driver/app_driver.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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void AppDriver::OnStart(const shell::Identity& identity) { | 90 void AppDriver::OnStart(const shell::Identity& identity) { |
91 AddAccelerators(); | 91 AddAccelerators(); |
92 } | 92 } |
93 | 93 |
94 bool AppDriver::OnConnect(shell::Connection* connection) { | 94 bool AppDriver::OnConnect(shell::Connection* connection) { |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 bool AppDriver::OnStop() { | 98 bool AppDriver::OnStop() { |
99 // Prevent the code in AddAccelerators() from keeping this app alive. | 99 // Prevent the code in AddAccelerators() from keeping this app alive. |
100 binding_.set_connection_error_handler(base::Bind(&DoNothing)); | 100 if (binding_.is_bound()) |
| 101 binding_.set_connection_error_handler(base::Bind(&DoNothing)); |
101 return true; | 102 return true; |
102 } | 103 } |
103 | 104 |
104 void AppDriver::OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) { | 105 void AppDriver::OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) { |
105 struct LaunchOptions { | 106 struct LaunchOptions { |
106 uint32_t option; | 107 uint32_t option; |
107 const char* app; | 108 const char* app; |
108 LaunchMode mode; | 109 LaunchMode mode; |
109 }; | 110 }; |
110 | 111 |
(...skipping 20 matching lines...) Expand all Loading... |
131 | 132 |
132 void AppDriver::AddAccelerators() { | 133 void AppDriver::AddAccelerators() { |
133 connector()->ConnectToInterface("mojo:catalog", &catalog_); | 134 connector()->ConnectToInterface("mojo:catalog", &catalog_); |
134 catalog_->GetEntriesProvidingClass( | 135 catalog_->GetEntriesProvidingClass( |
135 "mus:window_manager", base::Bind(&AppDriver::OnAvailableCatalogEntries, | 136 "mus:window_manager", base::Bind(&AppDriver::OnAvailableCatalogEntries, |
136 weak_factory_.GetWeakPtr())); | 137 weak_factory_.GetWeakPtr())); |
137 } | 138 } |
138 | 139 |
139 } // namespace app_driver | 140 } // namespace app_driver |
140 } // namespace mash | 141 } // namespace mash |
OLD | NEW |