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

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

Issue 1385663002: [Contextual Search] Add Mojo-enabled API component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Kausalya's comments, added TODO and bug reference for transition from JS to a better way. Created 5 years, 2 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 c8b41abd68a97fa200bc5a5110e76b3159d05e6f..4f2fdffb38ec608fc0a8fd398b25d1fe9a1e826a 100644
--- a/chrome/browser/android/contextualsearch/contextual_search_manager.cc
+++ b/chrome/browser/android/contextualsearch/contextual_search_manager.cc
@@ -13,11 +13,13 @@
#include "chrome/browser/android/contextualsearch/contextual_search_delegate.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/search/contextual_search_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/android/window_android_helper.h"
#include "components/navigation_interception/intercept_navigation_delegate.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/android/content_view_core.h"
+#include "content/public/browser/render_process_host.h"
#include "jni/ContextualSearchManager_jni.h"
#include "net/url_request/url_fetcher_impl.h"
@@ -138,6 +140,21 @@ void ContextualSearchManager::OnIcingSelectionAvailable(
start_offset, end_offset);
}
+void ContextualSearchManager::EnableContextualSearchServiceForView(
+ JNIEnv* env,
+ jobject obj,
+ jobject j_overlay_content_view_core) {
+ ContentViewCore* overlay_content_view_core =
+ ContentViewCore::GetNativeContentViewCore(env,
+ j_overlay_content_view_core);
+ if (overlay_content_view_core != NULL) {
+ ContextualSearchService::GetInstance()->SetContextualSearchProcess(
+ overlay_content_view_core->GetWebContents()
+ ->GetRenderProcessHost()
+ ->GetID());
+ }
+}
+
bool RegisterContextualSearchManager(JNIEnv* env) {
return RegisterNativesImpl(env);
}

Powered by Google App Engine
This is Rietveld 408576698