Closed Bug 725213 Opened 12 years ago Closed 12 years ago

Add search engines from text input fields

Categories

(Firefox for Android Graveyard :: General, defect, P3)

ARM
Android
defect

Tracking

(firefox18 verified)

VERIFIED FIXED
Firefox 13
Tracking Status
firefox18 --- verified

People

(Reporter: bnicholson, Assigned: bnicholson)

References

Details

Attachments

(3 files, 2 obsolete files)

Currently, the only way to add a search engine to the AwesomeScreen is by installing a search add-on. We can make search engines much easier to install by allowing users to turn any input box into a search engine.
Attachment #595327 - Flags: review?(mark.finkle)
This patch allows a user to add a search engine from any text input field's context menu.

Example:
- Navigate to https://bugzilla.mozilla.org
- Long press on the search box
- Name the engine "Bugzilla"
- Type a bug number in the AwesomeScreen search
- Click Bugzilla
Attachment #595328 - Flags: review?(mark.finkle)
Let's get a build to Madhava to try out.
Attachment #595327 - Flags: review?(mark.finkle) → review+
Comment on attachment 595328 [details] [diff] [review]
(2/2) add search engines from text input

If you had the favicon in browser.js, you could do all of this in JS. You could use a promptservice prompt dialog to get the name.

I don't like the back-n-forth between JS and Java for this. I'd like to see if we could find a way to keep this in JS. We could use JS sqlite query on the browser.db IMAGES table to find the favicon for this page.
Attachment #595328 - Flags: review?(mark.finkle) → review-
Priority: -- → P3
Attached image screenshots
giving r? to madhava to confirm design shown in screenshots
Attachment #604854 - Flags: review?(madhava)
Attachment #604854 - Flags: review?(madhava) → review+
moved favicon/prompt logic to js
Attachment #595328 - Attachment is obsolete: true
Attachment #605227 - Flags: review?(mark.finkle)
minor change that removes the searchEngines.defaultName string and instead uses the hostname of the document URL (when there is no page title)
Attachment #605227 - Attachment is obsolete: true
Attachment #605227 - Flags: review?(mark.finkle)
Attachment #605252 - Flags: review?(mark.finkle)
Comment on attachment 605252 [details] [diff] [review]
(2/2) add search engines from text input v3

>diff --git a/mobile/android/base/AwesomeBarTabs.java b/mobile/android/base/AwesomeBarTabs.java

>-            if (drawable != null)
>-                faviconView.setImageDrawable(drawable);
>+            faviconView.setImageDrawable(drawable);

Why are we dropping the check? getDrawableFromDataURI still can return null, right?

>diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js

>+  addEngine: function addEngine(aElement) {

>+        Services.search.addEngineWithDetails(name, favicon, null, null, method, formURL);
>+        let engine = Services.search.getEngineByName(name);
>+        engine.wrappedJSObject._queryCharset = charset;

Is the _queryCharset ever saved by the search engine? I suppose it has to be saved to work.

r+ but leave the null check unless you can explain why it's not needed.
Attachment #605252 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/mozilla-central/rev/f48345d39a26
https://hg.mozilla.org/mozilla-central/rev/4434a5371bbc
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 13
Depends on: 779497
Depends on: 779739
Depends on: 790898
Add Search Engine option was added on the latest Nightly build. Closing bug as verified fixed on:

Firefox 18.0a1 (2012-09-19)
Device: Galaxy Note
OS: Android 4.0.4
Status: RESOLVED → VERIFIED
(In reply to Mark Finkle (:mfinkle) from comment #8)

> >diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js
> 
> >+  addEngine: function addEngine(aElement) {
> 
> >+        Services.search.addEngineWithDetails(name, favicon, null, null, method, formURL);
> >+        let engine = Services.search.getEngineByName(name);
> >+        engine.wrappedJSObject._queryCharset = charset;
> 
> Is the _queryCharset ever saved by the search engine? I suppose it has to be
> saved to work.

Relying on wrappedJSObject to access private properties of the engine isn't clean. In the future when something is missing, please consider extending the idl interface.
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: