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

Side by Side Diff: chrome/browser/spellchecker/spellchecker_session_bridge_android.h

Issue 1275813002: Implemented typo recognition in Chrome for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@4_remove_mac_redundancies
Patch Set: Several style changes Created 5 years, 4 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
(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 // A class used to interface between the Java class of the same name and the
15 // android message filter. This class receives text to be spellchecked
16 // from the message filter, sends that text to the Java side via JNI to be
17 // spellchecked, and then sends those results to the renderer.
18 class SpellCheckerSessionBridge {
19 public:
20 explicit SpellCheckerSessionBridge(int render_process_id);
21 ~SpellCheckerSessionBridge();
22 static bool RegisterJNI(JNIEnv* env);
23
24 // Receives text to be checked from the message filter and sends it to Java
25 // to be spellchecked.
26 void RequestTextCheck(int route_id,
27 int identifier,
28 const base::string16& text);
29
30 // Receives information from Java side about the typos in a given string
31 // of text, processes these and sends them to the renderer.
32 void ProcessSpellCheckResults(JNIEnv* env,
33 jobject jobj,
34 jintArray offset_array,
35 jintArray length_array);
36
37 private:
38 struct SpellingRequest {
39 SpellingRequest(int route_id, int identifier, const base::string16& text);
40 ~SpellingRequest();
41
42 int route_id;
43 int identifier;
44 base::string16 text;
45 };
46
47 int render_process_id_;
48
49 scoped_ptr<SpellingRequest> active_request_;
50 scoped_ptr<SpellingRequest> pending_request_;
51
52 base::android::ScopedJavaGlobalRef<jobject> java_object_;
53
54 DISALLOW_COPY_AND_ASSIGN(SpellCheckerSessionBridge);
55 };
56
57 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECKER_SESSION_BRIDGE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698