#include "chrome/browser/ui/search/search_tab_helper.h"
#include <memory>
#include "base/containers/flat_map.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/bookmarks/bookmark_stats.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
#include "chrome/browser/ui/search/omnibox_utils.h"
#include "chrome/browser/ui/search/search_ipc_router_policy_impl.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tab_modal_confirm_dialog.h"
#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/google/core/common/google_util.h"
#include "components/navigation_metrics/navigation_metrics.h"
#include "components/profile_metrics/browser_profile_type.h"
#include "components/search/ntp_features.h"
#include "components/search/search.h"
#include "components/search_engines/template_url_service.h"
#include "components/sessions/content/session_tab_helper.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/base/user_selectable_type.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_user_settings.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/reload_type.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/constants.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/vector_icon_types.h"
#include "url/gurl.h"
namespace {
enum class NewTabPageConcretePage { … };
bool InInstantProcess(const InstantService* instant_service,
content::WebContents* contents) { … }
void RecordNewTabLoadTime(content::WebContents* contents) { … }
void RecordConcreteNtp(content::NavigationHandle* navigation_handle) { … }
}
SearchTabHelper::SearchTabHelper(content::WebContents* web_contents)
: … { … }
SearchTabHelper::~SearchTabHelper() { … }
void SearchTabHelper::BindEmbeddedSearchConnecter(
mojo::PendingAssociatedReceiver<search::mojom::EmbeddedSearchConnector>
receiver,
content::RenderFrameHost* rfh) { … }
void SearchTabHelper::OnTabActivated() { … }
void SearchTabHelper::OnTabDeactivated() { … }
void SearchTabHelper::DidStartNavigation(
content::NavigationHandle* navigation_handle) { … }
void SearchTabHelper::TitleWasSet(content::NavigationEntry* entry) { … }
void SearchTabHelper::DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& ) { … }
void SearchTabHelper::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) { … }
void SearchTabHelper::NtpThemeChanged(NtpTheme theme) { … }
void SearchTabHelper::MostVisitedInfoChanged(
const InstantMostVisitedInfo& most_visited_info) { … }
void SearchTabHelper::FocusOmnibox(bool focus) { … }
void SearchTabHelper::OnDeleteMostVisitedItem(const GURL& url) { … }
void SearchTabHelper::OnUndoMostVisitedDeletion(const GURL& url) { … }
void SearchTabHelper::OnUndoAllMostVisitedDeletions() { … }
void SearchTabHelper::OnOmniboxInputStateChanged() { … }
void SearchTabHelper::OnOmniboxFocusChanged(OmniboxFocusState state,
OmniboxFocusChangeReason reason) { … }
Profile* SearchTabHelper::profile() const { … }
bool SearchTabHelper::IsInputInProgress() const { … }
void SearchTabHelper::CloseNTPCustomizeChromeFeaturePromo() { … }
WEB_CONTENTS_USER_DATA_KEY_IMPL(SearchTabHelper);