| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ACTIVITY_STATUS_H_ | 5 #ifndef BASE_ANDROID_ACTIVITY_STATUS_H_ |
| 6 #define BASE_ANDROID_ACTIVITY_STATUS_H_ | 6 #define BASE_ANDROID_ACTIVITY_STATUS_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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // | 42 // |
| 43 // // Start listening. | 43 // // Start listening. |
| 44 // ActivityStatus::Listener* my_listener = | 44 // ActivityStatus::Listener* my_listener = |
| 45 // new ActivityStatus::Listener(base::Bind(&OnActivityStateChange)); | 45 // new ActivityStatus::Listener(base::Bind(&OnActivityStateChange)); |
| 46 // | 46 // |
| 47 // ... | 47 // ... |
| 48 // | 48 // |
| 49 // // Stop listening. | 49 // // Stop listening. |
| 50 // delete my_listener | 50 // delete my_listener |
| 51 // | 51 // |
| 52 BASE_EXPORT class ActivityStatus { | 52 class BASE_EXPORT ActivityStatus { |
| 53 public: | 53 public: |
| 54 typedef base::Callback<void(ActivityState)> StateChangeCallback; | 54 typedef base::Callback<void(ActivityState)> StateChangeCallback; |
| 55 | 55 |
| 56 class Listener { | 56 class Listener { |
| 57 public: | 57 public: |
| 58 explicit Listener(const StateChangeCallback& callback); | 58 explicit Listener(const StateChangeCallback& callback); |
| 59 ~Listener(); | 59 ~Listener(); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 friend class ActivityStatus; | 62 friend class ActivityStatus; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 88 | 88 |
| 89 scoped_refptr<ObserverListThreadSafe<Listener> > observers_; | 89 scoped_refptr<ObserverListThreadSafe<Listener> > observers_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(ActivityStatus); | 91 DISALLOW_COPY_AND_ASSIGN(ActivityStatus); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace android | 94 } // namespace android |
| 95 } // namespace base | 95 } // namespace base |
| 96 | 96 |
| 97 #endif // BASE_ANDROID_ACTIVITY_STATUS_H_ | 97 #endif // BASE_ANDROID_ACTIVITY_STATUS_H_ |
| OLD | NEW |