Focus Omnibar in Google Chrome - google-chrome-extension

How do I bring the Omnibar into focus in Google Chrome after a given event?
I've heard API support for the Omnibar is rather limited, but is this possible?

From the Google Chrome Extensions Omnibox Documentation:
The omnibox API allows you to register a keyword with Google Chrome's address bar, which is also known as the omnibox.
Unfortunately, that's the extent of what's possible. You can only specify the response to the user's query with a keyword you've registered, nothing else. Their discussion groups confirm that there are no current plans to add any more functionality.

option+command+f on a Mac, although it does type out?

Related

How to disable Smart Reply in the new Gmail?

I like the new Gmail, and I like Inbox form Gmail, but I really cannot stand the "Smart Replies" feature, those poor already-made replies at the bottom of messages.
In the mobile app it is possible to disable the feature, but I cannot understand why this is not possible in the web version!
How can I disable Smart Reply?
UPDATE 10/1/18: You can now disable Smart Reply from Gmail's General Settings page. Scroll down to the Smart Reply section.
(PRIOR HACK FOR DISABLING: Use adblock. You can use Adblock for Chrome or any other adblock browser extension. It is just a div element with class="brb". If you want to add it manually the custom filter is mail.google.com##DIV[class="brb"], but depending on which extension you use you can usually right click the smart reply element and select "block".)

How to highlight elements in a Chrome Extension similar to how DevTools does it?

I'm interested in creating a Chrome Extension which lists all the elements on the webpage that have an 'id' attribute in a menu. Then, when the user clicks on the element in the menu, the corresponding element on the webpage is highlighted.
I saw Chrome devtools highlights an element when you right click and inspect on it. I'm curious if there is some highlighting API accessible from DevTools? If not, how does one highlight elements similar to how devtools does it?
You can use the exact API that Chrome DevTools are using. You will need to call highlightQuad or highlightNode via debugger API. You can even specify the color and you can be certain that the highlight will render correctly and not interfere with the website (injecting an 'overlay' node, as Xan suggested, doesn't guarantee that). On the other hand, it will be much trickier to get right and user won't be able to use both your extension and DevTools at the same time (there can be only one debugger API connection). This code should get you started.
Chrome API does not provide access to such highlighting; you'll need to implement it yourself with an overlay.
Chrome API does provide access to the same functionality as DevTools if you use the debugger API. See this answer for details.
Before Chrome 63 (2017-12-06), writing a DevTools extension (i.e. using devtools.* APIs to display UI in DevTools) and using debugger at the same time would've been impossible, as only one instance of a debugger protocol client was allowed at once. This has changed, so now it's a viable answer, even if the documentation for chrome.debugger API wasn't updated yet.
Even though it's now possible, be aware that debugger API is an API with heavy warnings (adding it after publication may auto-disable installed extensions - needs testing).
Below is the original answer:
You can implement the highlighting yourself with an overlay.
You can study how it's usually done by looking, for example, at the element picker of uBlock Origin.
In short, that method creates an SVG overlay using, among other things, getBoundingClientRect() of the elements selected.

Offer to change the default search engine for the omnibar

I'm looking to offer the user (inside my Chrome Extension) the option to change their Omnibox default search engine.
Sadly, I've been unable to find any documentation on how to do something like this. Has anyone does this before successfully?
Actually with new versions of chrome it's possible through chrome API via settings_override section. But for now it's working only on windows.
Not possible, sadly. See this bug filed in Chromium

Use Autoupdating in Google Chrome Web Store

I'm making an extension for Google Chrome and I use code for autoupdating. This is because the extension isn't yet in Google Chrome webstore. But in a few days I will upload it to the Webstore and Google says you can use the Webstores autoupdating. But if I don't want to use that, will my app still update by my own server, like the way it does now?
Thanks in advance!!
I agree that docs are not very clear about this:
If you publish your extension using the Chrome Developer Dashboard,
you can ignore this page. You can use the dashboard to release updated
versions of your extension to users, as well as to the Chrome Web
Store.
But, I've tested it myself and your update_url setting in manifest.json will be overridden when you publish your extension via Chrome Web Store (CWS). In other words, publishing to CWS means that you can't use self hosted autoupdating anymore.
The reasons for that, that I could think of, may be as follows:
CWS wants to keep track of each extension stats (i.e. number of users using each extension)
privacy concerns (people don't want you to track them when they update extension)
security concerns (each extension update must go through CWS verification process)
If you want to track people (please don't) use Google Analytics on i.e. background page of your extension.

Is there an API for making a Google Chrome extension that reads the network resource request activity?

In the Google Chrome developer window, there is a Network tab that shows you all the resources that a web page loads over time. Is there a way to access this data in a Google Chrome extension?
CLARIFICATION: I want to make a Chrome extension that needs to read this data and do something based on what it reads. So I should have asked, "is there a Chrome Extension API that allows this?"
There is experimental API for accessing network resources. Being experimental means that to use it users need to enable experimental API flag in their settings, plus you won't be able to submit such extension to the gallery.
Right click on the web page, select "Inspect Element", select the network tab then refresh

Resources