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

Unified Diff: runtime/embedders/openglui/emulator/emulator_embedder.cc

Issue 12340036: Android improvements: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
Index: runtime/embedders/openglui/emulator/emulator_embedder.cc
===================================================================
--- runtime/embedders/openglui/emulator/emulator_embedder.cc (revision 18917)
+++ runtime/embedders/openglui/emulator/emulator_embedder.cc (working copy)
@@ -11,6 +11,7 @@
#include "embedders/openglui/common/dart_host.h"
#include "embedders/openglui/common/events.h"
#include "embedders/openglui/common/input_handler.h"
+#include "embedders/openglui/common/log.h"
#include "embedders/openglui/common/sound_handler.h"
#include "embedders/openglui/common/vm_glue.h"
#include "embedders/openglui/emulator/emulator_graphics_handler.h"
@@ -55,7 +56,24 @@
input_handler_ptr->OnKeyEvent(kKeyDown, time(0), 0, key, 0, 0);
input_handler_ptr->OnKeyEvent(kKeyUp, time(0), 0, key, 0, 0);
if (key == 27) {
+ lifecycle_handler_ptr->Pause();
+ lifecycle_handler_ptr->Deactivate();
+ lifecycle_handler_ptr->FreeAllResources();
exit(0);
+ } else if (key == '0') {
+ LOGI("Simulating suspend");
+ lifecycle_handler_ptr->Pause();
+ lifecycle_handler_ptr->Deactivate();
+ } else if (key == '1') {
+ LOGI("Simulating resume");
+ lifecycle_handler_ptr->Activate();
+ lifecycle_handler_ptr->Resume();
+ } else if (key == '+') {
+ LOGI("Simulating focus gain");
+ lifecycle_handler_ptr->Resume();
+ } else if (key == '-') {
+ LOGI("Simulating focus loss");
+ lifecycle_handler_ptr->Pause();
}
}
@@ -84,7 +102,9 @@
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
- lifecycle_handler_ptr->OnActivate();
+ lifecycle_handler_ptr->OnStart();
+ lifecycle_handler_ptr->Activate();
+ lifecycle_handler_ptr->Resume();
gettimeofday(&tvStart, NULL);
glutTimerFunc(1, tick, 0);
glutMainLoop();

Powered by Google App Engine
This is Rietveld 408576698