| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H_ | 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/android/jni_array.h" | 13 #include "base/android/jni_array.h" |
| 14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 19 #include "net/base/network_change_notifier.h" | 19 #include "net/base/network_change_notifier.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 23 class Time; | 23 class Time; |
| 24 class TimeTicks; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace chrome { | 27 namespace chrome { |
| 27 | 28 |
| 28 namespace android { | 29 namespace android { |
| 29 | 30 |
| 30 class DataUseTabModel; | 31 class DataUseTabModel; |
| 31 class ExternalDataUseObserver; | 32 class ExternalDataUseObserver; |
| 32 | 33 |
| 33 // ExternalDataUseObserverBridge creates and owns a Java listener object | 34 // ExternalDataUseObserverBridge creates and owns a Java listener object |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // reports are submitted to |j_external_data_use_observer_|. | 95 // reports are submitted to |j_external_data_use_observer_|. |
| 95 base::android::ScopedJavaGlobalRef<jobject> j_external_data_use_observer_; | 96 base::android::ScopedJavaGlobalRef<jobject> j_external_data_use_observer_; |
| 96 | 97 |
| 97 // |external_data_use_observer_| owns |this|. |external_data_use_observer_| is | 98 // |external_data_use_observer_| owns |this|. |external_data_use_observer_| is |
| 98 // notified of results from Java code by |this|. | 99 // notified of results from Java code by |this|. |
| 99 base::WeakPtr<ExternalDataUseObserver> external_data_use_observer_; | 100 base::WeakPtr<ExternalDataUseObserver> external_data_use_observer_; |
| 100 | 101 |
| 101 // |data_use_tab_model_| is notified of the matching rules on UI thread. | 102 // |data_use_tab_model_| is notified of the matching rules on UI thread. |
| 102 base::WeakPtr<DataUseTabModel> data_use_tab_model_; | 103 base::WeakPtr<DataUseTabModel> data_use_tab_model_; |
| 103 | 104 |
| 105 // The construction time of |this|. |
| 106 const base::TimeTicks construct_time_; |
| 107 |
| 108 // True if matching rules are fetched for the first time. |
| 109 bool is_first_matching_rule_fetch_; |
| 110 |
| 104 // |io_task_runner_| accesses ExternalDataUseObserver members on IO thread. | 111 // |io_task_runner_| accesses ExternalDataUseObserver members on IO thread. |
| 105 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 112 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 106 | 113 |
| 107 base::ThreadChecker thread_checker_; | 114 base::ThreadChecker thread_checker_; |
| 108 | 115 |
| 109 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserverBridge); | 116 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserverBridge); |
| 110 }; | 117 }; |
| 111 | 118 |
| 112 bool RegisterExternalDataUseObserver(JNIEnv* env); | 119 bool RegisterExternalDataUseObserver(JNIEnv* env); |
| 113 | 120 |
| 114 } // namespace android | 121 } // namespace android |
| 115 | 122 |
| 116 } // namespace chrome | 123 } // namespace chrome |
| 117 | 124 |
| 118 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H
_ | 125 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_BRIDGE_H
_ |
| OLD | NEW |