Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: chrome/browser/android/contextualsearch/contextual_search_manager.h

Issue 2179563003: Android: Remove ContentViewCore::GetLayer() from public interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 // content view core object). 32 // content view core object).
33 // Any outstanding server requests are canceled. 33 // Any outstanding server requests are canceled.
34 // When the server responds with the search term, the Java object is notified 34 // When the server responds with the search term, the Java object is notified
35 // by 35 // by
36 // calling OnSearchTermResolutionResponse(). 36 // calling OnSearchTermResolutionResponse().
37 void StartSearchTermResolutionRequest( 37 void StartSearchTermResolutionRequest(
38 JNIEnv* env, 38 JNIEnv* env,
39 const base::android::JavaParamRef<jobject>& obj, 39 const base::android::JavaParamRef<jobject>& obj,
40 const base::android::JavaParamRef<jstring>& j_selection, 40 const base::android::JavaParamRef<jstring>& j_selection,
41 jboolean j_use_resolved_search_term, 41 jboolean j_use_resolved_search_term,
42 const base::android::JavaParamRef<jobject>& j_base_content_view_core, 42 const base::android::JavaParamRef<jobject>& j_base_web_contents,
43 jboolean j_may_send_base_page_url); 43 jboolean j_may_send_base_page_url);
44 44
45 // Gathers the surrounding text around the selection and saves it locally. 45 // Gathers the surrounding text around the selection and saves it locally.
46 // Does not send a search term resolution request to the server. 46 // Does not send a search term resolution request to the server.
47 void GatherSurroundingText( 47 void GatherSurroundingText(
48 JNIEnv* env, 48 JNIEnv* env,
49 const base::android::JavaParamRef<jobject>& obj, 49 const base::android::JavaParamRef<jobject>& obj,
50 const base::android::JavaParamRef<jstring>& j_selection, 50 const base::android::JavaParamRef<jstring>& j_selection,
51 jboolean j_use_resolved_search_term, 51 jboolean j_use_resolved_search_term,
52 const base::android::JavaParamRef<jobject>& j_base_content_view_core, 52 const base::android::JavaParamRef<jobject>& j_base_web_contents,
53 jboolean j_may_send_base_page_url); 53 jboolean j_may_send_base_page_url);
54 54
55 // Gets the target language for translation purposes. 55 // Gets the target language for translation purposes.
56 base::android::ScopedJavaLocalRef<jstring> GetTargetLanguage( 56 base::android::ScopedJavaLocalRef<jstring> GetTargetLanguage(
57 JNIEnv* env, 57 JNIEnv* env,
58 const base::android::JavaParamRef<jobject>& obj); 58 const base::android::JavaParamRef<jobject>& obj);
59 59
60 // Gets the accept-languages preference string. 60 // Gets the accept-languages preference string.
61 base::android::ScopedJavaLocalRef<jstring> GetAcceptLanguages( 61 base::android::ScopedJavaLocalRef<jstring> GetAcceptLanguages(
62 JNIEnv* env, 62 JNIEnv* env,
63 const base::android::JavaParamRef<jobject>& obj); 63 const base::android::JavaParamRef<jobject>& obj);
64 64
65 // Enables the Contextual Search JS API for the given |ContentViewCore|. 65 // Enables the Contextual Search JS API for the given |WebContents|.
66 void EnableContextualSearchJsApiForOverlay( 66 void EnableContextualSearchJsApiForOverlay(
67 JNIEnv* env, 67 JNIEnv* env,
68 jobject obj, 68 jobject obj,
69 jobject j_overlay_content_view_core); 69 const base::android::JavaParamRef<jobject>& j_web_contents);
70 70
71 // ContextualSearchJsApiHandler overrides: 71 // ContextualSearchJsApiHandler overrides:
72 void SetCaption(std::string caption, bool does_answer) override; 72 void SetCaption(std::string caption, bool does_answer) override;
73 73
74 private: 74 private:
75 void OnSearchTermResolutionResponse( 75 void OnSearchTermResolutionResponse(
76 const ResolvedSearchTerm& resolved_search_term); 76 const ResolvedSearchTerm& resolved_search_term);
77 77
78 // Calls back to Java with the surrounding text to be displayed. 78 // Calls back to Java with the surrounding text to be displayed.
79 void OnSurroundingTextAvailable(const std::string& after_text); 79 void OnSurroundingTextAvailable(const std::string& after_text);
80 80
81 // Calls back to Java with notification for Icing selection. 81 // Calls back to Java with notification for Icing selection.
82 void OnIcingSelectionAvailable(const std::string& encoding, 82 void OnIcingSelectionAvailable(const std::string& encoding,
83 const base::string16& surrounding_text, 83 const base::string16& surrounding_text,
84 size_t start_offset, 84 size_t start_offset,
85 size_t end_offset); 85 size_t end_offset);
86 86
87 // Our global reference to the Java ContextualSearchManager. 87 // Our global reference to the Java ContextualSearchManager.
88 base::android::ScopedJavaGlobalRef<jobject> java_manager_; 88 base::android::ScopedJavaGlobalRef<jobject> java_manager_;
89 89
90 // The delegate we're using the do the real work. 90 // The delegate we're using the do the real work.
91 std::unique_ptr<ContextualSearchDelegate> delegate_; 91 std::unique_ptr<ContextualSearchDelegate> delegate_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); 93 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager);
94 }; 94 };
95 95
96 bool RegisterContextualSearchManager(JNIEnv* env); 96 bool RegisterContextualSearchManager(JNIEnv* env);
97 97
98 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ 98 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698