| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // the previous entry. If the page does not support Instant, update the | 364 // the previous entry. If the page does not support Instant, update the |
| 365 // location bar from here to turn off search terms replacement. | 365 // location bar from here to turn off search terms replacement. |
| 366 search::SetInstantSupportStateInNavigationEntry(model_.instant_support(), | 366 search::SetInstantSupportStateInNavigationEntry(model_.instant_support(), |
| 367 entry); | 367 entry); |
| 368 if (delegate_ && model_.instant_support() == INSTANT_SUPPORT_NO) | 368 if (delegate_ && model_.instant_support() == INSTANT_SUPPORT_NO) |
| 369 delegate_->OnWebContentsInstantSupportDisabled(web_contents_); | 369 delegate_->OnWebContentsInstantSupportDisabled(web_contents_); |
| 370 return; | 370 return; |
| 371 } | 371 } |
| 372 | 372 |
| 373 model_.SetInstantSupportState(INSTANT_SUPPORT_UNKNOWN); | 373 model_.SetInstantSupportState(INSTANT_SUPPORT_UNKNOWN); |
| 374 model_.SetVoiceSearchSupported(false); | |
| 375 search::SetInstantSupportStateInNavigationEntry(model_.instant_support(), | 374 search::SetInstantSupportStateInNavigationEntry(model_.instant_support(), |
| 376 entry); | 375 entry); |
| 377 | 376 |
| 378 if (InInstantProcess(profile(), web_contents_)) | 377 if (InInstantProcess(profile(), web_contents_)) |
| 379 ipc_router_.OnNavigationEntryCommitted(); | 378 ipc_router_.OnNavigationEntryCommitted(); |
| 380 } | 379 } |
| 381 | 380 |
| 382 void SearchTabHelper::OnInstantSupportDetermined(bool supports_instant) { | 381 void SearchTabHelper::OnInstantSupportDetermined(bool supports_instant) { |
| 383 InstantSupportChanged(supports_instant); | 382 InstantSupportChanged(supports_instant); |
| 384 } | 383 } |
| 385 | 384 |
| 386 void SearchTabHelper::OnSetVoiceSearchSupport(bool supports_voice_search) { | |
| 387 model_.SetVoiceSearchSupported(supports_voice_search); | |
| 388 } | |
| 389 | |
| 390 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) { | 385 void SearchTabHelper::ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) { |
| 391 ipc_router_.SendThemeBackgroundInfo(theme_info); | 386 ipc_router_.SendThemeBackgroundInfo(theme_info); |
| 392 } | 387 } |
| 393 | 388 |
| 394 void SearchTabHelper::MostVisitedItemsChanged( | 389 void SearchTabHelper::MostVisitedItemsChanged( |
| 395 const std::vector<InstantMostVisitedItem>& items) { | 390 const std::vector<InstantMostVisitedItem>& items) { |
| 396 // When most visited change, the NTP usually reloads the tiles. This means | 391 // When most visited change, the NTP usually reloads the tiles. This means |
| 397 // our metrics get inconsistent. So we'd rather emit stats now. | 392 // our metrics get inconsistent. So we'd rather emit stats now. |
| 398 InstantTab::EmitNtpStatistics(web_contents_); | 393 InstantTab::EmitNtpStatistics(web_contents_); |
| 399 ipc_router_.SendMostVisitedItems(items); | 394 ipc_router_.SendMostVisitedItems(items); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 582 |
| 588 bool SearchTabHelper::IsInputInProgress() const { | 583 bool SearchTabHelper::IsInputInProgress() const { |
| 589 OmniboxView* omnibox = GetOmniboxView(); | 584 OmniboxView* omnibox = GetOmniboxView(); |
| 590 return !model_.mode().is_ntp() && omnibox && | 585 return !model_.mode().is_ntp() && omnibox && |
| 591 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 586 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
| 592 } | 587 } |
| 593 | 588 |
| 594 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 589 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
| 595 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 590 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
| 596 } | 591 } |
| OLD | NEW |