| 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 // Enables the Contextual Search API for the given CVC, by adding this |
| 50 // view to the list of renderers that can inject our API. |
| 51 void AddViewForContextualSearchApi(JNIEnv* env, |
| 52 jobject obj, |
| 53 jobject j_overlay_content_view_core); |
| 54 |
| 55 // Removes the given ID from the list of renderers that can inject our API. |
| 56 // If the API was already enabled it stays enabled, but no new enabling |
| 57 // will be done. |
| 58 void RemoveViewForContextualSearchApi(JNIEnv* env, |
| 59 jobject obj, |
| 60 int render_process_host_id); |
| 61 |
| 49 private: | 62 private: |
| 50 // TODO(donnd): encapsulate these response parameters? | 63 // TODO(donnd): encapsulate these response parameters? |
| 51 void OnSearchTermResolutionResponse(bool is_invalid, | 64 void OnSearchTermResolutionResponse(bool is_invalid, |
| 52 int response_code, | 65 int response_code, |
| 53 const std::string& search_term, | 66 const std::string& search_term, |
| 54 const std::string& display_text, | 67 const std::string& display_text, |
| 55 const std::string& alternate_term, | 68 const std::string& alternate_term, |
| 56 bool prevent_preload, | 69 bool prevent_preload, |
| 57 int selection_start_adjust, | 70 int selection_start_adjust, |
| 58 int selection_end_adjust); | 71 int selection_end_adjust); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 71 | 84 |
| 72 // The delegate we're using the do the real work. | 85 // The delegate we're using the do the real work. |
| 73 scoped_ptr<ContextualSearchDelegate> delegate_; | 86 scoped_ptr<ContextualSearchDelegate> delegate_; |
| 74 | 87 |
| 75 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); | 88 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); |
| 76 }; | 89 }; |
| 77 | 90 |
| 78 bool RegisterContextualSearchManager(JNIEnv* env); | 91 bool RegisterContextualSearchManager(JNIEnv* env); |
| 79 | 92 |
| 80 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ | 93 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ |
| OLD | NEW |