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

Unified Diff: components/arc/arc_bridge_service_impl.cc

Issue 1475563002: arc-bridge: Implement IPC message for app launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add arc::ScaleFactor enum Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/arc_bridge_service_impl.cc
diff --git a/components/arc/arc_bridge_service_impl.cc b/components/arc/arc_bridge_service_impl.cc
index 1a1c954fefa2993b44ff387ae762c8cc6c9597a2..b5611b7244c9db2002d76e8f2b60eda48d5b424f 100644
--- a/components/arc/arc_bridge_service_impl.cc
+++ b/components/arc/arc_bridge_service_impl.cc
@@ -108,6 +108,38 @@ bool ArcBridgeServiceImpl::RegisterInputDevice(const std::string& name,
name, device_type, base::FileDescriptor(fd.Pass())));
}
+bool ArcBridgeServiceImpl::RefreshAppList() {
+ DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
+ if (state() != State::READY) {
+ LOG(ERROR) << "Called RefreshAppList when the service is not ready";
+ return false;
+ }
+ return ipc_channel_->Send(new ArcInstanceMsg_RefreshApps());
+}
+
+bool ArcBridgeServiceImpl::LaunchApp(const std::string& package,
+ const std::string& activity) {
+ DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
+ if (state() != State::READY) {
+ LOG(ERROR) << "Called LaunchApp when the service is not ready";
+ return false;
+ }
+ return ipc_channel_->Send(new ArcInstanceMsg_LaunchApp(package, activity));
+}
+
+bool ArcBridgeServiceImpl::RequestAppIcon(const std::string& package,
+ const std::string& activity,
+ ScaleFactor scale_factor) {
+ DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
+ if (state() != State::READY) {
+ LOG(ERROR) << "Called RequestAppIcon when the service is not ready";
+ return false;
+ }
+ return ipc_channel_->Send(new ArcInstanceMsg_RequestAppIcon(package,
+ activity,
+ scale_factor));
+}
+
void ArcBridgeServiceImpl::SocketConnect(const base::FilePath& socket_path) {
DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
if (state() != State::STOPPED) {
@@ -226,6 +258,8 @@ bool ArcBridgeServiceImpl::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(ArcBridgeServiceImpl, message)
IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_InstanceBootPhase,
OnInstanceBootPhase)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_AppListRefreshed, OnAppListRefreshed)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_AppIcon, OnAppIcon)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -234,6 +268,23 @@ bool ArcBridgeServiceImpl::OnMessageReceived(const IPC::Message& message) {
return handled;
}
+void ArcBridgeServiceImpl::OnAppListRefreshed(
+ const std::vector<arc::AppInfo>& apps) {
+ DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
+ FOR_EACH_OBSERVER(AppObserver, app_observer_list(), OnAppListRefreshed(apps));
+}
+
+void ArcBridgeServiceImpl::OnAppIcon(
+ const std::string& package,
+ const std::string& activity,
+ ScaleFactor scale_factor,
+ const std::vector<uint8_t>& icon_png_data) {
+ DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
+ FOR_EACH_OBSERVER(AppObserver,
+ app_observer_list(),
+ OnAppIcon(package, activity, scale_factor, icon_png_data));
+}
+
void ArcBridgeServiceImpl::OnArcAvailable(bool arc_available) {
DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
if (available() == arc_available)

Powered by Google App Engine
This is Rietveld 408576698