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 "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/task/cancelable_task_tracker.h" | 9 #include "base/task/cancelable_task_tracker.h" |
10 #include "chrome/browser/android/contextualsearch/contextual_search_context.h" | 10 #include "chrome/browser/android/contextualsearch/contextual_search_context.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 | 39 |
40 // Gathers the surrounding text around the selection and saves it locally. | 40 // Gathers the surrounding text around the selection and saves it locally. |
41 // Does not send a search term resolution request to the server. | 41 // Does not send a search term resolution request to the server. |
42 void GatherSurroundingText(JNIEnv* env, | 42 void GatherSurroundingText(JNIEnv* env, |
43 jobject obj, | 43 jobject obj, |
44 jstring j_selection, | 44 jstring j_selection, |
45 jboolean j_use_resolved_search_term, | 45 jboolean j_use_resolved_search_term, |
46 jobject j_base_content_view_core, | 46 jobject j_base_content_view_core, |
47 jboolean j_may_send_base_page_url); | 47 jboolean j_may_send_base_page_url); |
48 | 48 |
49 // Gets the target language for translation purposes. | |
50 // TODO(donnd): Can we get rid of the jobject if it's not being used? | |
pedro (no code reviews)
2015/09/23 18:33:55
The jobj is being implicitly used when you pass th
Donn Denman
2015/10/09 22:08:23
Acknowledged.
| |
51 base::android::ScopedJavaLocalRef<jstring> GetTargetLanguage(JNIEnv* env, | |
52 jobject obj); | |
53 | |
49 private: | 54 private: |
50 // TODO(donnd): encapsulate these response parameters? | 55 void OnSearchTermResolutionResponse( |
51 void OnSearchTermResolutionResponse(bool is_invalid, | 56 const ResolvedSearchTerm& resolved_search_term); |
52 int response_code, | |
53 const std::string& search_term, | |
54 const std::string& display_text, | |
55 const std::string& alternate_term, | |
56 bool prevent_preload, | |
57 int selection_start_adjust, | |
58 int selection_end_adjust); | |
59 | 57 |
60 // Calls back to Java with the surrounding text to be displayed. | 58 // Calls back to Java with the surrounding text to be displayed. |
61 void OnSurroundingTextAvailable(const std::string& before_text, | 59 void OnSurroundingTextAvailable(const std::string& before_text, |
62 const std::string& after_text); | 60 const std::string& after_text); |
63 | 61 |
64 // Calls back to Java with notification for Icing selection. | 62 // Calls back to Java with notification for Icing selection. |
65 void OnIcingSelectionAvailable(const std::string& encoding, | 63 void OnIcingSelectionAvailable(const std::string& encoding, |
66 const base::string16& surrounding_text, | 64 const base::string16& surrounding_text, |
67 size_t start_offset, | 65 size_t start_offset, |
68 size_t end_offset); | 66 size_t end_offset); |
69 | 67 |
70 // Our global reference to the Java ContextualSearchManager. | 68 // Our global reference to the Java ContextualSearchManager. |
71 base::android::ScopedJavaGlobalRef<jobject> java_manager_; | 69 base::android::ScopedJavaGlobalRef<jobject> java_manager_; |
72 | 70 |
73 // The delegate we're using the do the real work. | 71 // The delegate we're using the do the real work. |
74 scoped_ptr<ContextualSearchDelegate> delegate_; | 72 scoped_ptr<ContextualSearchDelegate> delegate_; |
75 | 73 |
76 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); | 74 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); |
77 }; | 75 }; |
78 | 76 |
79 bool RegisterContextualSearchManager(JNIEnv* env); | 77 bool RegisterContextualSearchManager(JNIEnv* env); |
80 | 78 |
81 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ | 79 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ |
OLD | NEW |