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

Unified Diff: sky/shell/android/org/domokit/sky/shell/SkyActivity.java

Issue 1230073002: Teach SkyShell.apk to stop posting frames when not visible (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months 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
« no previous file with comments | « sky/shell/android/org/domokit/sky/shell/PlatformViewAndroid.java ('k') | sky/shell/ui/animator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/android/org/domokit/sky/shell/SkyActivity.java
diff --git a/sky/shell/android/org/domokit/sky/shell/SkyActivity.java b/sky/shell/android/org/domokit/sky/shell/SkyActivity.java
index c29e4647e737dbedce9b2715052d5b34e5c40f70..72b33334b73f5ae366e9d53db1036817eedee8fb 100644
--- a/sky/shell/android/org/domokit/sky/shell/SkyActivity.java
+++ b/sky/shell/android/org/domokit/sky/shell/SkyActivity.java
@@ -11,6 +11,8 @@ import android.view.View;
import android.view.WindowManager;
import org.chromium.base.PathUtils;
+import org.chromium.mojom.sky.EventType;
+import org.chromium.mojom.sky.InputEvent;
import org.domokit.activity.ActivityImpl;
@@ -64,7 +66,9 @@ public class SkyActivity extends Activity {
@Override
public void onBackPressed() {
if (mView != null) {
- mView.onBackPressed();
+ InputEvent event = new InputEvent();
+ event.type = EventType.BACK;
+ mView.getEngine().onInputEvent(event);
// TODO(abarth): We should have some way to trigger the default
// back behavior.
abarth-chromium 2015/07/09 23:45:23 We can delete this comment now.
return;
@@ -72,6 +76,22 @@ public class SkyActivity extends Activity {
super.onBackPressed();
}
+ @Override
+ protected void onPause() {
+ super.onPause();
+ if (mView != null) {
+ mView.getEngine().onActivityPaused();
+ }
+ }
+
+ @Override
+ protected void onPostResume() {
+ super.onPostResume();
+ if (mView != null) {
+ mView.getEngine().onActivityResumed();
+ }
+ }
+
/**
* Override this function to customize startup behavior.
*/
@@ -79,18 +99,18 @@ public class SkyActivity extends Activity {
File dataDir = new File(PathUtils.getDataDirectory(this));
File snapshot = new File(dataDir, SkyApplication.SNAPSHOT);
if (snapshot.exists()) {
- mView.loadSnapshot(snapshot.getPath());
+ mView.getEngine().runFromSnapshot(snapshot.getPath());
return;
}
File appBundle = new File(dataDir, SkyApplication.APP_BUNDLE);
if (appBundle.exists()) {
- mView.loadBundle(appBundle.getPath());
+ mView.getEngine().runFromBundle(appBundle.getPath());
return;
}
}
public void loadUrl(String url) {
- mView.loadUrl(url);
+ mView.getEngine().runFromNetwork(url);
}
public boolean loadBundleByName(String name) {
@@ -99,7 +119,7 @@ public class SkyActivity extends Activity {
if (!bundle.exists()) {
return false;
}
- mView.loadBundle(bundle.getPath());
+ mView.getEngine().runFromBundle(bundle.getPath());
return true;
}
}
« no previous file with comments | « sky/shell/android/org/domokit/sky/shell/PlatformViewAndroid.java ('k') | sky/shell/ui/animator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698