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

Unified Diff: chrome/browser/ui/search/search_model.cc

Issue 1436583002: Revert of Remove setVoiceSearchSupported part of EmbeddedSearch SearchBox API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/search_model.h ('k') | chrome/browser/ui/search/search_model_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/ui/search/search_model.h ('k') | chrome/browser/ui/search/search_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698