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

Unified Diff: chrome/browser/android/contextualsearch/contextual_search_manager.cc

Issue 2315323002: Pass JavaRef to WebContents::FromJavaWebContents. (Closed)
Patch Set: Created 4 years, 3 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
Index: chrome/browser/android/contextualsearch/contextual_search_manager.cc
diff --git a/chrome/browser/android/contextualsearch/contextual_search_manager.cc b/chrome/browser/android/contextualsearch/contextual_search_manager.cc
index 6a86cae7181b28ff83222f20c9e967bd4b594d53..f3068ef747e754643b0db64d7721d9dc62e27419 100644
--- a/chrome/browser/android/contextualsearch/contextual_search_manager.cc
+++ b/chrome/browser/android/contextualsearch/contextual_search_manager.cc
@@ -28,14 +28,16 @@
#include "services/shell/public/cpp/interface_registry.h"
using base::android::JavaParamRef;
+using base::android::JavaRef;
using content::WebContents;
// This class manages the native behavior of the Contextual Search feature.
// Instances of this class are owned by the Java ContextualSearchManager.
// Most of the work is actually done in an associated delegate to this class:
// the ContextualSearchDelegate.
-ContextualSearchManager::ContextualSearchManager(JNIEnv* env, jobject obj) {
- java_manager_.Reset(env, obj);
+ContextualSearchManager::ContextualSearchManager(JNIEnv* env,
+ const JavaRef<jobject>& obj) {
+ java_manager_.Reset(obj);
Java_ContextualSearchManager_setNativeManager(
env, obj, reinterpret_cast<intptr_t>(this));
Profile* profile = ProfileManager::GetActiveUserProfile();
@@ -68,7 +70,7 @@ void ContextualSearchManager::StartSearchTermResolutionRequest(
const JavaParamRef<jobject>& j_base_web_contents,
jboolean j_may_send_base_page_url) {
WebContents* base_web_contents =
- WebContents::FromJavaWebContents(j_base_web_contents.obj());
+ WebContents::FromJavaWebContents(j_base_web_contents);
DCHECK(base_web_contents);
std::string selection(
base::android::ConvertJavaStringToUTF8(env, j_selection));
@@ -88,7 +90,7 @@ void ContextualSearchManager::GatherSurroundingText(
const JavaParamRef<jobject>& j_base_web_contents,
jboolean j_may_send_base_page_url) {
WebContents* base_web_contents =
- WebContents::FromJavaWebContents(j_base_web_contents.obj());
+ WebContents::FromJavaWebContents(j_base_web_contents);
DCHECK(base_web_contents);
std::string selection(
base::android::ConvertJavaStringToUTF8(env, j_selection));
@@ -174,7 +176,7 @@ void ContextualSearchManager::EnableContextualSearchJsApiForOverlay(
jobject obj,
const JavaParamRef<jobject>& j_overlay_web_contents) {
WebContents* overlay_web_contents =
- WebContents::FromJavaWebContents(j_overlay_web_contents.obj());
+ WebContents::FromJavaWebContents(j_overlay_web_contents);
DCHECK(overlay_web_contents);
// Tell our Overlay Notifier Service that this is currently a CS page.
content::RenderFrameHost* render_frame_host =

Powered by Google App Engine
This is Rietveld 408576698