提交 427f1625 编写于 作者: A Adam Barth

mv //sky/services/intents //sky/services/activity

This interface is growing to expose many activity-related functions, more than
just intents.

R=eseidel@chromium.org, eseidel@google.com

Review URL: https://codereview.chromium.org/1223053002 .
上级 c1c92246
......@@ -30,7 +30,7 @@ group("sky_apk") {
]
if (is_android) {
deps += [ "//sky/services/intents" ]
deps += [ "//sky/services/activity" ]
}
if (is_linux) {
......
......@@ -21,8 +21,8 @@ android_library("java") {
"//mojo/services/sensors/public/interfaces:interfaces_java",
"//services/keyboard",
"//services/sensors:sensors_lib",
"//sky/services/intents:intents_lib",
"//sky/services/intents:interfaces_java",
"//sky/services/activity:activity_lib",
"//sky/services/activity:interfaces_java",
"//sky/services/media:media_lib",
"//sky/services/media:interfaces_java",
"//sky/shell:java",
......
......@@ -10,11 +10,11 @@ import org.chromium.mojo.keyboard.KeyboardServiceImpl;
import org.chromium.mojo.sensors.SensorServiceImpl;
import org.chromium.mojo.system.Core;
import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojom.intents.ActivityManager;
import org.chromium.mojom.activity.Activity;
import org.chromium.mojom.keyboard.KeyboardService;
import org.chromium.mojom.media.MediaService;
import org.chromium.mojom.sensors.SensorService;
import org.domokit.intents.ActivityManagerImpl;
import org.domokit.activity.ActivityImpl;
import org.domokit.media.MediaServiceImpl;
import org.domokit.sky.shell.ResourceExtractor;
import org.domokit.sky.shell.ServiceFactory;
......@@ -56,10 +56,10 @@ public class SkyDemoApplication extends SkyApplication {
}
});
registry.register(ActivityManager.MANAGER.getName(), new ServiceFactory() {
registry.register(Activity.MANAGER.getName(), new ServiceFactory() {
@Override
public void connectToService(Context context, Core core, MessagePipeHandle pipe) {
ActivityManager.MANAGER.bind(new ActivityManagerImpl(), pipe);
Activity.MANAGER.bind(new ActivityImpl(), pipe);
}
});
......
......@@ -3,32 +3,33 @@
// found in the LICENSE file.
import 'dart:sky';
import 'package:mojom/intents/intents.mojom.dart';
import 'package:mojom/activity/activity.mojom.dart';
import 'package:sky/mojo/shell.dart' as shell;
export 'package:mojom/intents/intents.mojom.dart' show Intent, ComponentName, StringExtra;
export 'package:mojom/activity/activity.mojom.dart' show Intent, ComponentName, StringExtra;
const int NEW_DOCUMENT = 0x00080000;
const int NEW_TASK = 0x10000000;
const int MULTIPLE_TASK = 0x08000000;
ActivityManagerProxy _initActivityManager() {
ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound();
shell.requestService('mojo:sky_viewer', activityManager);
return activityManager;
ActivityProxy _initActivity() {
ActivityProxy activity = new ActivityProxy.unbound();
shell.requestService('mojo:sky_viewer', activity);
return activity;
}
final ActivityManagerProxy _activityManager = _initActivityManager();
final ActivityProxy _activity = _initActivity();
Color _cachedPrimaryColor;
String _cachedLabel;
void finishCurrentActivity() {
_activityManager.ptr.finishCurrentActivity();
_activity.ptr.finishCurrentActivity();
}
void startActivity(Intent intent) {
_activityManager.ptr.startActivity(intent);
_activity.ptr.startActivity(intent);
}
void updateTaskDescription(String label, Color color) {
......@@ -42,5 +43,5 @@ void updateTaskDescription(String label, Color color) {
..label = label
..primaryColor = (color != null ? color.value : null);
_activityManager.ptr.setTaskDescription(description);
_activity.ptr.setTaskDescription(description);
}
......@@ -4,7 +4,7 @@
import("//mojo/public/tools/bindings/mojom.gni")
group("intents") {
group("activity") {
testonly = true
deps = [
......@@ -12,7 +12,7 @@ group("intents") {
]
if (is_android) {
deps += [ ":intents_lib" ]
deps += [ ":activity_lib" ]
}
}
......@@ -20,8 +20,8 @@ if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
android_library("intents_lib") {
java_files = [ "src/org/domokit/intents/ActivityManagerImpl.java" ]
android_library("activity_lib") {
java_files = [ "src/org/domokit/activity/ActivityImpl.java" ]
deps = [
"//base:base_java",
......@@ -34,6 +34,6 @@ if (is_android) {
mojom("interfaces") {
sources = [
"intents.mojom",
"activity.mojom",
]
}
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module intents;
module activity;
struct StringExtra {
string name;
......@@ -31,7 +31,7 @@ struct TaskDescription {
// have a higher-level abstraction here? Do we want a collection
// of services that only work on specific platforms? We need to
// figure out how to rationalize this interface across platforms.
interface ActivityManager {
interface Activity {
startActivity(Intent intent);
finishCurrentActivity();
setTaskDescription(TaskDescription description);
......
......@@ -2,30 +2,30 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.domokit.intents;
package org.domokit.activity;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.net.Uri;
import android.util.Log;
import org.chromium.mojo.system.MojoException;
import org.chromium.mojom.intents.ActivityManager;
import org.chromium.mojom.intents.ComponentName;
import org.chromium.mojom.intents.Intent;
import org.chromium.mojom.intents.StringExtra;
import org.chromium.mojom.activity.Activity;
import org.chromium.mojom.activity.ComponentName;
import org.chromium.mojom.activity.Intent;
import org.chromium.mojom.activity.StringExtra;
import org.chromium.mojom.activity.TaskDescription;
/**
* Android implementation of ActivityManager.
* Android implementation of Activity.
*/
public class ActivityManagerImpl implements ActivityManager {
private static final String TAG = "ActivityManagerImpl";
private static Activity sCurrentActivity;
public class ActivityImpl implements Activity {
private static final String TAG = "ActivityImpl";
private static android.app.Activity sCurrentActivity;
public ActivityManagerImpl() {
public ActivityImpl() {
}
public static void setCurrentActivity(Activity activity) {
public static void setCurrentActivity(android.app.Activity activity) {
sCurrentActivity = activity;
}
......@@ -79,8 +79,7 @@ public class ActivityManagerImpl implements ActivityManager {
}
@Override
public void setTaskDescription(
org.chromium.mojom.intents.TaskDescription description) {
public void setTaskDescription(TaskDescription description) {
if (sCurrentActivity == null) {
return;
}
......
......@@ -115,11 +115,13 @@ if (is_android) {
"//mojo/public/interfaces/application:application_java",
"//mojo/public/java:bindings",
"//mojo/public/java:system",
"//mojo/services/keyboard/public/interfaces:interfaces_java",
"//mojo/services/network/public/interfaces:interfaces_java",
"//services/keyboard",
"//sky/services/activity:activity_lib",
"//sky/services/activity:interfaces_java",
"//sky/services/engine:engine_java",
"//sky/services/oknet",
"//sky/services/intents:intents_lib",
]
}
......
......@@ -12,7 +12,7 @@ import android.view.WindowManager;
import org.chromium.base.PathUtils;
import org.domokit.intents.ActivityManagerImpl;
import org.domokit.activity.ActivityImpl;
import java.io.File;
......@@ -44,7 +44,7 @@ public class SkyActivity extends Activity {
SkyMain.ensureInitialized(getApplicationContext());
mView = new PlatformViewAndroid(this, edgeDims);
ActivityManagerImpl.setCurrentActivity(this);
ActivityImpl.setCurrentActivity(this);
setContentView(mView);
mTracingController = new TracingController(this);
......
......@@ -52,7 +52,7 @@ mojo_native_application("viewer") {
"//skia",
"//sky/engine",
"//sky/engine/tonic",
"//sky/services/intents:interfaces",
"//sky/services/activity:interfaces",
"//sky/services/platform",
"//sky/services/testing",
"//sky/shell/dart",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册