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 "components/arc/arc_bridge_service_impl.h" | 5 #include "components/arc/arc_bridge_service_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 ScaleFactor scale_factor) { | 153 ScaleFactor scale_factor) { |
154 DCHECK(CalledOnValidThread()); | 154 DCHECK(CalledOnValidThread()); |
155 if (state() != State::READY) { | 155 if (state() != State::READY) { |
156 LOG(ERROR) << "Called RequestAppIcon when the service is not ready"; | 156 LOG(ERROR) << "Called RequestAppIcon when the service is not ready"; |
157 return false; | 157 return false; |
158 } | 158 } |
159 instance_ptr_->RequestAppIcon(package, activity, scale_factor); | 159 instance_ptr_->RequestAppIcon(package, activity, scale_factor); |
160 return true; | 160 return true; |
161 } | 161 } |
162 | 162 |
| 163 bool ArcBridgeServiceImpl::SendClipboardContentToAndroid( |
| 164 const std::string& text) { |
| 165 DCHECK(CalledOnValidThread()); |
| 166 if (state() != State::READY) { |
| 167 LOG(ERROR) << "Called SendClipboardContentToAndroid when the service is" |
| 168 << " not ready"; |
| 169 return false; |
| 170 } |
| 171 |
| 172 instance_ptr_->SendClipboardContentToAndroid(text); |
| 173 return true; |
| 174 } |
| 175 |
163 void ArcBridgeServiceImpl::OnInstanceBootPhase(InstanceBootPhase phase) { | 176 void ArcBridgeServiceImpl::OnInstanceBootPhase(InstanceBootPhase phase) { |
164 DCHECK(CalledOnValidThread()); | 177 DCHECK(CalledOnValidThread()); |
165 // The state can be CONNECTED the first time this is called, and will then | 178 // The state can be CONNECTED the first time this is called, and will then |
166 // transition to READY after BRIDGE_READY has been passed. | 179 // transition to READY after BRIDGE_READY has been passed. |
167 if (state() != State::CONNECTED && state() != State::READY) { | 180 if (state() != State::CONNECTED && state() != State::READY) { |
168 VLOG(1) << "StopInstance() called while connecting"; | 181 VLOG(1) << "StopInstance() called while connecting"; |
169 return; | 182 return; |
170 } | 183 } |
171 if (phase == INSTANCE_BOOT_PHASE_BRIDGE_READY) { | 184 if (phase == INSTANCE_BOOT_PHASE_BRIDGE_READY) { |
172 SetState(State::READY); | 185 SetState(State::READY); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // TODO(ejcaruso): Implement. | 221 // TODO(ejcaruso): Implement. |
209 VLOG(1) << "OnAcquireDisplayWakeLock"; | 222 VLOG(1) << "OnAcquireDisplayWakeLock"; |
210 } | 223 } |
211 | 224 |
212 void ArcBridgeServiceImpl::OnReleaseDisplayWakeLock(DisplayWakeLockType type) { | 225 void ArcBridgeServiceImpl::OnReleaseDisplayWakeLock(DisplayWakeLockType type) { |
213 DCHECK(CalledOnValidThread()); | 226 DCHECK(CalledOnValidThread()); |
214 // TODO(ejcaruso): Implement. | 227 // TODO(ejcaruso): Implement. |
215 VLOG(1) << "OnReleaseDisplayWakeLock"; | 228 VLOG(1) << "OnReleaseDisplayWakeLock"; |
216 } | 229 } |
217 | 230 |
| 231 void ArcBridgeServiceImpl::OnSetClipboardContent(const mojo::String& text) { |
| 232 DCHECK(CalledOnValidThread()); |
| 233 FOR_EACH_OBSERVER(ClipboardObserver, clipboard_observer_list(), |
| 234 OnSetClipboardContent(text)); |
| 235 } |
| 236 |
| 237 void ArcBridgeServiceImpl::OnGetClipboardContent() { |
| 238 DCHECK(CalledOnValidThread()); |
| 239 FOR_EACH_OBSERVER(ClipboardObserver, clipboard_observer_list(), |
| 240 OnGetClipboardContent()); |
| 241 } |
| 242 |
218 void ArcBridgeServiceImpl::OnArcAvailable(bool arc_available) { | 243 void ArcBridgeServiceImpl::OnArcAvailable(bool arc_available) { |
219 DCHECK(CalledOnValidThread()); | 244 DCHECK(CalledOnValidThread()); |
220 if (available() == arc_available) | 245 if (available() == arc_available) |
221 return; | 246 return; |
222 SetAvailable(arc_available); | 247 SetAvailable(arc_available); |
223 PrerequisitesChanged(); | 248 PrerequisitesChanged(); |
224 } | 249 } |
225 | 250 |
226 void ArcBridgeServiceImpl::OnConnectionEstablished( | 251 void ArcBridgeServiceImpl::OnConnectionEstablished( |
227 ArcBridgeInstancePtr instance) { | 252 ArcBridgeInstancePtr instance) { |
(...skipping 11 matching lines...) Expand all Loading... |
239 | 264 |
240 SetState(State::CONNECTED); | 265 SetState(State::CONNECTED); |
241 } | 266 } |
242 | 267 |
243 void ArcBridgeServiceImpl::OnStopped() { | 268 void ArcBridgeServiceImpl::OnStopped() { |
244 DCHECK(CalledOnValidThread()); | 269 DCHECK(CalledOnValidThread()); |
245 SetState(State::STOPPED); | 270 SetState(State::STOPPED); |
246 } | 271 } |
247 | 272 |
248 } // namespace arc | 273 } // namespace arc |
OLD | NEW |