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

Unified Diff: chrome/browser/android/offline_pages/cct_request_observer.h

Issue 2888273003: [Offline Pages] Add an observer for requests in the CCT namespace. (Closed)
Patch Set: comments. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/app_hooks.cc ('k') | chrome/browser/android/offline_pages/cct_request_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/cct_request_observer.h
diff --git a/chrome/browser/android/offline_pages/cct_request_observer.h b/chrome/browser/android/offline_pages/cct_request_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..dbe22bbea1dcb6f02900c770b4ef3f0b8f6b8270
--- /dev/null
+++ b/chrome/browser/android/offline_pages/cct_request_observer.h
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_CCT_REQUEST_OBSERVER_H_
+#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_CCT_REQUEST_OBSERVER_H_
+
+#include <stdint.h>
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_weak_ref.h"
+#include "base/macros.h"
+#include "base/supports_user_data.h"
+#include "components/offline_pages/core/downloads/download_ui_adapter.h"
+
+namespace offline_pages {
+
+/**
+ * Bridge between C++ and Java for exposing when CCT offlining requests
+ * complete.
+ */
+class CCTRequestObserver : public RequestCoordinator::Observer,
+ public base::SupportsUserData::Data {
+ public:
+ static void AttachToRequestCoordinator(RequestCoordinator* coordinator);
+ ~CCTRequestObserver() override;
+
+ // RequestCoordinator::Observer implementation.
+ void OnAdded(const SavePageRequest& request) override;
+ void OnCompleted(const SavePageRequest& request,
+ RequestNotifier::BackgroundSavePageResult status) override;
+ void OnChanged(const SavePageRequest& request) override;
+ void OnNetworkProgress(const SavePageRequest& request,
+ int64_t received_bytes) override;
+
+ private:
+ explicit CCTRequestObserver(
+ base::android::ScopedJavaLocalRef<jobject> callback);
+
+ base::android::ScopedJavaGlobalRef<jobject> j_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(CCTRequestObserver);
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_CCT_REQUEST_OBSERVER_H_
« no previous file with comments | « chrome/browser/android/app_hooks.cc ('k') | chrome/browser/android/offline_pages/cct_request_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698