OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // startup or from the user opening a new tab, and if we wait until later, | 214 // startup or from the user opening a new tab, and if we wait until later, |
215 // it won't correctly detect this case. | 215 // it won't correctly detect this case. |
216 NTPUserDataLogger::GetOrCreateFromWebContents(web_contents_); | 216 NTPUserDataLogger::GetOrCreateFromWebContents(web_contents_); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 void SearchTabHelper::OnTabDeactivated() { | 220 void SearchTabHelper::OnTabDeactivated() { |
221 ipc_router_.OnTabDeactivated(); | 221 ipc_router_.OnTabDeactivated(); |
222 } | 222 } |
223 | 223 |
224 bool SearchTabHelper::IsSearchResultsPage() { | |
225 return model_.mode().is_origin_search(); | |
226 } | |
227 | |
228 void SearchTabHelper::DidStartNavigationToPendingEntry( | 224 void SearchTabHelper::DidStartNavigationToPendingEntry( |
229 const GURL& url, | 225 const GURL& url, |
230 content::NavigationController::ReloadType /* reload_type */) { | 226 content::NavigationController::ReloadType /* reload_type */) { |
231 if (search::IsNTPURL(url, profile())) { | 227 if (search::IsNTPURL(url, profile())) { |
232 // Set the title on any pending entry corresponding to the NTP. This | 228 // Set the title on any pending entry corresponding to the NTP. This |
233 // prevents any flickering of the tab title. | 229 // prevents any flickering of the tab title. |
234 content::NavigationEntry* entry = | 230 content::NavigationEntry* entry = |
235 web_contents_->GetController().GetPendingEntry(); | 231 web_contents_->GetController().GetPendingEntry(); |
236 if (entry) { | 232 if (entry) { |
237 web_contents_->UpdateTitleForEntry( | 233 web_contents_->UpdateTitleForEntry( |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 515 |
520 bool SearchTabHelper::IsInputInProgress() const { | 516 bool SearchTabHelper::IsInputInProgress() const { |
521 OmniboxView* omnibox = GetOmniboxView(); | 517 OmniboxView* omnibox = GetOmniboxView(); |
522 return !model_.mode().is_ntp() && omnibox && | 518 return !model_.mode().is_ntp() && omnibox && |
523 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 519 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
524 } | 520 } |
525 | 521 |
526 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 522 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
527 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 523 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
528 } | 524 } |
OLD | NEW |