summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/ui/webui/omnibox
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-20 13:40:20 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-22 12:41:23 +0000
commit7961cea6d1041e3e454dae6a1da660b453efd238 (patch)
treec0eeb4a9ff9ba32986289c1653d9608e53ccb444 /chromium/chrome/browser/ui/webui/omnibox
parentb7034d0803538058e5c9d904ef03cf5eab34f6ef (diff)
downloadqtwebengine-chromium-7961cea6d1041e3e454dae6a1da660b453efd238.tar.gz
BASELINE: Update Chromium to 78.0.3904.130
Change-Id: If185e0c0061b3437531c97c9c8c78f239352a68b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/ui/webui/omnibox')
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom17
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc8
-rw-r--r--chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc7
3 files changed, 24 insertions, 8 deletions
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom b/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
index de8253d461c..7ffa3971673 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox.mojom
@@ -31,6 +31,7 @@ struct AutocompleteMatch {
array<ACMatchClassification> contents_class;
string description;
array<ACMatchClassification> description_class;
+ bool swap_contents_and_description;
string answer;
string transition;
bool allowed_to_be_default_match;
@@ -59,12 +60,15 @@ struct OmniboxResponse {
string type;
string host;
bool is_typed_host;
+ string input_text;
array<AutocompleteMatch> combined_results;
array<AutocompleteResultsForProvider> results_by_provider;
};
interface OmniboxPageHandler {
+ // Registers the webui page.
SetClientPage(OmniboxPage page);
+ // Prompts a autocopmlete controller to process an omnibox query.
StartOmniboxQuery(string input_string,
bool reset_autocomplete_controller,
int32 cursor_position,
@@ -76,8 +80,15 @@ interface OmniboxPageHandler {
};
interface OmniboxPage {
- handleNewAutocompleteResponse(OmniboxResponse response,
- bool isPageController);
- HandleNewAutocompleteQuery(bool isPageController, string input_text);
+ // Notifies the page of an omnibox response from a autocomplete
+ // controller. |is_page_controller| indicates wether the response
+ // originates from a query initiated from the page via
+ // |StartOmniboxQuery| or from the browser omnibox.
+ HandleNewAutocompleteResponse(OmniboxResponse response,
+ bool is_page_controller);
+ // Notifies the page a new omnibox query has begun.
+ HandleNewAutocompleteQuery(bool is_page_controller, string input_text);
+ // Asyncronously notifies the page of the image data URLs for previous omnibox
+ // responses.
HandleAnswerImageData(string image_url, string image_data);
};
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc b/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
index 97def4ae86d..3c90ef1508e 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
@@ -174,6 +174,7 @@ struct TypeConverter<mojom::AutocompleteMatchPtr, AutocompleteMatch> {
result->description_class =
mojo::ConvertTo<std::vector<mojom::ACMatchClassificationPtr>>(
input.description_class);
+ result->swap_contents_and_description = input.swap_contents_and_description;
if (input.answer) {
result->answer =
SuggestionAnswerImageLineToString(input.answer->first_line()) +
@@ -254,6 +255,7 @@ void OmniboxPageHandler::OnOmniboxResultChanged(
if (!LookupIsTypedHost(host, &is_typed_host))
is_typed_host = false;
response->is_typed_host = is_typed_host;
+ response->input_text = base::UTF16ToUTF8(input_.text());
{
// Copy to an ACMatches to make conversion easier. Since this isn't
@@ -295,7 +297,7 @@ void OmniboxPageHandler::OnOmniboxResultChanged(
image_urls.push_back(result_by_provider.results[j]->image);
}
- page_->handleNewAutocompleteResponse(std::move(response),
+ page_->HandleNewAutocompleteResponse(std::move(response),
controller == controller_.get());
// Fill in image data
@@ -417,7 +419,7 @@ void OmniboxPageHandler::StartOmniboxQuery(const std::string& input_string,
}
void OmniboxPageHandler::ResetController() {
- controller_.reset(new AutocompleteController(
+ controller_ = std::make_unique<AutocompleteController>(
std::make_unique<ChromeAutocompleteProviderClient>(profile_), this,
- AutocompleteClassifier::DefaultOmniboxProviders()));
+ AutocompleteClassifier::DefaultOmniboxProviders());
}
diff --git a/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc b/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc
index af3ee72c3cd..4e95206d915 100644
--- a/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc
+++ b/chromium/chrome/browser/ui/webui/omnibox/omnibox_ui.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/omnibox/omnibox_page_handler.h"
+#include "chrome/browser/ui/webui/version_handler.h"
#include "chrome/browser/ui/webui/version_ui.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
@@ -16,14 +17,15 @@
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
-OmniboxUI::OmniboxUI(content::WebUI* web_ui) : ui::MojoWebUIController(web_ui) {
+OmniboxUI::OmniboxUI(content::WebUI* web_ui)
+ : ui::MojoWebUIController(web_ui, /*enable_chrome_send=*/true) {
// Set up the chrome://omnibox/ source.
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIOmniboxHost);
// Expose version information to client because it is useful in output.
VersionUI::AddVersionDetailStrings(source);
- source->SetJsonPath("strings.js");
+ source->UseStringsJs();
source->AddResourcePath("omnibox.css", IDR_OMNIBOX_CSS);
source->AddResourcePath("omnibox_input.css", IDR_OMNIBOX_INPUT_CSS);
@@ -43,6 +45,7 @@ OmniboxUI::OmniboxUI(content::WebUI* web_ui) : ui::MojoWebUIController(web_ui) {
content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
AddHandlerToRegistry(base::BindRepeating(&OmniboxUI::BindOmniboxPageHandler,
base::Unretained(this)));
+ web_ui->AddMessageHandler(std::make_unique<VersionHandler>());
}
OmniboxUI::~OmniboxUI() {}