Chromium Code Reviews| Index: chrome/browser/spellchecker/spellchecker_session_bridge_android.h |
| diff --git a/chrome/browser/spellchecker/spellchecker_session_bridge_android.h b/chrome/browser/spellchecker/spellchecker_session_bridge_android.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6f2d761adc290d9dedcad0702c2ab0cabd01effc |
| --- /dev/null |
| +++ b/chrome/browser/spellchecker/spellchecker_session_bridge_android.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ |
| +#define CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ |
| + |
| +#include <jni.h> |
| + |
| +#include "base/android/scoped_java_ref.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/strings/string16.h" |
| + |
| +// 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.
|
| +// interface between the android message filter and the Java class of the |
| +// same name. This class is sent text to be spellchecked from |
| +// the message filter, then sends that text to the Java side via JNI to be |
| +// 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.
|
| +// renderer. |
| +class SpellCheckerSessionBridge { |
| + public: |
| + explicit SpellCheckerSessionBridge(int render_process_id); |
| + ~SpellCheckerSessionBridge(); |
| + static bool RegisterJNI(JNIEnv* env); |
| + |
| + // Receives text to be checked from the message filter and sends it to Java |
| + // to be spellchecked. |
| + void RequestTextCheck(int route_id, |
| + int identifier, |
| + const base::string16& text); |
| + |
| + // Receives information from Java side about the typos in a given string |
| + // of text, processes these and sends them to the renderer. |
| + void ProcessSpellCheckResults(JNIEnv* env, |
| + jobject jobj, |
| + jintArray offset_array, |
| + jintArray length_array); |
| + |
| + private: |
| + 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.
|
| + SpellingRequest(int route_id, int identifier, const base::string16& text); |
| + ~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.
|
| + |
| + int route_id; |
| + int identifier; |
| + base::string16 text; |
| + }; |
| + |
| + int render_process_id_; |
| + |
| + scoped_ptr<SpellingRequest> active_request_; |
| + scoped_ptr<SpellingRequest> pending_request_; |
| + |
| + base::android::ScopedJavaGlobalRef<jobject> java_object_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SpellCheckerSessionBridge); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_ |