| 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 Service for the given CVC, which |
| 50 // will allow the renderer to inject our JS v8 extension. |
| 51 void EnableContextualSearchServiceForView( |
| 52 JNIEnv* env, |
| 53 jobject obj, |
| 54 jobject j_overlay_content_view_core); |
| 55 |
| 49 private: | 56 private: |
| 50 // TODO(donnd): encapsulate these response parameters? | 57 // TODO(donnd): encapsulate these response parameters? |
| 51 void OnSearchTermResolutionResponse(bool is_invalid, | 58 void OnSearchTermResolutionResponse(bool is_invalid, |
| 52 int response_code, | 59 int response_code, |
| 53 const std::string& search_term, | 60 const std::string& search_term, |
| 54 const std::string& display_text, | 61 const std::string& display_text, |
| 55 const std::string& alternate_term, | 62 const std::string& alternate_term, |
| 56 bool prevent_preload, | 63 bool prevent_preload, |
| 57 int selection_start_adjust, | 64 int selection_start_adjust, |
| 58 int selection_end_adjust); | 65 int selection_end_adjust); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 71 | 78 |
| 72 // The delegate we're using the do the real work. | 79 // The delegate we're using the do the real work. |
| 73 scoped_ptr<ContextualSearchDelegate> delegate_; | 80 scoped_ptr<ContextualSearchDelegate> delegate_; |
| 74 | 81 |
| 75 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); | 82 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); |
| 76 }; | 83 }; |
| 77 | 84 |
| 78 bool RegisterContextualSearchManager(JNIEnv* env); | 85 bool RegisterContextualSearchManager(JNIEnv* env); |
| 79 | 86 |
| 80 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ | 87 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ |
| OLD | NEW |