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

Unified Diff: base/android/activity_status.h

Issue 159173002: Refactor ActivityStatus to not store current activity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Comments Created 6 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: base/android/activity_status.h
diff --git a/base/android/activity_status.h b/base/android/activity_status.h
index 7975a789cd09d0fff73378dceebbdf15b7229943..4f058219bfce86d3461a7f8ce1a164b49e26a3f4 100644
--- a/base/android/activity_status.h
+++ b/base/android/activity_status.h
@@ -17,33 +17,33 @@
namespace base {
namespace android {
-// Define activity state values like ACTIVITY_STATE_CREATED in a
+// Define activity state values like APPLICATION_STATE_VISIBLE in a
// way that ensures they're always the same than their Java counterpart.
-enum ActivityState {
-#define DEFINE_ACTIVITY_STATE(x, y) ACTIVITY_STATE_##x = y,
-#include "base/android/activity_state_list.h"
-#undef DEFINE_ACTIVITY_STATE
+enum ApplicationState {
+#define DEFINE_APPLICATION_STATE(x, y) APPLICATION_STATE_##x = y,
+#include "base/android/application_state_list.h"
+#undef DEFINE_APPLICATION_STATE
};
-// A native helper class to listen to state changes of the current
-// Android Activity. This mirrors org.chromium.base.ActivityStatus.
+// A native helper class to listen to state changes of the Android
+// Application. This mirrors org.chromium.base.ActivityStatus.
// any thread.
//
// To start listening, create a new instance, passing a callback to a
-// function that takes an ActivityState parameter. To stop listening,
+// function that takes two boolean parameters. To stop listening,
// simply delete the listener object. The implementation guarantees
// that the callback will always be called on the thread that created
// the listener.
//
// Example:
//
-// void OnActivityStateChange(ActivityState state) {
+// void OnApplicationStateChange(bool foreground, bool active) {
Ted C 2014/02/13 04:38:44 update since it's no longer two booleans same in
David Trainor- moved to gerrit 2014/02/14 19:13:36 Done.
// ...
// }
//
// // Start listening.
// ActivityStatus::Listener* my_listener =
-// new ActivityStatus::Listener(base::Bind(&OnActivityStateChange));
+// new ActivityStatus::Listener(base::Bind(&OnApplicationStateChange));
//
// ...
//
@@ -52,19 +52,19 @@ enum ActivityState {
//
class BASE_EXPORT ActivityStatus {
Ted C 2014/02/13 04:38:44 This should probably be called ApplicationStatus,
bulach 2014/02/13 11:17:48 yes, ApplicationStatus please :) imho, either: - k
public:
- typedef base::Callback<void(ActivityState)> StateChangeCallback;
+ typedef base::Callback<void(ApplicationState)> ApplicationStateChangeCallback;
class Listener {
public:
- explicit Listener(const StateChangeCallback& callback);
+ explicit Listener(const ApplicationStateChangeCallback& callback);
~Listener();
private:
friend class ActivityStatus;
- void Notify(ActivityState state);
+ void Notify(ApplicationState state);
- StateChangeCallback callback_;
+ ApplicationStateChangeCallback callback_;
DISALLOW_COPY_AND_ASSIGN(Listener);
};
@@ -76,7 +76,7 @@ class BASE_EXPORT ActivityStatus {
static bool RegisterBindings(JNIEnv* env);
// Internal use only: must be public to be called from JNI and unit tests.
- void OnActivityStateChange(ActivityState new_state);
+ void OnApplicationStateChange(ApplicationState state);
private:
friend struct DefaultSingletonTraits<ActivityStatus>;

Powered by Google App Engine
This is Rietveld 408576698