OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_CCT_REQUEST_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_CCT_REQUEST_OBSERVER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/jni_weak_ref.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/supports_user_data.h" |
| 14 #include "components/offline_pages/core/downloads/download_ui_adapter.h" |
| 15 |
| 16 namespace offline_pages { |
| 17 |
| 18 /** |
| 19 * Bridge between C++ and Java for exposing when CCT offlining requests |
| 20 * complete. |
| 21 */ |
| 22 class CCTRequestObserver : public RequestCoordinator::Observer, |
| 23 public base::SupportsUserData::Data { |
| 24 public: |
| 25 static void AttachToRequestCoordinator(RequestCoordinator* coordinator); |
| 26 ~CCTRequestObserver() override; |
| 27 |
| 28 // RequestCoordinator::Observer implementation. |
| 29 void OnAdded(const SavePageRequest& request) override; |
| 30 void OnCompleted(const SavePageRequest& request, |
| 31 RequestNotifier::BackgroundSavePageResult status) override; |
| 32 void OnChanged(const SavePageRequest& request) override; |
| 33 void OnNetworkProgress(const SavePageRequest& request, |
| 34 int64_t received_bytes) override; |
| 35 |
| 36 private: |
| 37 explicit CCTRequestObserver( |
| 38 base::android::ScopedJavaLocalRef<jobject> callback); |
| 39 |
| 40 base::android::ScopedJavaGlobalRef<jobject> j_callback_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(CCTRequestObserver); |
| 43 }; |
| 44 |
| 45 } // namespace offline_pages |
| 46 |
| 47 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_CCT_REQUEST_OBSERVER_H_ |
OLD | NEW |