Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ | |
| 6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ | |
| 7 | |
| 8 #include <jni.h> | |
| 9 | |
| 10 #include "base/android/scoped_java_ref.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/strings/string16.h" | |
| 13 | |
| 14 // Owned by the SpellCheckMessageFilterPlatform. This class is used to | |
|
please use gerrit instead
2015/08/17 21:29:46
Ownership of this class is not something that this
dylanking
2015/08/18 01:21:31
Done! Good point, thanks.
| |
| 15 // interface between the android message filter and the Java class of the | |
| 16 // same name. This class is sent text to be spellchecked from | |
| 17 // the message filter, then sends that text to the Java side via JNI to be | |
| 18 // spellchecked, and finally processes those results and sends them to the | |
|
please use gerrit instead
2015/08/17 21:29:46
You're using the Oxford comma in some places, but
dylanking
2015/08/18 01:21:31
Reworded the comment a bit to avoid this. Thanks.
| |
| 19 // renderer. | |
| 20 class SpellCheckerSessionBridge { | |
| 21 public: | |
| 22 explicit SpellCheckerSessionBridge(int render_process_id); | |
| 23 ~SpellCheckerSessionBridge(); | |
| 24 static bool RegisterJNI(JNIEnv* env); | |
| 25 | |
| 26 // Receives text to be checked from the message filter and sends it to Java | |
| 27 // to be spellchecked. | |
| 28 void RequestTextCheck(int route_id, | |
| 29 int identifier, | |
| 30 const base::string16& text); | |
| 31 | |
| 32 // Receives information from Java side about the typos in a given string | |
| 33 // of text, processes these and sends them to the renderer. | |
| 34 void ProcessSpellCheckResults(JNIEnv* env, | |
| 35 jobject jobj, | |
| 36 jintArray offset_array, | |
| 37 jintArray length_array); | |
| 38 | |
| 39 private: | |
| 40 struct SpellingRequest { | |
|
please use gerrit instead
2015/08/17 21:29:46
nit: You /could/ forward declare this to relieve t
dylanking
2015/08/18 01:21:31
Let's leave it in here for now.
| |
| 41 SpellingRequest(int route_id, int identifier, const base::string16& text); | |
| 42 ~SpellingRequest() {} | |
|
please use gerrit instead
2015/08/17 21:29:46
Let's not inline destructors. Technically, inline
dylanking
2015/08/18 01:21:31
Alright, moved to the .cc file.
| |
| 43 | |
| 44 int route_id; | |
| 45 int identifier; | |
| 46 base::string16 text; | |
| 47 }; | |
| 48 | |
| 49 int render_process_id_; | |
| 50 | |
| 51 scoped_ptr<SpellingRequest> active_request_; | |
| 52 scoped_ptr<SpellingRequest> pending_request_; | |
| 53 | |
| 54 base::android::ScopedJavaGlobalRef<jobject> java_object_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(SpellCheckerSessionBridge); | |
| 57 }; | |
| 58 | |
| 59 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ | |
| OLD | NEW |