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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "chrome/browser/android/contextualsearch/contextual_search_delegate.h" | 13 #include "chrome/browser/android/contextualsearch/contextual_search_delegate.h" |
14 #include "chrome/browser/android/contextualsearch/resolved_search_term.h" | 14 #include "chrome/browser/android/contextualsearch/resolved_search_term.h" |
15 #include "chrome/browser/android/tab_android.h" | 15 #include "chrome/browser/android/tab_android.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 17 #include "chrome/browser/search_engines/template_url_service_factory.h" |
18 #include "components/contextual_search/browser/contextual_search_js_api_service_
impl.h" | 18 #include "components/contextual_search/browser/contextual_search_js_api_service_
impl.h" |
19 #include "components/contextual_search/common/overlay_page_notifier_service.mojo
m.h" | 19 #include "components/contextual_search/common/overlay_page_notifier_service.mojo
m.h" |
20 #include "components/navigation_interception/intercept_navigation_delegate.h" | 20 #include "components/navigation_interception/intercept_navigation_delegate.h" |
21 #include "components/variations/variations_associated_data.h" | 21 #include "components/variations/variations_associated_data.h" |
22 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
25 #include "jni/ContextualSearchManager_jni.h" | 25 #include "jni/ContextualSearchManager_jni.h" |
26 #include "net/url_request/url_fetcher_impl.h" | 26 #include "net/url_request/url_fetcher_impl.h" |
| 27 #include "services/service_manager/public/cpp/bind_source_info.h" |
27 #include "services/service_manager/public/cpp/binder_registry.h" | 28 #include "services/service_manager/public/cpp/binder_registry.h" |
28 #include "services/service_manager/public/cpp/interface_provider.h" | 29 #include "services/service_manager/public/cpp/interface_provider.h" |
29 | 30 |
30 using base::android::JavaParamRef; | 31 using base::android::JavaParamRef; |
31 using base::android::JavaRef; | 32 using base::android::JavaRef; |
32 using content::WebContents; | 33 using content::WebContents; |
33 | 34 |
34 // This class manages the native behavior of the Contextual Search feature. | 35 // This class manages the native behavior of the Contextual Search feature. |
35 // Instances of this class are owned by the Java ContextualSearchManager. | 36 // Instances of this class are owned by the Java ContextualSearchManager. |
36 // Most of the work is actually done in an associated delegate to this class: | 37 // Most of the work is actually done in an associated delegate to this class: |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 194 } |
194 | 195 |
195 void ContextualSearchManager::SetCaption(std::string caption, | 196 void ContextualSearchManager::SetCaption(std::string caption, |
196 bool does_answer) { | 197 bool does_answer) { |
197 JNIEnv* env = base::android::AttachCurrentThread(); | 198 JNIEnv* env = base::android::AttachCurrentThread(); |
198 base::android::ScopedJavaLocalRef<jstring> j_caption = | 199 base::android::ScopedJavaLocalRef<jstring> j_caption = |
199 base::android::ConvertUTF8ToJavaString(env, caption.c_str()); | 200 base::android::ConvertUTF8ToJavaString(env, caption.c_str()); |
200 Java_ContextualSearchManager_onSetCaption(env, java_manager_, j_caption, | 201 Java_ContextualSearchManager_onSetCaption(env, java_manager_, j_caption, |
201 does_answer); | 202 does_answer); |
202 } | 203 } |
OLD | NEW |