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 CHROME_BROWSER_ANDROID_BOTTOMBAR_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_PANE
L_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BOTTOMBAR_OVERLAY_PANEL_CONTENT_H_ |
6 #define CHROME_BROWSER_ANDROID_BOTTOMBAR_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_PANE
L_H_ | 6 #define CHROME_BROWSER_ANDROID_BOTTOMBAR_OVERLAY_PANEL_CONTENT_H_ |
7 | 7 |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/task/cancelable_task_tracker.h" | 9 #include "base/task/cancelable_task_tracker.h" |
10 #include "chrome/browser/android/contextualsearch/contextual_search_context.h" | 10 #include "chrome/browser/android/contextualsearch/contextual_search_context.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class WebContents; | 13 class WebContents; |
14 } // namespace content | 14 } // namespace content |
15 | 15 |
16 namespace web_contents_delegate_android { | 16 namespace web_contents_delegate_android { |
17 class WebContentsDelegateAndroid; | 17 class WebContentsDelegateAndroid; |
18 } // namespace web_contents_delegate_android | 18 } // namespace web_contents_delegate_android |
19 | 19 |
20 // Manages the native extraction and request logic for Contextual Search, | 20 // Manages the native extraction and request logic for Contextual Search, |
21 // and interacts with the Java ContextualSearchPanel for UX. | 21 // and interacts with the Java OverlayPanelContent for UX. |
22 // Most of the work is done by the associated ContextualSearchDelegate. | 22 // Most of the work is done by the associated ContextualSearchDelegate. |
23 class ContextualSearchPanel { | 23 class OverlayPanelContent { |
24 public: | 24 public: |
25 // Constructs a native manager associated with the Java manager. | 25 // Constructs a native manager associated with the Java manager. |
26 ContextualSearchPanel(JNIEnv* env, jobject obj); | 26 OverlayPanelContent(JNIEnv* env, jobject obj); |
27 virtual ~ContextualSearchPanel(); | 27 virtual ~OverlayPanelContent(); |
28 | 28 |
29 // Called by the Java ContextualSearchPanel when it is being destroyed. | 29 // Called by the Java OverlayPanelContent when it is being destroyed. |
30 void Destroy(JNIEnv* env, jobject obj); | 30 void Destroy(JNIEnv* env, jobject obj); |
31 | 31 |
32 // Removes a search URL from history. |search_start_time_ms| represents the | 32 // Removes a search URL from history. |search_start_time_ms| represents the |
33 // time at which |search_url| was committed. | 33 // time at which |search_url| was committed. |
34 void RemoveLastHistoryEntry(JNIEnv* env, | 34 void RemoveLastHistoryEntry(JNIEnv* env, |
35 jobject obj, | 35 jobject obj, |
36 jstring search_url, | 36 jstring search_url, |
37 jlong search_start_time_ms); | 37 jlong search_start_time_ms); |
38 | 38 |
39 // Takes ownership of the WebContents associated with the given | 39 // Takes ownership of the WebContents associated with the given |
40 // |ContentViewCore| which holds the Contextual Search Results. | 40 // |ContentViewCore| which holds the panel content. |
41 void SetWebContents(JNIEnv* env, jobject obj, jobject jcontent_view_core, | 41 void SetWebContents(JNIEnv* env, jobject obj, jobject jcontent_view_core, |
42 jobject jweb_contents_delegate); | 42 jobject jweb_contents_delegate); |
43 | 43 |
44 // Destroys the WebContents. | 44 // Destroys the WebContents. |
45 void DestroyWebContents(JNIEnv* env, jobject jobj); | 45 void DestroyWebContents(JNIEnv* env, jobject jobj); |
46 | 46 |
47 // Sets the delegate used to convert navigations to intents. | 47 // Sets the delegate used to convert navigations to intents. |
48 void SetInterceptNavigationDelegate(JNIEnv* env, | 48 void SetInterceptNavigationDelegate(JNIEnv* env, |
49 jobject obj, | 49 jobject obj, |
50 jobject delegate, | 50 jobject delegate, |
51 jobject jweb_contents); | 51 jobject jweb_contents); |
52 | 52 |
53 private: | 53 private: |
54 // Our global reference to the Java ContextualSearchPanel. | 54 // Our global reference to the Java OverlayPanelContent. |
55 base::android::ScopedJavaGlobalRef<jobject> java_manager_; | 55 base::android::ScopedJavaGlobalRef<jobject> java_manager_; |
56 | 56 |
57 // Used if we need to clear history. | 57 // Used if we need to clear history. |
58 base::CancelableTaskTracker history_task_tracker_; | 58 base::CancelableTaskTracker history_task_tracker_; |
59 | 59 |
60 // The WebContents that holds the panel content. | 60 // The WebContents that holds the panel content. |
61 scoped_ptr<content::WebContents> web_contents_; | 61 scoped_ptr<content::WebContents> web_contents_; |
62 scoped_ptr<web_contents_delegate_android::WebContentsDelegateAndroid> | 62 scoped_ptr<web_contents_delegate_android::WebContentsDelegateAndroid> |
63 web_contents_delegate_; | 63 web_contents_delegate_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(ContextualSearchPanel); | 65 DISALLOW_COPY_AND_ASSIGN(OverlayPanelContent); |
66 }; | 66 }; |
67 | 67 |
68 bool RegisterContextualSearchPanel(JNIEnv* env); | 68 bool RegisterOverlayPanelContent(JNIEnv* env); |
69 | 69 |
70 #endif // CHROME_BROWSER_ANDROID_BOTTOMBAR_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_P
ANEL_H_ | 70 #endif // CHROME_BROWSER_ANDROID_BOTTOMBAR_OVERLAY_PANEL_CONTENT_H_ |
OLD | NEW |