Commit 4846e390 authored by yfriedman's avatar yfriedman Committed by Commit bot

Remove unnessary usage of Tab.getNativePtr().

We shouldn't be asking for native pointers from java. All that was
needed was a WebContents, so use that directly.

getNativePtr isn't called anymore but can't be removed until the downstream
override is gone which needs this patch to roll down.

Review URL: https://codereview.chromium.org/941633003

Cr-Commit-Position: refs/heads/master@{#317089}
parent 7e757cb1
...@@ -18,6 +18,7 @@ import android.widget.Toast; ...@@ -18,6 +18,7 @@ import android.widget.Toast;
import org.chromium.base.ApplicationStatus; import org.chromium.base.ApplicationStatus;
import org.chromium.base.CalledByNative; import org.chromium.base.CalledByNative;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.common.ScreenOrientationConstants; import org.chromium.content_public.common.ScreenOrientationConstants;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -70,7 +71,7 @@ public class ShortcutHelper { ...@@ -70,7 +71,7 @@ public class ShortcutHelper {
*/ */
public void initialize(OnInitialized callback) { public void initialize(OnInitialized callback) {
mCallback = callback; mCallback = callback;
mNativeShortcutHelper = nativeInitialize(mTab.getNativePtr()); mNativeShortcutHelper = nativeInitialize(mTab.getWebContents());
} }
/** /**
...@@ -189,7 +190,7 @@ public class ShortcutHelper { ...@@ -189,7 +190,7 @@ public class ShortcutHelper {
} }
} }
private native long nativeInitialize(long tabAndroidPtr); private native long nativeInitialize(WebContents webContents);
private native void nativeAddShortcut(long nativeShortcutHelper, String userRequestedTitle, private native void nativeAddShortcut(long nativeShortcutHelper, String userRequestedTitle,
int launcherLargeIconSize); int launcherLargeIconSize);
private native void nativeTearDown(long nativeShortcutHelper); private native void nativeTearDown(long nativeShortcutHelper);
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "base/task/cancelable_task_tracker.h" #include "base/task/cancelable_task_tracker.h"
#include "base/threading/worker_pool.h" #include "base/threading/worker_pool.h"
#include "chrome/browser/android/manifest_icon_selector.h" #include "chrome/browser/android/manifest_icon_selector.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/banners/app_banner_settings_helper.h" #include "chrome/browser/banners/app_banner_settings_helper.h"
#include "chrome/browser/favicon/favicon_service.h" #include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/favicon/favicon_service_factory.h" #include "chrome/browser/favicon/favicon_service_factory.h"
...@@ -46,11 +45,10 @@ using content::Manifest; ...@@ -46,11 +45,10 @@ using content::Manifest;
// http://developer.android.com/design/style/iconography.html // http://developer.android.com/design/style/iconography.html
const int ShortcutHelper::kPreferredIconSizeInDp = 48; const int ShortcutHelper::kPreferredIconSizeInDp = 48;
jlong Initialize(JNIEnv* env, jobject obj, jlong tab_android_ptr) { jlong Initialize(JNIEnv* env, jobject obj, jobject java_web_contents) {
TabAndroid* tab = reinterpret_cast<TabAndroid*>(tab_android_ptr); content::WebContents* web_contents =
content::WebContents::FromJavaWebContents(java_web_contents);
ShortcutHelper* shortcut_helper = ShortcutHelper* shortcut_helper = new ShortcutHelper(env, obj, web_contents);
new ShortcutHelper(env, obj, tab->web_contents());
shortcut_helper->Initialize(); shortcut_helper->Initialize();
return reinterpret_cast<intptr_t>(shortcut_helper); return reinterpret_cast<intptr_t>(shortcut_helper);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment