| Index: chrome/browser/ui/search/search_model.cc
|
| diff --git a/chrome/browser/ui/search/search_model.cc b/chrome/browser/ui/search/search_model.cc
|
| index 57b83bd852d9be96f78665621bf6e5c720efe135..17d5a96d2c638d0eff20809498a78287ebb86ac4 100644
|
| --- a/chrome/browser/ui/search/search_model.cc
|
| +++ b/chrome/browser/ui/search/search_model.cc
|
| @@ -7,14 +7,22 @@
|
| #include "chrome/browser/ui/search/search_model_observer.h"
|
| #include "components/search/search.h"
|
|
|
| -SearchModel::State::State() : instant_support(INSTANT_SUPPORT_UNKNOWN) {}
|
| +SearchModel::State::State()
|
| + : instant_support(INSTANT_SUPPORT_UNKNOWN),
|
| + voice_search_supported(false) {
|
| +}
|
|
|
| SearchModel::State::State(const SearchMode& mode,
|
| - InstantSupportState instant_support)
|
| - : mode(mode), instant_support(instant_support) {}
|
| + InstantSupportState instant_support,
|
| + bool voice_search_supported)
|
| + : mode(mode),
|
| + instant_support(instant_support),
|
| + voice_search_supported(voice_search_supported) {
|
| +}
|
|
|
| bool SearchModel::State::operator==(const State& rhs) const {
|
| - return mode == rhs.mode && instant_support == rhs.instant_support;
|
| + return mode == rhs.mode && instant_support == rhs.instant_support &&
|
| + voice_search_supported == rhs.voice_search_supported;
|
| }
|
|
|
| SearchModel::SearchModel() {
|
| @@ -67,6 +75,21 @@
|
| ModelChanged(old_state, state_));
|
| }
|
|
|
| +void SearchModel::SetVoiceSearchSupported(bool supported) {
|
| + DCHECK(search::IsInstantExtendedAPIEnabled())
|
| + << "Please do not try to set the SearchModel state without first "
|
| + << "checking if Search is enabled.";
|
| +
|
| + if (state_.voice_search_supported == supported)
|
| + return;
|
| +
|
| + const State old_state = state_;
|
| + state_.voice_search_supported = supported;
|
| +
|
| + FOR_EACH_OBSERVER(SearchModelObserver, observers_,
|
| + ModelChanged(old_state, state_));
|
| +}
|
| +
|
| void SearchModel::AddObserver(SearchModelObserver* observer) {
|
| observers_.AddObserver(observer);
|
| }
|
|
|