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

Side by Side Diff: base/android/application_status_listener.h

Issue 659493003: Final step of the java_cpp_template -> java_cpp_enum migration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete some more template files Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_ 5 #ifndef BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_
6 #define BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_ 6 #define BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/base_export.h" 11 #include "base/base_export.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/observer_list_threadsafe.h" 15 #include "base/observer_list_threadsafe.h"
16 16
17 namespace base { 17 namespace base {
18 namespace android { 18 namespace android {
19 19
20 // Define application state values like APPLICATION_STATE_VISIBLE in a 20 // Define application state values like APPLICATION_STATE_VISIBLE in a
21 // way that ensures they're always the same than their Java counterpart. 21 // way that ensures they're always the same than their Java counterpart.
22 //
23 // Note that these states represent the most visible Activity state.
24 // If there are activities with states paused and stopped, only
25 // HAS_PAUSED_ACTIVITIES should be returned.
26 //
27 // A Java counterpart will be generated for this enum.
28 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.base
22 enum ApplicationState { 29 enum ApplicationState {
23 #define DEFINE_APPLICATION_STATE(x, y) APPLICATION_STATE_##x = y, 30 APPLICATION_STATE_HAS_RUNNING_ACTIVITIES = 1,
24 #include "base/android/application_state_list.h" 31 APPLICATION_STATE_HAS_PAUSED_ACTIVITIES = 2,
25 #undef DEFINE_APPLICATION_STATE 32 APPLICATION_STATE_HAS_STOPPED_ACTIVITIES = 3,
33 APPLICATION_STATE_HAS_DESTROYED_ACTIVITIES = 4
26 }; 34 };
27 35
28 // A native helper class to listen to state changes of the Android 36 // A native helper class to listen to state changes of the Android
29 // Application. This mirrors org.chromium.base.ApplicationStatus. 37 // Application. This mirrors org.chromium.base.ApplicationStatus.
30 // any thread. 38 // any thread.
31 // 39 //
32 // To start listening, create a new instance, passing a callback to a 40 // To start listening, create a new instance, passing a callback to a
33 // function that takes an ApplicationState parameter. To stop listening, 41 // function that takes an ApplicationState parameter. To stop listening,
34 // simply delete the listener object. The implementation guarantees 42 // simply delete the listener object. The implementation guarantees
35 // that the callback will always be called on the thread that created 43 // that the callback will always be called on the thread that created
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 78
71 ApplicationStateChangeCallback callback_; 79 ApplicationStateChangeCallback callback_;
72 80
73 DISALLOW_COPY_AND_ASSIGN(ApplicationStatusListener); 81 DISALLOW_COPY_AND_ASSIGN(ApplicationStatusListener);
74 }; 82 };
75 83
76 } // namespace android 84 } // namespace android
77 } // namespace base 85 } // namespace base
78 86
79 #endif // BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_ 87 #endif // BASE_ANDROID_APPLICATION_STATUS_LISTENER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698