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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_bridge.cc

Issue 1285313003: [Offline pages] Wiring saving and opening offline page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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/offline_pages/offline_page_bridge.h" 5 #include "chrome/browser/android/offline_pages/offline_page_bridge.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" 9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
10 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 10 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
(...skipping 19 matching lines...) Expand all
30 30
31 namespace { 31 namespace {
32 32
33 void SavePageCallback(ScopedJavaGlobalRef<jobject>* j_callback_obj, 33 void SavePageCallback(ScopedJavaGlobalRef<jobject>* j_callback_obj,
34 const GURL& url, 34 const GURL& url,
35 OfflinePageModel::SavePageResult result) { 35 OfflinePageModel::SavePageResult result) {
36 JNIEnv* env = base::android::AttachCurrentThread(); 36 JNIEnv* env = base::android::AttachCurrentThread();
37 37
38 scoped_ptr<ScopedJavaGlobalRef<jobject>> j_callback_ptr(j_callback_obj); 38 scoped_ptr<ScopedJavaGlobalRef<jobject>> j_callback_ptr(j_callback_obj);
39 39
40 Java_OfflinePageCallback_onSavePageDone( 40 Java_SavePageCallback_onSavePageDone(
41 env, j_callback_ptr->obj(), static_cast<int>(result), 41 env, j_callback_ptr->obj(), static_cast<int>(result),
42 ConvertUTF8ToJavaString(env, url.spec()).obj()); 42 ConvertUTF8ToJavaString(env, url.spec()).obj());
43 } 43 }
44 44
45 void DeletePageCallback(ScopedJavaGlobalRef<jobject>* j_callback_obj, 45 void DeletePageCallback(ScopedJavaGlobalRef<jobject>* j_callback_obj,
46 OfflinePageModel::DeletePageResult result) { 46 OfflinePageModel::DeletePageResult result) {
47 JNIEnv* env = base::android::AttachCurrentThread(); 47 JNIEnv* env = base::android::AttachCurrentThread();
48 48
49 scoped_ptr<ScopedJavaGlobalRef<jobject>> j_callback_ptr(j_callback_obj); 49 scoped_ptr<ScopedJavaGlobalRef<jobject>> j_callback_ptr(j_callback_obj);
50 50
51 Java_OfflinePageCallback_onDeletePageDone( 51 Java_DeletePageCallback_onDeletePageDone(
52 env, j_callback_ptr->obj(), static_cast<int>(result)); 52 env, j_callback_ptr->obj(), static_cast<int>(result));
53 } 53 }
54 54
55 } // namespace 55 } // namespace
56 56
57 static jboolean IsOfflinePagesEnabled(JNIEnv* env, jclass clazz) { 57 static jboolean IsOfflinePagesEnabled(JNIEnv* env, jclass clazz) {
58 return offline_pages::IsOfflinePagesEnabled(); 58 return offline_pages::IsOfflinePagesEnabled();
59 } 59 }
60 60
61 OfflinePageBridge::OfflinePageBridge(JNIEnv* env, 61 OfflinePageBridge::OfflinePageBridge(JNIEnv* env,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return reinterpret_cast<jlong>(new OfflinePageBridge( 175 return reinterpret_cast<jlong>(new OfflinePageBridge(
176 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); 176 env, obj, ProfileAndroid::FromProfileAndroid(j_profile)));
177 } 177 }
178 178
179 bool RegisterOfflinePageBridge(JNIEnv* env) { 179 bool RegisterOfflinePageBridge(JNIEnv* env) {
180 return RegisterNativesImpl(env); 180 return RegisterNativesImpl(env);
181 } 181 }
182 182
183 } // namespace android 183 } // namespace android
184 } // namespace offline_pages 184 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698