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

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

Issue 10816027: alternate ntp: toolbar background and separator animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build break Created 8 years, 4 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') | chrome/browser/ui/search/toolbar_search_animator.h » ('j') | 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 2453d08533a78dcb92a4f7f15730d644de21f369..981f04e4436f3a04c00df9ea5a2e1e06f64d3ae3 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -74,7 +74,8 @@ void SearchTabHelper::NavigateToPendingEntry(
if (!is_search_enabled_)
return;
- UpdateModel(url);
+ // Do not animate if this url is the very first navigation for the tab.
+ UpdateModel(url, !web_contents()->GetController().IsInitialNavigation());
}
void SearchTabHelper::Observe(
@@ -84,16 +85,21 @@ void SearchTabHelper::Observe(
DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
content::LoadCommittedDetails* committed_details =
content::Details<content::LoadCommittedDetails>(details).ptr();
- UpdateModel(committed_details->entry->GetURL());
+ // TODO(dhollowa): NavigationController::IsInitialNavigation() is always false
+ // by the time NOTIFICATION_NAV_ENTRY_COMMITTED is received, so please handle
+ // it appropriately when restructuring NavigateToPendingEntry() and this
+ // methods.
+ UpdateModel(committed_details->entry->GetURL(),
+ !web_contents()->GetController().IsInitialNavigation());
}
-void SearchTabHelper::UpdateModel(const GURL& url) {
+void SearchTabHelper::UpdateModel(const GURL& url, bool animate) {
Mode::Type type = Mode::MODE_DEFAULT;
if (IsNTP(url))
type = Mode::MODE_NTP;
else if (google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec()))
type = Mode::MODE_SEARCH;
- model_.SetMode(Mode(type, true));
+ model_.SetMode(Mode(type, animate));
}
} // namespace search
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | chrome/browser/ui/search/toolbar_search_animator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698