Index: chrome/browser/android/offline_pages/offline_page_bridge.cc |
diff --git a/chrome/browser/android/offline_pages/offline_page_bridge.cc b/chrome/browser/android/offline_pages/offline_page_bridge.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c2f9d426058ca97e73ed27b99ec7dcd46258e7f5 |
--- /dev/null |
+++ b/chrome/browser/android/offline_pages/offline_page_bridge.cc |
@@ -0,0 +1,37 @@ |
+// Copyright 2015 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. |
+ |
+#include "chrome/browser/android/offline_pages/offline_page_bridge.h" |
+ |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/profiles/profile_android.h" |
+#include "components/offline_pages/offline_page_model.h" |
+#include "jni/OfflinePageBridge_jni.h" |
+ |
+namespace offline_pages { |
+namespace android { |
+ |
+OfflinePageBridge::OfflinePageBridge(JNIEnv* env, jobject obj, Profile* profile) |
+ : weak_java_ref_(env, obj), |
+ offline_page_model_(nullptr), |
+ profile_(profile) { |
+ // TODO(fgorski): Pull offline pages model from the factory once it is |
+ // available. |
+} |
+ |
+void OfflinePageBridge::Destroy(JNIEnv*, jobject) { |
+ delete this; |
+} |
+ |
+static jlong Init(JNIEnv* env, jobject obj, jobject j_profile) { |
+ return reinterpret_cast<jlong>(new OfflinePageBridge( |
+ env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); |
+} |
+ |
+bool RegisterOfflinePageBridge(JNIEnv* env) { |
+ return RegisterNativesImpl(env); |
+} |
+ |
+} // namespace android |
+} // namespace offline_pages |