#include "chrome/renderer/searchbox/searchbox.h"
#include <stddef.h>
#include <stdint.h>
#include <string_view>
#include <utility>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/token.h"
#include "base/types/optional_util.h"
#include "chrome/common/search/search.mojom.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/renderer/searchbox/searchbox_extension.h"
#include "components/favicon_base/favicon_types.h"
#include "components/favicon_base/favicon_url_parser.h"
#include "components/url_formatter/url_fixer.h"
#include "content/public/renderer/render_frame.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/web/web_frame.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace {
const size_t kMaxInstantMostVisitedItemCacheSize = …;
bool AreMostVisitedItemsEqual(
const std::vector<InstantMostVisitedItemIDPair>& old_item_id_pairs,
const std::vector<InstantMostVisitedItem>& new_items) { … }
class SearchBoxIconURLHelper: public SearchBox::IconURLHelper { … };
SearchBoxIconURLHelper::SearchBoxIconURLHelper(const SearchBox* search_box)
: … { … }
SearchBoxIconURLHelper::~SearchBoxIconURLHelper() { … }
std::string SearchBoxIconURLHelper::GetMainFrameToken() const { … }
std::string SearchBoxIconURLHelper::GetURLStringFromRestrictedID(
InstantRestrictedID rid) const { … }
}
namespace internal {
bool ParseFrameTokenAndRestrictedId(const std::string& id_part,
std::string* frame_token_out,
InstantRestrictedID* rid_out) { … }
bool ParseIconRestrictedUrl(const GURL& url,
std::string* param_part,
std::string* frame_token,
InstantRestrictedID* rid) { … }
void TranslateIconRestrictedUrl(const GURL& transient_url,
const SearchBox::IconURLHelper& helper,
GURL* url) { … }
}
SearchBox::IconURLHelper::IconURLHelper() = default;
SearchBox::IconURLHelper::~IconURLHelper() = default;
SearchBox::SearchBox(content::RenderFrame* render_frame)
: … { … }
SearchBox::~SearchBox() = default;
void SearchBox::DeleteMostVisitedItem(
InstantRestrictedID most_visited_item_id) { … }
void SearchBox::GenerateImageURLFromTransientURL(const GURL& transient_url,
GURL* url) const { … }
void SearchBox::GetMostVisitedItems(
std::vector<InstantMostVisitedItemIDPair>* items) const { … }
bool SearchBox::AreMostVisitedItemsAvailable() const { … }
bool SearchBox::GetMostVisitedItemWithID(
InstantRestrictedID most_visited_item_id,
InstantMostVisitedItem* item) const { … }
const NtpTheme* SearchBox::GetNtpTheme() const { … }
void SearchBox::StartCapturingKeyStrokes() { … }
void SearchBox::StopCapturingKeyStrokes() { … }
void SearchBox::UndoAllMostVisitedDeletions() { … }
void SearchBox::UndoMostVisitedDeletion(
InstantRestrictedID most_visited_item_id) { … }
void SearchBox::SetPageSequenceNumber(int page_seq_no) { … }
void SearchBox::FocusChanged(OmniboxFocusState new_focus_state,
OmniboxFocusChangeReason reason) { … }
void SearchBox::MostVisitedInfoChanged(
const InstantMostVisitedInfo& most_visited_info) { … }
void SearchBox::SetInputInProgress(bool is_input_in_progress) { … }
void SearchBox::ThemeChanged(const NtpTheme& theme) { … }
GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const { … }
void SearchBox::DidCommitProvisionalLoad(ui::PageTransition transition) { … }
void SearchBox::OnDestruct() { … }