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

Unified Diff: chrome/browser/android/bottombar/contextualsearch/contextual_search_panel.h

Issue 1283223004: Contextual Search Panel should own ContentViewCore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Override wrappers instead of native 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/bottombar/contextualsearch/contextual_search_panel.h
diff --git a/chrome/browser/android/bottombar/contextualsearch/contextual_search_panel.h b/chrome/browser/android/bottombar/contextualsearch/contextual_search_panel.h
new file mode 100644
index 0000000000000000000000000000000000000000..c28734872507f2ac7c00ff43849cdadc2ccaa9ef
--- /dev/null
+++ b/chrome/browser/android/bottombar/contextualsearch/contextual_search_panel.h
@@ -0,0 +1,73 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_BOTTOMBAR_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_PANEL_H_
+#define CHROME_BROWSER_ANDROID_BOTTOMBAR_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_PANEL_H_
+
+#include "base/android/jni_android.h"
+#include "base/task/cancelable_task_tracker.h"
+#include "chrome/browser/android/contextualsearch/contextual_search_context.h"
+
+namespace content {
+class WebContents;
+} // namespace content
+
+namespace web_contents_delegate_android {
+class WebContentsDelegateAndroid;
+} // namespace web_contents_delegate_android
+
+// Manages the native extraction and request logic for Contextual Search,
+// and interacts with the Java ContextualSearchPanel for UX.
+// Most of the work is done by the associated ContextualSearchDelegate.
+class ContextualSearchPanel {
+ public:
+ // Constructs a native manager associated with the Java manager.
+ ContextualSearchPanel(JNIEnv* env, jobject obj);
+ virtual ~ContextualSearchPanel();
+
+ // Called by the Java ContextualSearchPanel when it is being destroyed.
+ void Destroy(JNIEnv* env, jobject obj);
+
+ // Removes a search URL from history. |search_start_time_ms| represents the
+ // time at which |search_url| was committed.
+ void RemoveLastHistoryEntry(JNIEnv* env,
+ jobject obj,
+ jstring search_url,
+ jlong search_start_time_ms);
+
+ // Takes ownership of the WebContents associated with the given
+ // |ContentViewCore| which holds the Contextual Search Results.
+ void SetWebContents(JNIEnv* env, jobject obj, jobject jcontent_view_core,
+ jobject jweb_contents_delegate);
+
+ // Destroys the WebContents.
+ void DestroyWebContents(JNIEnv* env, jobject jobj);
+
+ // Release ownership of WebContents.
+ void ReleaseWebContents(JNIEnv* env, jobject jobj);
+
+ // Sets the delegate used to convert navigations to intents.
+ void SetInterceptNavigationDelegate(JNIEnv* env,
+ jobject obj,
+ jobject delegate,
+ jobject jweb_contents);
+
+ private:
+ // Our global reference to the Java ContextualSearchPanel.
+ base::android::ScopedJavaGlobalRef<jobject> java_manager_;
+
+ // Used if we need to clear history.
+ base::CancelableTaskTracker history_task_tracker_;
+
+ // The WebContents that holds the panel content.
+ scoped_ptr<content::WebContents> web_contents_;
+ scoped_ptr<web_contents_delegate_android::WebContentsDelegateAndroid>
+ web_contents_delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContextualSearchPanel);
+};
+
+bool RegisterContextualSearchPanel(JNIEnv* env);
+
+#endif // CHROME_BROWSER_ANDROID_BOTTOMBAR_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_PANEL_H_

Powered by Google App Engine
This is Rietveld 408576698