diff --git a/browser/BUILD.gn b/browser/BUILD.gn index 18ba1c631b2..3accf069589 100644 --- a/browser/BUILD.gn +++ b/browser/BUILD.gn @@ -32,6 +32,7 @@ source_set("browser") { deps = [ "//brave/components/brave_shields/browser:brave_shields", + "//brave/components/omnibox/browser:brave_autocomplete", "extensions", "net", "ui", diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn new file mode 100644 index 00000000000..565f9cb07ef --- /dev/null +++ b/components/omnibox/browser/BUILD.gn @@ -0,0 +1,15 @@ +source_set("brave_autocomplete") { + sources = [ + "brave_autocomplete_controller.cc", + "brave_autocomplete_controller.h", + "topsites_provider_data.cc", + "topsites_provider.cc", + "topsites_provider.h", + ] + + deps = [ + ] + public_deps = [ + "//chrome/common", + ] +} diff --git a/components/omnibox/browser/brave_autocomplete_controller.cc b/components/omnibox/browser/brave_autocomplete_controller.cc new file mode 100644 index 00000000000..7ef98f4e10d --- /dev/null +++ b/components/omnibox/browser/brave_autocomplete_controller.cc @@ -0,0 +1,27 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#include "brave/components/omnibox/browser/brave_autocomplete_controller.h" +#include "brave/components/omnibox/browser/topsites_provider.h" + + + +BraveAutocompleteController::BraveAutocompleteController( + std::unique_ptr provider_client, + AutocompleteControllerDelegate* delegate, + int provider_types) : + AutocompleteController( + std::move(provider_client), + delegate, + provider_types) + { + if (provider_types & AutocompleteProvider::TYPE_SEARCH) { + providers_.push_back(new TopSitesProvider(provider_client_.get())); + } + } + + BraveAutocompleteController::~BraveAutocompleteController() { + + } diff --git a/components/omnibox/browser/brave_autocomplete_controller.h b/components/omnibox/browser/brave_autocomplete_controller.h new file mode 100644 index 00000000000..94f787fc3d0 --- /dev/null +++ b/components/omnibox/browser/brave_autocomplete_controller.h @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +#ifndef COMPONENTS_OMNIBOX_BROWSER_BRAVE_AUTOCOMPLETE_CONTROLLER_H_ +#define COMPONENTS_OMNIBOX_BROWSER_BRAVE_AUTOCOMPLETE_CONTROLLER_H_ + +#include "components/omnibox/browser/autocomplete_controller.h" + +class BraveAutocompleteController : public AutocompleteController { +public: + BraveAutocompleteController( + std::unique_ptr provider_client, + AutocompleteControllerDelegate* delegate, + int provider_types); + ~BraveAutocompleteController() override; +}; + + +#endif // COMPONENTS_OMNIBOX_BROWSER_BRAVE_AUTOCOMPLETE_CONTROLLER_H_ diff --git a/components/omnibox/browser/topsites_provider.cc b/components/omnibox/browser/topsites_provider.cc new file mode 100644 index 00000000000..81ecb445d19 --- /dev/null +++ b/components/omnibox/browser/topsites_provider.cc @@ -0,0 +1,91 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "brave/components/omnibox/browser/topsites_provider.h" + +#include + +#include + +#include "base/strings/string_util.h" +#include "base/strings/utf_string_conversions.h" +#include "components/omnibox/browser/autocomplete_input.h" +#include "components/omnibox/browser/history_provider.h" + +// As from autocomplete_provider.h: +// Search Secondary Provider (suggestion) | 100++ +const int TopSitesProvider::kRelevance = 100; + + +TopSitesProvider::TopSitesProvider(AutocompleteProviderClient* client) + : AutocompleteProvider(AutocompleteProvider::TYPE_SEARCH) { +} + +void TopSitesProvider::Start(const AutocompleteInput& input, + bool minimal_changes) { + matches_.clear(); + if (input.from_omnibox_focus() || + (input.type() == metrics::OmniboxInputType::INVALID) || + (input.type() == metrics::OmniboxInputType::QUERY)) + return; + + const std::string input_text = base::ToLowerASCII(base::UTF16ToASCII(input.text())); + + for (std::vector::const_iterator i = top_sites_.begin(); + (i != top_sites_.end()) && (matches_.size() < kMaxMatches); ++i) { + + const std::string ¤t_site = *i; + size_t foundPos = current_site.find(input_text); + if (std::string::npos != foundPos) { + ACMatchClassifications styles = StylesForSingleMatch(input_text, current_site, foundPos); + AddMatch(base::ASCIIToUTF16(current_site), styles); + } + } + + for (size_t i = 0; i < matches_.size(); ++i) + matches_[i].relevance = kRelevance + matches_.size() - (i + 1); + if (!HistoryProvider::PreventInlineAutocomplete(input) && + (matches_.size() == 1) && !matches_[0].inline_autocompletion.empty()) { + // If there's only one possible completion of the user's input and + // allowing completions is okay, give the match a high enough score to + // allow it to beat url-what-you-typed and be inlined. + matches_[0].relevance = 1250; + matches_[0].allowed_to_be_default_match = true; + } +} + +TopSitesProvider::~TopSitesProvider() {} + +//static +ACMatchClassifications TopSitesProvider::StylesForSingleMatch( + const std::string &input_text, + const std::string &site, + const size_t &foundPos) { + ACMatchClassifications styles; + if (foundPos == 0) { + styles.push_back(ACMatchClassification(0, ACMatchClassification::URL|ACMatchClassification::MATCH)); + if (site.length() > input_text.length()) { + styles.push_back(ACMatchClassification(input_text.length(), ACMatchClassification::URL)); + } + } else { + styles.push_back(ACMatchClassification(0, ACMatchClassification::URL)); + styles.push_back(ACMatchClassification(foundPos, ACMatchClassification::URL|ACMatchClassification::MATCH)); + if (site.length() > foundPos + input_text.length()) { + styles.push_back(ACMatchClassification(foundPos + input_text.length(), 0)); + } + } + return styles; +} + +void TopSitesProvider::AddMatch(const base::string16& match_string, + const ACMatchClassifications& styles) { + static const base::string16 kScheme = base::ASCIIToUTF16("https://"); + AutocompleteMatch match(this, kRelevance, false, + AutocompleteMatchType::NAVSUGGEST); + match.fill_into_edit = match_string; + match.destination_url = GURL(kScheme + match_string); + match.contents = match_string; + match.contents_class = styles; + matches_.push_back(match); +} diff --git a/components/omnibox/browser/topsites_provider.h b/components/omnibox/browser/topsites_provider.h new file mode 100644 index 00000000000..9c1ff58df45 --- /dev/null +++ b/components/omnibox/browser/topsites_provider.h @@ -0,0 +1,44 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef COMPONENTS_OMNIBOX_BROWSER_TOPSITES_PROVIDER_H_ +#define COMPONENTS_OMNIBOX_BROWSER_TOPSITES_PROVIDER_H_ + +#include + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/strings/string16.h" +#include "components/omnibox/browser/autocomplete_match.h" +#include "components/omnibox/browser/autocomplete_provider.h" + +class AutocompleteProviderClient; + +// This is the provider for top Alexa 500 sites URLs +class TopSitesProvider : public AutocompleteProvider { + public: + explicit TopSitesProvider(AutocompleteProviderClient* client); + + // AutocompleteProvider: + void Start(const AutocompleteInput& input, bool minimal_changes) override; + + private: + ~TopSitesProvider() override; + + static const int kRelevance; + + static std::vector top_sites_; + + void AddMatch(const base::string16& match_string, + const ACMatchClassifications& styles); + + static ACMatchClassifications StylesForSingleMatch( + const std::string &input_text, + const std::string &site, + const size_t &foundPos); + + DISALLOW_COPY_AND_ASSIGN(TopSitesProvider); +}; + +#endif // COMPONENTS_OMNIBOX_BROWSER_TOPSITES_PROVIDER_H_ diff --git a/components/omnibox/browser/topsites_provider_data.cc b/components/omnibox/browser/topsites_provider_data.cc new file mode 100644 index 00000000000..bd668a50603 --- /dev/null +++ b/components/omnibox/browser/topsites_provider_data.cc @@ -0,0 +1,512 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "brave/components/omnibox/browser/topsites_provider.h" +#include + + +std::vector TopSitesProvider::top_sites_ = { + "google.com", + "gmail.com", + "mail.google.com", + "maps.google.com", + "calendar.google.com", + "facebook.com", + "youtube.com", + "yahoo.com", + "baidu.com", + "wikipedia.org", + "qq.com", + "taobao.com", + "twitter.com", + "live.com", + "linkedin.com", + "sina.com.cn", + "amazon.com", + "amazon.ca", + "hao123.com", + "google.co.in", + "blogspot.com", + "weibo.com", + "wordpress.com", + "360.cn", + "yandex.ru", + "yahoo.co.jp", + "bing.com", + "tmall.com", + "vk.com", + "ebay.com", + "sohu.com", + "google.de", + "pinterest.com", + "163.com", + "ask.com", + "google.co.uk", + "soso.com", + "google.fr", + "msn.com", + "tumblr.com", + "google.co.jp", + "mail.ru", + "instagram.com", + "microsoft.com", + "google.com.br", + "google.ru", + "paypal.com", + "imdb.com", + "google.es", + "apple.com", + "google.it", + "xinhuanet.com", + "amazon.co.jp", + "craigslist.org", + "neobux.com", + "imgur.com", + "stackoverflow.com", + "ifeng.com", + "google.com.mx", + "bbc.co.uk", + "google.com.hk", + "adcash.com", + "blogger.com", + "news.ycombinator.com", + "reddit.com", + "slashdot.org", + "digg.com", + "duckduckgo.com", + "startpage.com", + "wolframalpha.com", + "infogalactic.com", + "qwant.com", + "searx.me", + "ecosia.org", + "semanticscholar.org", + "fc2.com", + "cnn.com", + "google.ca", + "t.co", + "akamaihd.net", + "vube.com", + "go.com", + "people.com.cn", + "wordpress.org", + "about.com", + "adobe.com", + "alipay.com", + "odnoklassniki.ru", + "conduit.com", + "youku.com", + "googleusercontent.com", + "gmw.cn", + "google.com.tr", + "flickr.com", + "alibaba.com", + "aliexpress.com", + "godaddy.com", + "huffingtonpost.com", + "amazon.de", + "google.com.au", + "blogspot.in", + "ebay.de", + "netflix.com", + "khanacademy.org", + "kickass.to", + "google.pl", + "ku6.com", + "bp.blogspot.com", + "thepiratebay.se", + "dailymotion.com", + "weather.com", + "vimeo.com", + "dailymail.co.uk", + "cnet.com", + "espn.go.com", + "ebay.co.uk", + "rakuten.co.jp", + "indiatimes.com", + "themeforest.net", + "aol.com", + "amazonaws.com", + "uol.com.br", + "amazon.co.uk", + "google.com.sa", + "dropbox.com", + "google.com.ar", + "nytimes.com", + "slideshare.net", + "google.com.eg", + "pixnet.net", + "globo.com", + "adf.ly", + "china.com", + "secureserver.net", + "m2newmedia.com", + "directrev.com", + "buzzfeed.com", + "mozilla.org", + "wikimedia.org", + "fiverr.com", + "google.com.pk", + "ameblo.jp", + "booking.com", + "google.nl", + "livejournal.com", + "deviantart.com", + "yelp.com", + "sogou.com", + "google.com.tw", + "flipkart.com", + "wikia.com", + "hootsuite.com", + "blogfa.com", + "developunit.info", + "etsy.com", + "outbrain.com", + "wikihow.com", + "avg.com", + "google.co.th", + "clkmon.com", + "google.co.za", + "stumbleupon.com", + "soundcloud.com", + "livedoor.com", + "4shared.com", + "w3schools.com", + "badoo.com", + "sourceforge.net", + "files.wordpress.com", + "archive.org", + "mediafire.com", + "google.co.ve", + "theguardian.com", + "liveinternet.ru", + "bankofamerica.com", + "addthis.com", + "aweber.com", + "forbes.com", + "foxnews.com", + "ask.fm", + "answers.com", + "indeed.com", + "chase.com", + "bet365.com", + "salesforce.com", + "gameforge.com", + "china.com.cn", + "hostgator.com", + "naver.com", + "espncricinfo.com", + "skype.com", + "google.gr", + "github.com", + "softonic.com", + "statcounter.com", + "google.com.co", + "google.co.id", + "reference.com", + "onet.pl", + "spiegel.de", + "nicovideo.jp", + "shutterstock.com", + "google.be", + "allegro.pl", + "walmart.com", + "google.com.ua", + "google.com.vn", + "google.com.ng", + "mailchimp.com", + "stackexchange.com", + "sharelive.net", + "so.com", + "gamer.com.tw", + "tripadvisor.com", + "zillow.com", + "wsj.com", + "wix.com", + "popads.net", + "loading-delivery1.com", + "google.ro", + "wellsfargo.com", + "wordreference.com", + "goo.ne.jp", + "bild.de", + "photobucket.com", + "pandora.com", + "google.se", + "bleacherreport.com", + "pcpop.com", + "media.tumblr.com", + "naver.jp", + "warriorforum.com", + "babylon.com", + "zedo.com", + "weebly.com", + "google.dz", + "taringa.net", + "blogspot.com.es", + "google.at", + "rutracker.org", + "php.net", + "google.com.ph", + "ups.com", + "39.net", + "leboncoin.fr", + "mashable.com", + "businessinsider.com", + "goodreads.com", + "quikr.com", + "usatoday.com", + "dmm.co.jp", + "ucoz.ru", + "gmx.net", + "rambler.ru", + "rediff.com", + "domaintools.com", + "telegraph.co.uk", + "google.com.pe", + "comcast.net", + "intuit.com", + "kaskus.co.id", + "tianya.cn", + "avito.ru", + "ettoday.net", + "thefreedictionary.com", + "wp.pl", + "ikea.com", + "google.ch", + "amazon.fr", + "lpcloudsvr302.com", + "goal.com", + "hurriyet.com.tr", + "uploaded.net", + "ndtv.com", + "baomihua.com", + "usps.com", + "xcar.com.cn", + "coccoc.com", + "moz.com", + "google.cl", + "google.pt", + "iqiyi.com", + "pchome.net", + "codecanyon.net", + "adrotator.se", + "goodgamestudios.com", + "twitch.tv", + "google.com.bd", + "ci123.com", + "google.com.sg", + "huanqiu.com", + "fedex.com", + "nbcnews.com", + "web.de", + "onclickads.net", + "it168.com", + "bitly.com", + "google.ae", + "washingtonpost.com", + "ehow.com", + "milliyet.com.tr", + "google.co.kr", + "suning.com", + "enet.com.cn", + "9gag.com", + "delta-search.com", + "hp.com", + "disqus.com", + "samsung.com", + "sochi2014.com", + "bitauto.com", + "xuite.net", + "daum.net", + "meetup.com", + "varzesh3.com", + "olx.in", + "myntra.com", + "snapdeal.com", + "scribd.com", + "extratorrent.cc", + "infusionsoft.com", + "4dsply.com", + "mercadolivre.com.br", + "tmz.com", + "orange.fr", + "google.cz", + "reuters.com", + "constantcontact.com", + "chinaz.com", + "nih.gov", + "eazel.com", + "accuweather.com", + "java.com", + "hulu.com", + "bloomberg.com", + "free.fr", + "xywy.com", + "detik.com", + "libero.it", + "speedtest.net", + "mobile01.com", + "clickbank.com", + "microsoftonline.com", + "yandex.com", + "yandex.ua", + "gsmarena.com", + "bluehost.com", + "bbc.com", + "time.com", + "webmd.com", + "marca.com", + "hudong.com", + "kooora.com", + "histats.com", + "caijing.com.cn", + "xing.com", + "americanexpress.com", + "kwejk.pl", + "ad6media.fr", + "cj.com", + "in.com", + "bestbuy.com", + "zippyshare.com", + "mywebsearch.com", + "google.co.hu", + "nba.com", + "adnxs.com", + "elpais.com", + "amazon.cn", + "intoday.in", + "tinyurl.com", + "google.no", + "ign.com", + "cloudfront.net", + "hdfcbank.com", + "ebay.in", + "snapdo.com", + "lenta.ru", + "techcrunch.com", + "google.ie", + "getresponse.com", + "force.com", + "irs.gov", + "tagged.com", + "zendesk.com", + "pof.com", + "rt.com", + "cnzz.com", + "repubblica.it", + "google.az", + "douban.com", + "plugrush.com", + "groupon.com", + "siteadvisor.com", + "google.cn", + "seznam.cz", + "ero-advertising.com", + "kakaku.com", + "w3.org", + "elmundo.es", + "xe.com", + "feedly.com", + "list-manage.com", + "t-online.de", + "dell.com", + "nydailynews.com", + "amazon.in", + "cntv.cn", + "ameba.jp", + "jrj.com.cn", + "surveymonkey.com", + "target.com", + "yaolan.com", + "ebay.com.au", + "odesk.com", + "uimserv.net", + "okcupid.com", + "ce.cn", + "rbc.ru", + "doorblog.jp", + "joomla.org", + "doubleclick.com", + "upworthy.com", + "habrahabr.ru", + "zimbio.com", + "life.com.tw", + "naukri.com", + "istockphoto.com", + "aili.com", + "zing.vn", + "ebay.it", + "jimdo.com", + "fbcdn.net", + "blogspot.de", + "google.co.il", + "mama.cn", + "google.dk", + "blackhatworld.com", + "webmoney.ru", + "lenovo.com", + "flipora.com", + "freelancer.com", + "latimes.com", + "gazeta.pl", + "justdial.com", + "eyny.com", + "match.com", + "pcbaby.com.cn", + "retailmenot.com", + "4399.com", + "drudgereport.com", + "quora.com", + "abcnews.go.com", + "informer.com", + "att.com", + "mysearchdial.com", + "sahibinden.com", + "google.fi", + "capitalone.com", + "elance.com", + "icicibank.com", + "ck101.com", + "teensdigest.com", + "goo.gl", + "probux.com", + "issuu.com", + "ig.com.br", + "twoo.com", + "qtrax.com", + "pch.com", + "blogspot.ru", + "lifehacker.com", + "subscene.com", + "jabong.com", + "blogspot.it", + "jd.com", + "hypergames.net", + "xda-developers.com", + "livescore.com", + "empowernetwork.com", + "iminent.com", + "xgo.com.cn", + "irctc.co.in", + "sberbank.ru", + "foxsports.com", + "kinopoisk.ru", + "exoclick.com", + "rednet.cn", + "pcgames.com.cn", + "ning.com", + "lady8844.com", + "wideinfo.org", + "webcrawler.com", + "yesky.com", + "trulia.com", + "zeobit.com", + "searchfun.in", + "babytree.com", + "youm7.com", + "123rf.com", + "commentcamarche.net", + "brave.com" +}; diff --git a/patches/chrome-browser-android-omnibox-autocomplete_controller_android.cc.patch b/patches/chrome-browser-android-omnibox-autocomplete_controller_android.cc.patch new file mode 100644 index 00000000000..3f23e21a127 --- /dev/null +++ b/patches/chrome-browser-android-omnibox-autocomplete_controller_android.cc.patch @@ -0,0 +1,40 @@ +diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chrome/browser/android/omnibox/autocomplete_controller_android.cc +index 61c41d19e2fbf7c43bbf5ce9afb5ece667bfadb9..4270226c3150119ee8ea8d000e64649424bbb012 100644 +--- a/chrome/browser/android/omnibox/autocomplete_controller_android.cc ++++ b/chrome/browser/android/omnibox/autocomplete_controller_android.cc +@@ -56,6 +56,8 @@ + #include "net/base/registry_controlled_domains/registry_controlled_domain.h" + #include "ui/base/device_form_factor.h" + ++#include "brave/components/omnibox/browser/brave_autocomplete_controller.h" ++ + using base::android::AttachCurrentThread; + using base::android::ConvertJavaStringToUTF16; + using base::android::ConvertUTF8ToJavaString; +@@ -90,7 +92,7 @@ class ZeroSuggestPrefetcher : public AutocompleteControllerDelegate { + }; + + ZeroSuggestPrefetcher::ZeroSuggestPrefetcher(Profile* profile) +- : controller_(new AutocompleteController( ++ : controller_(new BraveAutocompleteController( + base::MakeUnique(profile), + this, + AutocompleteProvider::TYPE_ZERO_SUGGEST)) { +@@ -127,7 +129,7 @@ void ZeroSuggestPrefetcher::OnResultChanged(bool default_match_changed) { + } // namespace + + AutocompleteControllerAndroid::AutocompleteControllerAndroid(Profile* profile) +- : autocomplete_controller_(new AutocompleteController( ++ : autocomplete_controller_(new BraveAutocompleteController( + base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), + this, + AutocompleteClassifier::DefaultOmniboxProviders())), +@@ -344,7 +346,7 @@ AutocompleteControllerAndroid::Factory::~Factory() { + + KeyedService* AutocompleteControllerAndroid::Factory::BuildServiceInstanceFor( + content::BrowserContext* profile) const { +- return new AutocompleteControllerAndroid(static_cast(profile)); ++ return new BraveAutocompleteControllerAndroid(static_cast(profile)); + } + + AutocompleteControllerAndroid::~AutocompleteControllerAndroid() { diff --git a/patches/chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch b/patches/chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch new file mode 100644 index 00000000000..0eddd6004e3 --- /dev/null +++ b/patches/chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch @@ -0,0 +1,22 @@ +diff --git a/chrome/browser/autocomplete/autocomplete_classifier_factory.cc b/chrome/browser/autocomplete/autocomplete_classifier_factory.cc +index 546f574bd2d3577413f2d13cfa058bf90c3c77bf..eb4364774a6f53e718d860e7ff533d6b666a86d0 100644 +--- a/chrome/browser/autocomplete/autocomplete_classifier_factory.cc ++++ b/chrome/browser/autocomplete/autocomplete_classifier_factory.cc +@@ -23,6 +23,8 @@ + #include "extensions/browser/extensions_browser_client.h" + #endif + ++#include "brave/components/omnibox/browser/brave_autocomplete_controller.h" ++ + // static + AutocompleteClassifier* AutocompleteClassifierFactory::GetForProfile( + Profile* profile) { +@@ -40,7 +42,7 @@ std::unique_ptr AutocompleteClassifierFactory::BuildInstanceFor( + content::BrowserContext* context) { + Profile* profile = static_cast(context); + return base::MakeUnique( +- base::WrapUnique(new AutocompleteController( ++ base::WrapUnique(new BraveAutocompleteController( + base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), NULL, + AutocompleteClassifier::DefaultOmniboxProviders())), + std::unique_ptr( diff --git a/patches/chrome-browser-profiles-profile.cc.patch b/patches/chrome-browser-profiles-profile.cc.patch new file mode 100644 index 00000000000..2047f247a2d --- /dev/null +++ b/patches/chrome-browser-profiles-profile.cc.patch @@ -0,0 +1,13 @@ +diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc +index 9bfac125046c9cc34f1e4440a1ebc5dfc2c93af2..243f176e3bc388d1b89760526a0639a408823ddf 100644 +--- a/chrome/browser/profiles/profile.cc ++++ b/chrome/browser/profiles/profile.cc +@@ -136,7 +136,7 @@ const char Profile::kNoHostedDomainFound[] = "NO_HOSTED_DOMAIN"; + void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterBooleanPref( + prefs::kSearchSuggestEnabled, +- true, ++ false, + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); + #if defined(OS_ANDROID) + registry->RegisterStringPref( diff --git a/patches/chrome-browser-ui-app_list-search-omnibox_provider.cc.patch b/patches/chrome-browser-ui-app_list-search-omnibox_provider.cc.patch new file mode 100644 index 00000000000..02a2c1892e7 --- /dev/null +++ b/patches/chrome-browser-ui-app_list-search-omnibox_provider.cc.patch @@ -0,0 +1,21 @@ +diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.cc b/chrome/browser/ui/app_list/search/omnibox_provider.cc +index fbf7b26028ebd2a1d764c3494387ac1373be8b1f..c09de3e559f5833ef5a10b41dd61a7daced2b07a 100644 +--- a/chrome/browser/ui/app_list/search/omnibox_provider.cc ++++ b/chrome/browser/ui/app_list/search/omnibox_provider.cc +@@ -18,13 +18,15 @@ + #include "ui/app_list/search_result.h" + #include "url/gurl.h" + ++#include "brave/components/omnibox/browser/brave_autocomplete_controller.h" ++ + namespace app_list { + + OmniboxProvider::OmniboxProvider(Profile* profile, + AppListControllerDelegate* list_controller) + : profile_(profile), + list_controller_(list_controller), +- controller_(new AutocompleteController( ++ controller_(new BraveAutocompleteController( + base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), + this, + AutocompleteClassifier::DefaultOmniboxProviders() & diff --git a/patches/chrome-browser-ui-views-frame-test_with_browser_view.cc.patch b/patches/chrome-browser-ui-views-frame-test_with_browser_view.cc.patch new file mode 100644 index 00000000000..545b961278b --- /dev/null +++ b/patches/chrome-browser-ui-views-frame-test_with_browser_view.cc.patch @@ -0,0 +1,13 @@ +diff --git a/chrome/browser/ui/views/frame/test_with_browser_view.cc b/chrome/browser/ui/views/frame/test_with_browser_view.cc +index 9ac0dfe768c298ad160f476e6ac0a06ea9c55af9..9d007454e65e840eef137e68054c4f9266756a4e 100644 +--- a/chrome/browser/ui/views/frame/test_with_browser_view.cc ++++ b/chrome/browser/ui/views/frame/test_with_browser_view.cc +@@ -52,7 +52,7 @@ std::unique_ptr CreateAutocompleteClassifier( + content::BrowserContext* context) { + Profile* profile = static_cast(context); + return base::MakeUnique( +- base::WrapUnique(new AutocompleteController( ++ base::WrapUnique(new BraveAutocompleteController( + base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), + + nullptr, AutocompleteClassifier::DefaultOmniboxProviders())), diff --git a/patches/chrome-browser-ui-webui-omnibox-omnibox_page_handler.cc.patch b/patches/chrome-browser-ui-webui-omnibox-omnibox_page_handler.cc.patch new file mode 100644 index 00000000000..71a4b4d37d3 --- /dev/null +++ b/patches/chrome-browser-ui-webui-omnibox-omnibox_page_handler.cc.patch @@ -0,0 +1,22 @@ +diff --git a/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc b/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc +index 66dc8e32404e169cb40cd5a56cbfe166d9709dbe..028a37bad232a5f1691e5e6d20b4932399ccd866 100644 +--- a/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc ++++ b/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc +@@ -34,6 +34,8 @@ + #include "components/search_engines/template_url.h" + #include "content/public/browser/web_ui.h" + ++#include "brave/components/omnibox/browser/brave_autocomplete_controller.h" ++ + using bookmarks::BookmarkModel; + + namespace mojo { +@@ -209,7 +211,7 @@ void OmniboxPageHandler::StartOmniboxQuery(const std::string& input_string, + } + + void OmniboxPageHandler::ResetController() { +- controller_.reset(new AutocompleteController( ++ controller_.reset(new BraveAutocompleteController( + base::MakeUnique(profile_), this, + AutocompleteClassifier::DefaultOmniboxProviders())); + } diff --git a/patches/components-omnibox-browser-autocomplete_controller.h.patch b/patches/components-omnibox-browser-autocomplete_controller.h.patch new file mode 100644 index 00000000000..38ac5fbc2b6 --- /dev/null +++ b/patches/components-omnibox-browser-autocomplete_controller.h.patch @@ -0,0 +1,12 @@ +diff --git a/components/omnibox/browser/autocomplete_controller.h b/components/omnibox/browser/autocomplete_controller.h +index 4cf270f246961ad1507b00e5e557b6b62e6bc227..3d90d66078c5da78f0f875a1b643c53d703dcb50 100644 +--- a/components/omnibox/browser/autocomplete_controller.h ++++ b/components/omnibox/browser/autocomplete_controller.h +@@ -139,6 +139,7 @@ class AutocompleteController : public AutocompleteProviderListener { + } + + private: ++ friend class BraveAutocompleteController; + friend class AutocompleteProviderTest; + FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, + RedundantKeywordsIgnoredInResult); diff --git a/patches/components-omnibox-browser-omnibox_controller.cc.patch b/patches/components-omnibox-browser-omnibox_controller.cc.patch new file mode 100644 index 00000000000..cf1585b33ae --- /dev/null +++ b/patches/components-omnibox-browser-omnibox_controller.cc.patch @@ -0,0 +1,20 @@ +diff --git a/components/omnibox/browser/omnibox_controller.cc b/components/omnibox/browser/omnibox_controller.cc +index 75a76658b52a64a1a3b142bfd26c57a311f8f4dc..98a21008d4867d7f465e64a7269ffe96fe9ed711 100644 +--- a/components/omnibox/browser/omnibox_controller.cc ++++ b/components/omnibox/browser/omnibox_controller.cc +@@ -14,12 +14,14 @@ + #include "components/omnibox/browser/omnibox_popup_view.h" + #include "ui/gfx/geometry/rect.h" + ++#include "brave/components/omnibox/browser/brave_autocomplete_controller.h" ++ + OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, + OmniboxClient* client) + : omnibox_edit_model_(omnibox_edit_model), + client_(client), + popup_(nullptr), +- autocomplete_controller_(new AutocompleteController( ++ autocomplete_controller_(new BraveAutocompleteController( + client_->CreateAutocompleteProviderClient(), + this, + AutocompleteClassifier::DefaultOmniboxProviders())), diff --git a/patches/ios-chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch b/patches/ios-chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch new file mode 100644 index 00000000000..6914228154c --- /dev/null +++ b/patches/ios-chrome-browser-autocomplete-autocomplete_classifier_factory.cc.patch @@ -0,0 +1,22 @@ +diff --git a/ios/chrome/browser/autocomplete/autocomplete_classifier_factory.cc b/ios/chrome/browser/autocomplete/autocomplete_classifier_factory.cc +index 11cdca53bd8c9e9c5d97715030f731226dde2984..f2aec7c949b201db1c06dd38226ee2ecf1aefb6f 100644 +--- a/ios/chrome/browser/autocomplete/autocomplete_classifier_factory.cc ++++ b/ios/chrome/browser/autocomplete/autocomplete_classifier_factory.cc +@@ -17,6 +17,8 @@ + #include "ios/chrome/browser/browser_state/chrome_browser_state.h" + #include "ios/chrome/browser/search_engines/template_url_service_factory.h" + ++#include "brave/components/omnibox/browser/brave_autocomplete_controller.h" ++ + namespace ios { + namespace { + +@@ -25,7 +27,7 @@ std::unique_ptr BuildAutocompleteClassifier( + ios::ChromeBrowserState* browser_state = + ios::ChromeBrowserState::FromBrowserState(context); + return base::MakeUnique( +- base::WrapUnique(new AutocompleteController( ++ base::WrapUnique(new BraveAutocompleteController( + base::WrapUnique(new AutocompleteProviderClientImpl(browser_state)), + nullptr, AutocompleteClassifier::DefaultOmniboxProviders())), + base::WrapUnique(new AutocompleteSchemeClassifierImpl));