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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 base::Bind(&AppDriver::AddAccelerators, weak_factory_.GetWeakPtr())); | 78 base::Bind(&AppDriver::AddAccelerators, weak_factory_.GetWeakPtr())); |
79 | 79 |
80 for (const AcceleratorSpec& spec : g_spec) { | 80 for (const AcceleratorSpec& spec : g_spec) { |
81 registrar->AddAccelerator( | 81 registrar->AddAccelerator( |
82 static_cast<uint32_t>(spec.id), | 82 static_cast<uint32_t>(spec.id), |
83 ui::CreateKeyMatcher(spec.keyboard_code, spec.event_flags), | 83 ui::CreateKeyMatcher(spec.keyboard_code, spec.event_flags), |
84 base::Bind(&AssertTrue)); | 84 base::Bind(&AssertTrue)); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 void AppDriver::Initialize(shell::Connector* connector, | 88 void AppDriver::OnStart(shell::Connector* connector, |
89 const shell::Identity& identity, | 89 const shell::Identity& identity, |
90 uint32_t id) { | 90 uint32_t id) { |
91 connector_ = connector; | 91 connector_ = connector; |
92 AddAccelerators(); | 92 AddAccelerators(); |
93 } | 93 } |
94 | 94 |
95 bool AppDriver::AcceptConnection(shell::Connection* connection) { | 95 bool AppDriver::OnConnect(shell::Connection* connection) { |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 bool AppDriver::ShellConnectionLost() { | 99 bool AppDriver::OnStop() { |
100 // Prevent the code in AddAccelerators() from keeping this app alive. | 100 // Prevent the code in AddAccelerators() from keeping this app alive. |
101 binding_.set_connection_error_handler(base::Bind(&DoNothing)); | 101 binding_.set_connection_error_handler(base::Bind(&DoNothing)); |
102 return true; | 102 return true; |
103 } | 103 } |
104 | 104 |
105 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) { |
106 struct LaunchOptions { | 106 struct LaunchOptions { |
107 uint32_t option; | 107 uint32_t option; |
108 const char* app; | 108 const char* app; |
109 LaunchMode mode; | 109 LaunchMode mode; |
(...skipping 20 matching lines...) Expand all Loading... |
130 | 130 |
131 void AppDriver::AddAccelerators() { | 131 void AppDriver::AddAccelerators() { |
132 connector_->ConnectToInterface("mojo:catalog", &catalog_); | 132 connector_->ConnectToInterface("mojo:catalog", &catalog_); |
133 catalog_->GetEntriesProvidingClass( | 133 catalog_->GetEntriesProvidingClass( |
134 "mus:window_manager", base::Bind(&AppDriver::OnAvailableCatalogEntries, | 134 "mus:window_manager", base::Bind(&AppDriver::OnAvailableCatalogEntries, |
135 weak_factory_.GetWeakPtr())); | 135 weak_factory_.GetWeakPtr())); |
136 } | 136 } |
137 | 137 |
138 } // namespace app_driver | 138 } // namespace app_driver |
139 } // namespace mash | 139 } // namespace mash |
OLD | NEW |