mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1038227 - Record search history in Fennec. r=rnewman
This commit is contained in:
parent
10f1a84d09
commit
a10758f2ac
@ -390,6 +390,10 @@
|
||||
android:authorities="@ANDROID_PACKAGE_NAME@.db.readinglist"
|
||||
android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
|
||||
|
||||
<provider android:name="org.mozilla.gecko.db.SearchHistoryProvider"
|
||||
android:authorities="@ANDROID_PACKAGE_NAME@.db.searchhistory"
|
||||
android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
|
||||
|
||||
<service
|
||||
android:exported="false"
|
||||
android:name="org.mozilla.gecko.updater.UpdateService"
|
||||
|
@ -25,6 +25,7 @@ import org.mozilla.gecko.animation.PropertyAnimator;
|
||||
import org.mozilla.gecko.animation.ViewHelper;
|
||||
import org.mozilla.gecko.db.BrowserContract.Combined;
|
||||
import org.mozilla.gecko.db.BrowserContract.ReadingListItems;
|
||||
import org.mozilla.gecko.db.BrowserContract.SearchHistory;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.SuggestedSites;
|
||||
import org.mozilla.gecko.distribution.Distribution;
|
||||
@ -529,6 +530,7 @@ public class BrowserApp extends GeckoApp
|
||||
"Menu:Update",
|
||||
"Reader:Added",
|
||||
"Reader:FaviconRequest",
|
||||
"Search:Keyword",
|
||||
"Prompt:ShowTop",
|
||||
"Accounts:Exist");
|
||||
|
||||
@ -936,6 +938,7 @@ public class BrowserApp extends GeckoApp
|
||||
"Menu:Update",
|
||||
"Reader:Added",
|
||||
"Reader:FaviconRequest",
|
||||
"Search:Keyword",
|
||||
"Prompt:ShowTop",
|
||||
"Accounts:Exist");
|
||||
|
||||
@ -1383,6 +1386,8 @@ public class BrowserApp extends GeckoApp
|
||||
} else if (event.equals("Reader:FaviconRequest")) {
|
||||
final String url = message.getString("url");
|
||||
handleReaderFaviconRequest(url);
|
||||
} else if (event.equals("Search:Keyword")) {
|
||||
storeSearchQuery(message.getString("query"));
|
||||
} else if (event.equals("Prompt:ShowTop")) {
|
||||
// Bring this activity to front so the prompt is visible..
|
||||
Intent bringToFrontIntent = new Intent();
|
||||
@ -1806,6 +1811,27 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store search query in SearchHistoryProvider.
|
||||
*
|
||||
* @param query
|
||||
* a search query to store. We won't store empty queries.
|
||||
*/
|
||||
private void storeSearchQuery(String query) {
|
||||
if (TextUtils.isEmpty(query)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(SearchHistory.QUERY, query);
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getContentResolver().insert(SearchHistory.CONTENT_URI, values);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void filterEditingMode(String searchTerm, AutocompleteHandler handler) {
|
||||
if (TextUtils.isEmpty(searchTerm)) {
|
||||
hideBrowserSearch();
|
||||
@ -2849,6 +2875,7 @@ public class BrowserApp extends GeckoApp
|
||||
@Override
|
||||
public void onSearch(SearchEngine engine, String text) {
|
||||
recordSearch(engine, "barsuggest");
|
||||
storeSearchQuery(text);
|
||||
openUrlAndStopEditing(text, engine.name);
|
||||
}
|
||||
|
||||
|
@ -1595,6 +1595,7 @@ var BrowserApp = {
|
||||
type: "Search:Keyword",
|
||||
identifier: engine.identifier,
|
||||
name: engine.name,
|
||||
query: aData
|
||||
});
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user