| 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 COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ | 5 #ifndef COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ |
| 6 #define COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ | 6 #define COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const base::string16& text); | 30 const base::string16& text); |
| 31 | 31 |
| 32 // Receives information from Java side about the typos in a given string | 32 // Receives information from Java side about the typos in a given string |
| 33 // of text, processes these and sends them to the renderer. | 33 // of text, processes these and sends them to the renderer. |
| 34 void ProcessSpellCheckResults( | 34 void ProcessSpellCheckResults( |
| 35 JNIEnv* env, | 35 JNIEnv* env, |
| 36 const base::android::JavaParamRef<jobject>& jobj, | 36 const base::android::JavaParamRef<jobject>& jobj, |
| 37 const base::android::JavaParamRef<jintArray>& offset_array, | 37 const base::android::JavaParamRef<jintArray>& offset_array, |
| 38 const base::android::JavaParamRef<jintArray>& length_array); | 38 const base::android::JavaParamRef<jintArray>& length_array); |
| 39 | 39 |
| 40 void RecordLatencyUMA(JNIEnv* env, |
| 41 const base::android::JavaParamRef<jobject>& jobj, |
| 42 long latencyMs); |
| 43 |
| 40 // Sets the handle to the Java SpellCheckerSessionBridge object to null, | 44 // Sets the handle to the Java SpellCheckerSessionBridge object to null, |
| 41 // marking the Java object for garbage collection. | 45 // marking the Java object for garbage collection. |
| 42 void DisconnectSession(); | 46 void DisconnectSession(); |
| 43 | 47 |
| 44 private: | 48 private: |
| 45 struct SpellingRequest { | 49 struct SpellingRequest { |
| 46 SpellingRequest(int route_id, int identifier, const base::string16& text); | 50 SpellingRequest(int route_id, int identifier, const base::string16& text); |
| 47 ~SpellingRequest(); | 51 ~SpellingRequest(); |
| 48 | 52 |
| 49 int route_id; | 53 int route_id; |
| 50 int identifier; | 54 int identifier; |
| 51 base::string16 text; | 55 base::string16 text; |
| 52 }; | 56 }; |
| 53 | 57 |
| 54 int render_process_id_; | 58 int render_process_id_; |
| 55 | 59 |
| 56 std::unique_ptr<SpellingRequest> active_request_; | 60 std::unique_ptr<SpellingRequest> active_request_; |
| 57 std::unique_ptr<SpellingRequest> pending_request_; | 61 std::unique_ptr<SpellingRequest> pending_request_; |
| 58 | 62 |
| 59 base::android::ScopedJavaGlobalRef<jobject> java_object_; | 63 base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| 60 bool java_object_initialization_failed_; | 64 bool java_object_initialization_failed_; |
| 61 | 65 |
| 62 DISALLOW_COPY_AND_ASSIGN(SpellCheckerSessionBridge); | 66 DISALLOW_COPY_AND_ASSIGN(SpellCheckerSessionBridge); |
| 63 }; | 67 }; |
| 64 | 68 |
| 65 #endif // COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ | 69 #endif // COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ |
| OLD | NEW |