| OLD | NEW |
| 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/contextualsearch/contextual_search_manager.h" | 5 #include "chrome/browser/android/contextualsearch/contextual_search_manager.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 DCHECK(content_view_core->GetWebContents()); | 237 DCHECK(content_view_core->GetWebContents()); |
| 238 | 238 |
| 239 delete content_view_core->GetWebContents(); | 239 delete content_view_core->GetWebContents(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void ContextualSearchManager::SetInterceptNavigationDelegate( | 242 void ContextualSearchManager::SetInterceptNavigationDelegate( |
| 243 JNIEnv* env, | 243 JNIEnv* env, |
| 244 jobject obj, | 244 jobject obj, |
| 245 jobject delegate, | 245 jobject delegate, |
| 246 jobject jweb_contents) { | 246 jobject jweb_contents) { |
| 247 #if !defined(USE_AURA) |
| 247 content::WebContents* web_contents = | 248 content::WebContents* web_contents = |
| 248 content::WebContents::FromJavaWebContents(jweb_contents); | 249 content::WebContents::FromJavaWebContents(jweb_contents); |
| 249 DCHECK(web_contents); | 250 DCHECK(web_contents); |
| 250 navigation_interception::InterceptNavigationDelegate::Associate( | 251 navigation_interception::InterceptNavigationDelegate::Associate( |
| 251 web_contents, | 252 web_contents, |
| 252 make_scoped_ptr(new navigation_interception::InterceptNavigationDelegate( | 253 make_scoped_ptr(new navigation_interception::InterceptNavigationDelegate( |
| 253 env, delegate))); | 254 env, delegate))); |
| 255 #endif |
| 254 } | 256 } |
| 255 | 257 |
| 256 bool RegisterContextualSearchManager(JNIEnv* env) { | 258 bool RegisterContextualSearchManager(JNIEnv* env) { |
| 257 return RegisterNativesImpl(env); | 259 return RegisterNativesImpl(env); |
| 258 } | 260 } |
| 259 | 261 |
| 260 jlong Init(JNIEnv* env, jobject obj) { | 262 jlong Init(JNIEnv* env, jobject obj) { |
| 261 ContextualSearchManager* manager = new ContextualSearchManager(env, obj); | 263 ContextualSearchManager* manager = new ContextualSearchManager(env, obj); |
| 262 return reinterpret_cast<intptr_t>(manager); | 264 return reinterpret_cast<intptr_t>(manager); |
| 263 } | 265 } |
| OLD | NEW |