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 #include "chrome/browser/android/data_usage/external_data_use_observer_bridge.h" | 5 #include "chrome/browser/android/data_usage/external_data_use_observer_bridge.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/android/context_utils.h" | 9 #include "base/android/context_utils.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 io_task_runner_->PostTask( | 165 io_task_runner_->PostTask( |
166 FROM_HERE, base::Bind(&ExternalDataUseObserver::OnReportDataUseDone, | 166 FROM_HERE, base::Bind(&ExternalDataUseObserver::OnReportDataUseDone, |
167 external_data_use_observer_, success)); | 167 external_data_use_observer_, success)); |
168 } | 168 } |
169 | 169 |
170 void ExternalDataUseObserverBridge::OnControlAppInstallStateChange( | 170 void ExternalDataUseObserverBridge::OnControlAppInstallStateChange( |
171 JNIEnv* env, | 171 JNIEnv* env, |
172 jobject obj, | 172 jobject obj, |
173 bool is_control_app_installed) const { | 173 bool is_control_app_installed) const { |
174 DCHECK(thread_checker_.CalledOnValidThread()); | 174 DCHECK(thread_checker_.CalledOnValidThread()); |
175 data_use_tab_model_->OnControlAppInstallStateChange(is_control_app_installed); | 175 if (data_use_tab_model_) { |
| 176 data_use_tab_model_->OnControlAppInstallStateChange( |
| 177 is_control_app_installed); |
| 178 } |
| 179 } |
| 180 |
| 181 void ExternalDataUseObserverBridge::ShouldRegisterAsDataUseObserver( |
| 182 bool should_register) const { |
| 183 DCHECK(thread_checker_.CalledOnValidThread()); |
| 184 io_task_runner_->PostTask( |
| 185 FROM_HERE, |
| 186 base::Bind(&ExternalDataUseObserver::ShouldRegisterAsDataUseObserver, |
| 187 external_data_use_observer_, should_register)); |
176 } | 188 } |
177 | 189 |
178 bool RegisterExternalDataUseObserver(JNIEnv* env) { | 190 bool RegisterExternalDataUseObserver(JNIEnv* env) { |
179 return RegisterNativesImpl(env); | 191 return RegisterNativesImpl(env); |
180 } | 192 } |
181 | 193 |
182 } // namespace android | 194 } // namespace android |
183 | 195 |
184 } // namespace chrome | 196 } // namespace chrome |
OLD | NEW |