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 #ifndef CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ |
6 #define CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ | 6 #define CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 ~ContextualSearchManager() override; | 26 ~ContextualSearchManager() override; |
27 | 27 |
28 // Called by the Java ContextualSearchManager when it is being destroyed. | 28 // Called by the Java ContextualSearchManager when it is being destroyed. |
29 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 29 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
30 | 30 |
31 // Starts the request to get the search terms to use for the given selection, | 31 // Starts the request to get the search terms to use for the given selection, |
32 // by accessing our server with the content of the page (from the given | 32 // by accessing our server with the content of the page (from the given |
33 // content view core object). | 33 // content view core object). |
34 // Any outstanding server requests are canceled. | 34 // Any outstanding server requests are canceled. |
35 // When the server responds with the search term, the Java object is notified | 35 // When the server responds with the search term, the Java object is notified |
36 // by | 36 // by calling OnSearchTermResolutionResponse(). |
37 // calling OnSearchTermResolutionResponse(). | |
38 void StartSearchTermResolutionRequest( | 37 void StartSearchTermResolutionRequest( |
39 JNIEnv* env, | 38 JNIEnv* env, |
40 const base::android::JavaParamRef<jobject>& obj, | 39 const base::android::JavaParamRef<jobject>& obj, |
41 const base::android::JavaParamRef<jstring>& j_selection, | 40 const base::android::JavaParamRef<jobject>& j_contextual_search_context, |
42 const base::android::JavaParamRef<jstring>& j_home_country, | 41 const base::android::JavaParamRef<jobject>& j_base_web_contents); |
43 const base::android::JavaParamRef<jobject>& j_base_web_contents, | |
44 jboolean j_may_send_base_page_url); | |
45 | 42 |
46 // Gathers the surrounding text around the selection and saves it locally. | 43 // Gathers the surrounding text around the selection and saves it locally. |
47 // Does not send a search term resolution request to the server. | 44 // Does not send a search term resolution request to the server. |
48 void GatherSurroundingText( | 45 void GatherSurroundingText( |
49 JNIEnv* env, | 46 JNIEnv* env, |
50 const base::android::JavaParamRef<jobject>& obj, | 47 const base::android::JavaParamRef<jobject>& obj, |
51 const base::android::JavaParamRef<jstring>& j_selection, | 48 const base::android::JavaParamRef<jobject>& j_contextual_search_context, |
52 const base::android::JavaParamRef<jstring>& j_home_country, | 49 const base::android::JavaParamRef<jobject>& j_base_web_contents); |
53 const base::android::JavaParamRef<jobject>& j_base_web_contents, | |
54 jboolean j_may_send_base_page_url); | |
55 | 50 |
56 // Gets the target language for translation purposes. | 51 // Gets the target language for translation purposes. |
57 base::android::ScopedJavaLocalRef<jstring> GetTargetLanguage( | 52 base::android::ScopedJavaLocalRef<jstring> GetTargetLanguage( |
58 JNIEnv* env, | 53 JNIEnv* env, |
59 const base::android::JavaParamRef<jobject>& obj); | 54 const base::android::JavaParamRef<jobject>& obj); |
60 | 55 |
61 // Gets the accept-languages preference string. | 56 // Gets the accept-languages preference string. |
62 base::android::ScopedJavaLocalRef<jstring> GetAcceptLanguages( | 57 base::android::ScopedJavaLocalRef<jstring> GetAcceptLanguages( |
63 JNIEnv* env, | 58 JNIEnv* env, |
64 const base::android::JavaParamRef<jobject>& obj); | 59 const base::android::JavaParamRef<jobject>& obj); |
(...skipping 25 matching lines...) Expand all Loading... |
90 | 85 |
91 // The delegate we're using the do the real work. | 86 // The delegate we're using the do the real work. |
92 std::unique_ptr<ContextualSearchDelegate> delegate_; | 87 std::unique_ptr<ContextualSearchDelegate> delegate_; |
93 | 88 |
94 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); | 89 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); |
95 }; | 90 }; |
96 | 91 |
97 bool RegisterContextualSearchManager(JNIEnv* env); | 92 bool RegisterContextualSearchManager(JNIEnv* env); |
98 | 93 |
99 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ | 94 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ |
OLD | NEW |