📜 ⬆️ ⬇️

The first mobile browser with support for Chromium extensions. New alpha Yandex Browser

Modern mobile browsers, like their desktop counterparts, should allow users to add missing features with add-ons. Despite the refusal of the Chromium team from the idea of ​​supporting extensions on Android, our team continues to work on this opportunity, and today we are inviting the Habr community to try the first Yandex.

image

The first additions appeared in Internet Explorer back in 1999, and over the next decade, the practice of opening access to the API became mandatory for any more or less popular browser. Now many of us cannot imagine working at a computer without the ability to add the necessary function to the browser with our own hands. But with Android, everything is not so. Despite the increase in the performance of modern mobile devices, browser extensions on Android are the exception rather than the rule.
')
Mobile browsers are not always taken seriously by users. In times of slow Internet and weak mobile devices, people preferred to solve their problems using a computer. Now their attitude is gradually changing. We are increasingly being asked to add specific features and tools to the product. We embed some of this into the Yandex Browser (for example, reading mode and translator). But it would be logical to solve many of the requests with the help of third-party add-ons, and not to overload the Browser. Add to this the traditional request to support add-ons on Android, which is often sent via feedback. In general, we began not to turn a blind eye to the changes around and began to develop.

There are two ways to support add-ons in the Android browser. You can provide an API with which other applications from Google Play would work. This practice is already familiar to many: for example, codecs for video players are often distributed as separate applications. We ourselves have done something similar just recently with ad blocking . This approach has two big drawbacks: the lack of add-ons at the start and the need to create your own bike, which would be incompatible with the add-ons for the desktop version of the browser. And we would like people to use on Android the same tools they are used to on the computer.

What is the second method, you guessed it. Extensions for Chrome and other browsers based on Chromium appeared in early 2010, and thousands of developers from all over the world have been creating their own tools over the years. Yandex.Browser, despite the functional differences, is also based on Chromium and supports the installation of add-ons on a computer. And it is quite logical in this situation to extend support also on Android. Nobody has done this before us, but what difficulties may there be, because everything works on Windows?



At first it may seem that all problems are in the absence of an interface for add-ons. This code is really not in the project , but we initially used our own interface, so it was even easier for us. But to draw an interface is a drop in the ocean, the main difficulties are not connected with it.

When we tried to build a Yandex. Browser for Android with the enable_extensions flag, we received about 600 compatibility errors. The inclusion flag for extensions, like the code responsible for them, was tied to the core to the desktop-specific environment. A small example for curious developers. Take a Browser object. Browser is the central controller of the desktop browser UI. It contains a lot of interesting things, including the TabStripModel model, which is actively used by tabs add-ons. But for Android, this is not going to happen. We begin to pull one thread, and pull out a whole heap of incompatibilities. And so at every turn.

The platform of extensions for 6 years has acquired a large number of API. And each of them may have dozens of methods with their unpredictable work on Android. Therefore, for starters, we supported the most popular features, which are quite enough for such additions as Evernote, LastPass, Ghostery, SaveFrom.net, Tampermonkey, Yandex.Pogoda and many others to work in alpha. By the way, with this we were helped by the developers of popular add-ons, which about a month ago we invited for closed testing of early builds. To make it easier for them to navigate in our capabilities, we wrote a diagnostic extension , which forms a visual report .



As for the sources of add-ons, then we traditionally do not limit people to any one directory and support the installation from the Chrome Web Store, Opera Addons, our own section of recommended add-ons, via inline-links or simply from the catalog on the SD card.



In conclusion, a few words about security. Our implementation of add-ons on Android is fully consistent with the generally accepted model , i.e. The add-ons work in the sandbox and are isolated from both the rest of the browser and the operating system. In addition, as on the desktop, we are able to block known malicious developments.

You can install the alpha version of Yandex Browser from Google Play . After the second cold start (alpha feature) in the settings you will find a whole section on add-ons. We would be grateful to the Habr community for feedback and ideas.

Source: https://habr.com/ru/post/309014/


All Articles