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

Side by Side Diff: content/browser/android/context_selection_client.h

Issue 2740103006: Implement SmartText selection. (Closed)
Patch Set: Created 3 years, 9 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 2017 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 CONTENT_BROWSER_ANDROID_CONTEXT_SELECTION_CLIENT_H_
6 #define CONTENT_BROWSER_ANDROID_CONTEXT_SELECTION_CLIENT_H_
7
8 #include <jni.h>
9
10 #include "base/android/jni_weak_ref.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/public/browser/web_contents.h"
14
15 namespace content {
16
17 class WebContents;
18
19 class ContextSelectionClient
20 : public base::SupportsWeakPtr<ContextSelectionClient> {
boliu 2017/03/11 00:37:51 prefer WeakPtrFactory
Tima Vaisburd 2017/03/20 05:06:04 Done.
21 public:
22 ContextSelectionClient(JNIEnv* env,
23 const base::android::JavaRef<jobject>& obj,
24 WebContents* web_contents);
25 ~ContextSelectionClient();
26
27 void RequestSurroundingText(JNIEnv* env,
28 const base::android::JavaParamRef<jobject>& obj,
29 int callback_data);
30 void CancelAllRequests(JNIEnv* env,
31 const base::android::JavaParamRef<jobject>& obj);
32
33 private:
34 class UserData;
35 friend class UserData;
boliu 2017/03/11 00:37:51 hmm, is friend needed?
Tima Vaisburd 2017/03/20 05:06:04 It was a copy-paste error. Removed.
36
37 void OnSurroundingTextReceived(int callback_data,
38 const base::string16& text,
39 int start,
40 int end);
41
42 // A weak reference to the Java ContentSelectionClient object.
43 JavaObjectWeakGlobalRef java_ref_;
44
45 // WebContents is used to find the relevant RenderFrameHost that can send
46 // the request for the text.
47 WebContents* web_contents_;
48
49 DISALLOW_COPY_AND_ASSIGN(ContextSelectionClient);
50 };
51
52 bool RegisterContextSelectionClient(JNIEnv* env);
53
54 } // namespace content
55
56 #endif // CONTENT_BROWSER_ANDROID_CONTEXT_SELECTION_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698