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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include "chrome/browser/google/google_util.h" 7 #include "chrome/browser/google/google_util.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 model_.SetMode(Mode(mode, true)); 68 model_.SetMode(Mode(mode, true));
69 } 69 }
70 70
71 void SearchTabHelper::NavigateToPendingEntry( 71 void SearchTabHelper::NavigateToPendingEntry(
72 const GURL& url, 72 const GURL& url,
73 content::NavigationController::ReloadType reload_type) { 73 content::NavigationController::ReloadType reload_type) {
74 if (!is_search_enabled_) 74 if (!is_search_enabled_)
75 return; 75 return;
76 76
77 UpdateModel(url); 77 // Do not animate if this url is the very first navigation for the tab.
78 UpdateModel(url, !web_contents()->GetController().IsInitialNavigation());
78 } 79 }
79 80
80 void SearchTabHelper::Observe( 81 void SearchTabHelper::Observe(
81 int type, 82 int type,
82 const content::NotificationSource& source, 83 const content::NotificationSource& source,
83 const content::NotificationDetails& details) { 84 const content::NotificationDetails& details) {
84 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); 85 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
85 content::LoadCommittedDetails* committed_details = 86 content::LoadCommittedDetails* committed_details =
86 content::Details<content::LoadCommittedDetails>(details).ptr(); 87 content::Details<content::LoadCommittedDetails>(details).ptr();
87 UpdateModel(committed_details->entry->GetURL()); 88 // TODO(dhollowa): NavigationController::IsInitialNavigation() is always false
89 // by the time NOTIFICATION_NAV_ENTRY_COMMITTED is received, so please handle
90 // it appropriately when restructuring NavigateToPendingEntry() and this
91 // methods.
92 UpdateModel(committed_details->entry->GetURL(),
93 !web_contents()->GetController().IsInitialNavigation());
88 } 94 }
89 95
90 void SearchTabHelper::UpdateModel(const GURL& url) { 96 void SearchTabHelper::UpdateModel(const GURL& url, bool animate) {
91 Mode::Type type = Mode::MODE_DEFAULT; 97 Mode::Type type = Mode::MODE_DEFAULT;
92 if (IsNTP(url)) 98 if (IsNTP(url))
93 type = Mode::MODE_NTP; 99 type = Mode::MODE_NTP;
94 else if (google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec())) 100 else if (google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec()))
95 type = Mode::MODE_SEARCH; 101 type = Mode::MODE_SEARCH;
96 model_.SetMode(Mode(type, true)); 102 model_.SetMode(Mode(type, animate));
97 } 103 }
98 104
99 } // namespace search 105 } // namespace search
100 } // namespace chrome 106 } // namespace chrome
OLDNEW
« 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