1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/lens/lens_composebox_handler.h"
#include "base/memory/raw_ptr.h"
#include "base/unguessable_token.h"
#include "chrome/browser/ui/lens/lens_composebox_controller.h"
#include "chrome/browser/ui/webui/searchbox/searchbox_handler.h"
#include "components/omnibox/browser/searchbox.mojom.h"
#include "content/public/browser/web_contents.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "ui/webui/resources/cr_components/composebox/composebox.mojom.h"
#include "url/gurl.h"
namespace lens {
LensComposeboxHandler::LensComposeboxHandler(
lens::LensComposeboxController* parent_controller,
mojo::PendingReceiver<composebox::mojom::PageHandler> pending_handler,
mojo::PendingRemote<composebox::mojom::Page> pending_page,
mojo::PendingReceiver<searchbox::mojom::PageHandler>
pending_searchbox_handler)
: SearchboxHandler(std::move(pending_searchbox_handler),
/*profile=*/nullptr,
/*web_contents=*/nullptr,
/*metrics_reporter=*/nullptr),
lens_composebox_controller_(parent_controller),
page_{std::move(pending_page)},
handler_(this, std::move(pending_handler)) {}
LensComposeboxHandler::~LensComposeboxHandler() = default;
void LensComposeboxHandler::NotifySessionStarted() {
// Ignored, intentionally unimplemented for Lens. The session starts when Lens
// is opened.
}
void LensComposeboxHandler::NotifySessionAbandoned() {
// Ignored, intentionally unimplemented for Lens. The session starts when Lens
// is closed.
}
void LensComposeboxHandler::SubmitQuery(const std::string& query_text,
uint8_t mouse_button,
bool alt_key,
bool ctrl_key,
bool meta_key,
bool shift_key) {
lens_composebox_controller_->IssueComposeboxQuery(query_text);
}
void LensComposeboxHandler::FocusChanged(bool focused) {
lens_composebox_controller_->OnFocusChanged(focused);
}
void LensComposeboxHandler::AddFile(
composebox::mojom::SelectedFileInfoPtr file_info_mojom,
mojo_base::BigBuffer file_bytes,
AddFileCallback callback) {
// Ignored, intentionally unimplemented for Lens. Adding files via the
// composebox is not yet supported.
}
void LensComposeboxHandler::DeleteFile(
const base::UnguessableToken& file_token) {
// Ignored, intentionally unimplemented for Lens. Adding files via the
// composebox is not yet supported.
}
void LensComposeboxHandler::ClearFiles() {
// Ignore, intentionally unimplemented for Lens. Adding files via the
// composebox is not yet supported.
}
void LensComposeboxHandler::DeleteAutocompleteMatch(uint8_t line,
const GURL& url) {
NOTREACHED();
}
void LensComposeboxHandler::ExecuteAction(
uint8_t line,
uint8_t action_index,
const GURL& url,
base::TimeTicks match_selection_timestamp,
uint8_t mouse_button,
bool alt_key,
bool ctrl_key,
bool meta_key,
bool shift_key) {
NOTREACHED();
}
void LensComposeboxHandler::PopupElementSizeChanged(const gfx::Size& size) {
NOTREACHED();
}
void LensComposeboxHandler::OnThumbnailRemoved() {
NOTREACHED();
}
} // namespace lens
|