Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 2152703002: Cleanup in SearchTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index 3ff3225effe808b617a10aaabdf5f0f290800216..e7b1b2c47c9455ca45801d3b61836f317a05195a 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -171,15 +171,11 @@ SearchTabHelper::~SearchTabHelper() {
instant_service_->RemoveObserver(this);
}
-void SearchTabHelper::InitForPreloadedNTP() {
- UpdateMode(true, true);
-}
-
void SearchTabHelper::OmniboxInputStateChanged() {
if (!is_search_enabled_)
return;
- UpdateMode(false, false);
+ UpdateMode(false);
}
void SearchTabHelper::OmniboxFocusChanged(OmniboxFocusState state,
@@ -219,25 +215,7 @@ void SearchTabHelper::NavigationEntryUpdated() {
if (!is_search_enabled_)
return;
- UpdateMode(false, false);
-}
-
-void SearchTabHelper::InstantSupportChanged(bool instant_support) {
- if (!is_search_enabled_)
- return;
-
- InstantSupportState new_state = instant_support ? INSTANT_SUPPORT_YES :
- INSTANT_SUPPORT_NO;
-
- model_.SetInstantSupportState(new_state);
-
- content::NavigationEntry* entry =
- web_contents_->GetController().GetLastCommittedEntry();
- if (entry) {
- search::SetInstantSupportStateInNavigationEntry(new_state, entry);
- if (delegate_ && !instant_support)
- delegate_->OnWebContentsInstantSupportDisabled(web_contents_);
- }
+ UpdateMode(false);
}
bool SearchTabHelper::SupportsInstant() const {
@@ -346,7 +324,7 @@ void SearchTabHelper::NavigationEntryCommitted(
profile()))
ipc_router_.SetDisplayInstantResults();
- UpdateMode(true, false);
+ UpdateMode(true);
content::NavigationEntry* entry =
web_contents_->GetController().GetVisibleEntry();
@@ -515,10 +493,28 @@ void SearchTabHelper::OnHistorySyncCheck() {
ipc_router_.SendHistorySyncCheckResult(IsHistorySyncEnabled(profile()));
}
-void SearchTabHelper::UpdateMode(bool update_origin, bool is_preloaded_ntp) {
+void SearchTabHelper::InstantSupportChanged(bool instant_support) {
+ if (!is_search_enabled_)
+ return;
+
+ InstantSupportState new_state = instant_support ? INSTANT_SUPPORT_YES :
+ INSTANT_SUPPORT_NO;
+
+ model_.SetInstantSupportState(new_state);
+
+ content::NavigationEntry* entry =
+ web_contents_->GetController().GetLastCommittedEntry();
+ if (entry) {
+ search::SetInstantSupportStateInNavigationEntry(new_state, entry);
+ if (delegate_ && !instant_support)
+ delegate_->OnWebContentsInstantSupportDisabled(web_contents_);
+ }
+}
+
+void SearchTabHelper::UpdateMode(bool update_origin) {
SearchMode::Type type = SearchMode::MODE_DEFAULT;
SearchMode::Origin origin = SearchMode::ORIGIN_DEFAULT;
- if (IsNTP(web_contents_) || is_preloaded_ntp) {
+ if (IsNTP(web_contents_)) {
type = SearchMode::MODE_NTP;
origin = SearchMode::ORIGIN_NTP;
} else if (IsSearchResults(web_contents_)) {
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698