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

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

Issue 1354763003: [Contextual Search] Trigger the translation one-box. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comment about test infrastructure needing to be updated when shifting to new API. Created 5 years, 1 month 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 "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
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 base::android::ScopedJavaLocalRef<jstring> GetTargetLanguage(JNIEnv* env,
51 jobject obj);
52
53 // Gets the accept-languages preference string.
54 base::android::ScopedJavaLocalRef<jstring> GetAcceptLanguages(JNIEnv* env,
55 jobject obj);
56
49 private: 57 private:
50 // TODO(donnd): encapsulate these response parameters? 58 void OnSearchTermResolutionResponse(
51 void OnSearchTermResolutionResponse(bool is_invalid, 59 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 60
60 // Calls back to Java with the surrounding text to be displayed. 61 // Calls back to Java with the surrounding text to be displayed.
61 void OnSurroundingTextAvailable(const std::string& after_text); 62 void OnSurroundingTextAvailable(const std::string& after_text);
62 63
63 // Calls back to Java with notification for Icing selection. 64 // Calls back to Java with notification for Icing selection.
64 void OnIcingSelectionAvailable(const std::string& encoding, 65 void OnIcingSelectionAvailable(const std::string& encoding,
65 const base::string16& surrounding_text, 66 const base::string16& surrounding_text,
66 size_t start_offset, 67 size_t start_offset,
67 size_t end_offset); 68 size_t end_offset);
68 69
69 // Our global reference to the Java ContextualSearchManager. 70 // Our global reference to the Java ContextualSearchManager.
70 base::android::ScopedJavaGlobalRef<jobject> java_manager_; 71 base::android::ScopedJavaGlobalRef<jobject> java_manager_;
71 72
72 // The delegate we're using the do the real work. 73 // The delegate we're using the do the real work.
73 scoped_ptr<ContextualSearchDelegate> delegate_; 74 scoped_ptr<ContextualSearchDelegate> delegate_;
74 75
75 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); 76 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager);
76 }; 77 };
77 78
78 bool RegisterContextualSearchManager(JNIEnv* env); 79 bool RegisterContextualSearchManager(JNIEnv* env);
79 80
80 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ 81 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698