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