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

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: Addressed Teds comments: Changed to use LinkedHashSet to ensure unique and ordered results. Created 5 years, 2 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 "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
49 private: 53 private:
50 // TODO(donnd): encapsulate these response parameters? 54 void OnSearchTermResolutionResponse(
51 void OnSearchTermResolutionResponse(bool is_invalid, 55 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 56
60 // Calls back to Java with the surrounding text to be displayed. 57 // Calls back to Java with the surrounding text to be displayed.
61 void OnSurroundingTextAvailable(const std::string& after_text); 58 void OnSurroundingTextAvailable(const std::string& after_text);
62 59
63 // Calls back to Java with notification for Icing selection. 60 // Calls back to Java with notification for Icing selection.
64 void OnIcingSelectionAvailable(const std::string& encoding, 61 void OnIcingSelectionAvailable(const std::string& encoding,
65 const base::string16& surrounding_text, 62 const base::string16& surrounding_text,
66 size_t start_offset, 63 size_t start_offset,
67 size_t end_offset); 64 size_t end_offset);
68 65
69 // Our global reference to the Java ContextualSearchManager. 66 // Our global reference to the Java ContextualSearchManager.
70 base::android::ScopedJavaGlobalRef<jobject> java_manager_; 67 base::android::ScopedJavaGlobalRef<jobject> java_manager_;
71 68
72 // The delegate we're using the do the real work. 69 // The delegate we're using the do the real work.
73 scoped_ptr<ContextualSearchDelegate> delegate_; 70 scoped_ptr<ContextualSearchDelegate> delegate_;
74 71
75 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); 72 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager);
76 }; 73 };
77 74
78 bool RegisterContextualSearchManager(JNIEnv* env); 75 bool RegisterContextualSearchManager(JNIEnv* env);
79 76
80 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ 77 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698