| 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 53d0fcc9efd245bd685085d5c55051b98176cf6e..290789e62fd574124b8a1bf2d1a494ed0ef60b4e 100644
|
| --- a/chrome/browser/ui/search/search_model.cc
|
| +++ b/chrome/browser/ui/search/search_model.cc
|
| @@ -7,6 +7,25 @@
|
| #include "chrome/browser/search/search.h"
|
| #include "chrome/browser/ui/search/search_model_observer.h"
|
|
|
| +SearchModel::State::State()
|
| + : top_bars_visible(true),
|
| + voice_search_supported(false) {
|
| +}
|
| +
|
| +SearchModel::State::State(const SearchMode& mode,
|
| + bool top_bars_visible,
|
| + bool voice_search_supported)
|
| + : mode(mode),
|
| + top_bars_visible(top_bars_visible),
|
| + voice_search_supported(voice_search_supported) {
|
| +}
|
| +
|
| +bool SearchModel::State::operator==(const State& rhs) const {
|
| + return mode == rhs.mode && top_bars_visible == rhs.top_bars_visible &&
|
| + voice_search_supported == rhs.voice_search_supported;
|
| +}
|
| +
|
| +
|
| SearchModel::SearchModel() {
|
| }
|
|
|
| @@ -77,6 +96,21 @@ void SearchModel::SetTopBarsVisible(bool visible) {
|
| ModelChanged(old_state, state_));
|
| }
|
|
|
| +void SearchModel::SetVoiceSearchSupported(bool supported) {
|
| + DCHECK(chrome::IsInstantExtendedAPIEnabled())
|
| + << "Please do not try to set the SearchModel mode without first "
|
| + << "checking if Search is enabled.";
|
| +
|
| + if (state_.voice_search_supported == supported)
|
| + return;
|
| +
|
| + const State old_state = state_;
|
| + state_.voice_search_supported = supported;
|
| + LOG(ERROR) << "HERE";
|
| + FOR_EACH_OBSERVER(SearchModelObserver, observers_,
|
| + ModelChanged(old_state, state_));
|
| +}
|
| +
|
| void SearchModel::AddObserver(SearchModelObserver* observer) {
|
| observers_.AddObserver(observer);
|
| }
|
|
|