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

Side by Side Diff: chrome/browser/android/offline_pages/downloads/offline_page_download_bridge.cc

Issue 2235573002: Fix OfflinePageDownloadBridge. Calls native->Java did not work due to missed JNI initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/downloads/offline_page_download_b ridge.h" 5 #include "chrome/browser/android/offline_pages/downloads/offline_page_download_b ridge.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ConvertUTF8ToJavaString(env, item.url.spec()).obj(), 48 ConvertUTF8ToJavaString(env, item.url.spec()).obj(),
49 ConvertUTF8ToJavaString(env, item.target_path.value()).obj(), 49 ConvertUTF8ToJavaString(env, item.target_path.value()).obj(),
50 item.start_time.ToJavaTime(), item.total_bytes); 50 item.start_time.ToJavaTime(), item.total_bytes);
51 } 51 }
52 } // namespace 52 } // namespace
53 53
54 OfflinePageDownloadBridge::OfflinePageDownloadBridge( 54 OfflinePageDownloadBridge::OfflinePageDownloadBridge(
55 JNIEnv* env, 55 JNIEnv* env,
56 const JavaParamRef<jobject>& obj, 56 const JavaParamRef<jobject>& obj,
57 DownloadUIAdapter* download_ui_adapter) 57 DownloadUIAdapter* download_ui_adapter)
58 : download_ui_adapter_(download_ui_adapter) { 58 : weak_java_ref_(env, obj),
59 download_ui_adapter_(download_ui_adapter) {
59 DCHECK(download_ui_adapter_); 60 DCHECK(download_ui_adapter_);
60 download_ui_adapter_->AddObserver(this); 61 download_ui_adapter_->AddObserver(this);
61 } 62 }
62 63
63 OfflinePageDownloadBridge::~OfflinePageDownloadBridge() {} 64 OfflinePageDownloadBridge::~OfflinePageDownloadBridge() {}
64 65
65 // static 66 // static
66 bool OfflinePageDownloadBridge::Register(JNIEnv* env) { 67 bool OfflinePageDownloadBridge::Register(JNIEnv* env) {
67 return RegisterNativesImpl(env); 68 return RegisterNativesImpl(env);
68 } 69 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 137
137 DownloadUIAdapter* adapter = 138 DownloadUIAdapter* adapter =
138 DownloadUIAdapter::FromOfflinePageModel(offline_page_model); 139 DownloadUIAdapter::FromOfflinePageModel(offline_page_model);
139 140
140 return reinterpret_cast<jlong>( 141 return reinterpret_cast<jlong>(
141 new OfflinePageDownloadBridge(env, obj, adapter)); 142 new OfflinePageDownloadBridge(env, obj, adapter));
142 } 143 }
143 144
144 } // namespace android 145 } // namespace android
145 } // namespace offline_pages 146 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698