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

Side by Side Diff: chrome/browser/android/contextualsearch/contextual_search_manager.h

Issue 2315323002: Pass JavaRef to WebContents::FromJavaWebContents. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/android/contextualsearch/contextual_search_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_
6 #define CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ 6 #define CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/task/cancelable_task_tracker.h" 12 #include "base/task/cancelable_task_tracker.h"
13 #include "chrome/browser/android/contextualsearch/contextual_search_context.h" 13 #include "chrome/browser/android/contextualsearch/contextual_search_context.h"
14 #include "chrome/browser/android/contextualsearch/contextual_search_delegate.h" 14 #include "chrome/browser/android/contextualsearch/contextual_search_delegate.h"
15 #include "components/contextual_search/browser/contextual_search_js_api_handler. h" 15 #include "components/contextual_search/browser/contextual_search_js_api_handler. h"
16 16
17 // Manages the native extraction and request logic for Contextual Search, 17 // Manages the native extraction and request logic for Contextual Search,
18 // and interacts with the Java ContextualSearchManager for UX. 18 // and interacts with the Java ContextualSearchManager for UX.
19 // Most of the work is done by the associated ContextualSearchDelegate. 19 // Most of the work is done by the associated ContextualSearchDelegate.
20 class ContextualSearchManager 20 class ContextualSearchManager
21 : public contextual_search::ContextualSearchJsApiHandler { 21 : public contextual_search::ContextualSearchJsApiHandler {
22 public: 22 public:
23 // Constructs a native manager associated with the Java manager. 23 // Constructs a native manager associated with the Java manager.
24 ContextualSearchManager(JNIEnv* env, jobject obj); 24 ContextualSearchManager(JNIEnv* env,
25 const base::android::JavaRef<jobject>& obj);
25 ~ContextualSearchManager() override; 26 ~ContextualSearchManager() override;
26 27
27 // Called by the Java ContextualSearchManager when it is being destroyed. 28 // Called by the Java ContextualSearchManager when it is being destroyed.
28 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 29 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
29 30
30 // Starts the request to get the search terms to use for the given selection, 31 // Starts the request to get the search terms to use for the given selection,
31 // by accessing our server with the content of the page (from the given 32 // by accessing our server with the content of the page (from the given
32 // content view core object). 33 // content view core object).
33 // Any outstanding server requests are canceled. 34 // Any outstanding server requests are canceled.
34 // When the server responds with the search term, the Java object is notified 35 // When the server responds with the search term, the Java object is notified
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 // The delegate we're using the do the real work. 91 // The delegate we're using the do the real work.
91 std::unique_ptr<ContextualSearchDelegate> delegate_; 92 std::unique_ptr<ContextualSearchDelegate> delegate_;
92 93
93 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager); 94 DISALLOW_COPY_AND_ASSIGN(ContextualSearchManager);
94 }; 95 };
95 96
96 bool RegisterContextualSearchManager(JNIEnv* env); 97 bool RegisterContextualSearchManager(JNIEnv* env);
97 98
98 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_ 99 #endif // CHROME_BROWSER_ANDROID_CONTEXTUALSEARCH_CONTEXTUAL_SEARCH_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/contextualsearch/contextual_search_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698