OLD | NEW |
---|---|
(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" | |
Ted C
2017/03/29 17:43:50
do we need this since we are forward declaring it
Tima Vaisburd
2017/03/29 22:56:36
Removed and replaced with the proper headers.
| |
14 | |
15 namespace content { | |
16 | |
17 class WebContents; | |
18 | |
19 class ContextSelectionClient { | |
Ted C
2017/03/29 17:43:50
Can we add a class level document that describes w
Tima Vaisburd
2017/03/29 22:56:36
Absolutely! Added comments to this file, is this t
| |
20 public: | |
21 ContextSelectionClient(JNIEnv* env, | |
22 const base::android::JavaRef<jobject>& obj, | |
23 WebContents* web_contents); | |
24 ~ContextSelectionClient(); | |
Ted C
2017/03/29 17:43:50
should we mark this with override?
or can this be
Tima Vaisburd
2017/03/29 22:56:37
I made it private. For this I had to declare the n
| |
25 | |
26 void RequestSurroundingText(JNIEnv* env, | |
27 const base::android::JavaParamRef<jobject>& obj, | |
28 int callback_data); | |
29 void CancelAllRequests(JNIEnv* env, | |
30 const base::android::JavaParamRef<jobject>& obj); | |
31 | |
32 private: | |
33 class UserData; | |
Ted C
2017/03/29 17:43:50
why is this in the header?
Tima Vaisburd
2017/03/29 22:56:37
Compiler did not understand the nested class UserD
| |
34 | |
35 void OnSurroundingTextReceived(int callback_data, | |
36 const base::string16& text, | |
37 int start, | |
38 int end); | |
39 | |
40 // A weak reference to the Java ContentSelectionClient object. | |
41 JavaObjectWeakGlobalRef java_ref_; | |
42 | |
43 // WebContents is used to find the relevant RenderFrameHost that can send | |
44 // the request for the text. | |
45 WebContents* web_contents_; | |
46 | |
47 base::WeakPtrFactory<ContextSelectionClient> weak_ptr_factory_; | |
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_ | |
OLD | NEW |