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..132b49a61b9e81eee33ea68dd8c15772a6390153 100644 |
--- a/chrome/browser/ui/search/search_model.cc |
+++ b/chrome/browser/ui/search/search_model.cc |
@@ -7,6 +7,24 @@ |
#include "chrome/browser/search/search.h" |
#include "chrome/browser/ui/search/search_model_observer.h" |
+SearchModel::State::State() |
+ : top_bars_visible(true), |
+ instant_support(INSTANT_SUPPORT_UNKNOWN) { |
+} |
+ |
+SearchModel::State::State(const SearchMode& mode, |
+ bool top_bars_visible, |
+ InstantSupportState instant_support) |
+ : mode(mode), |
+ top_bars_visible(top_bars_visible), |
+ instant_support(instant_support) { |
+} |
+ |
+bool SearchModel::State::operator==(const State& rhs) const { |
+ return mode == rhs.mode && top_bars_visible == rhs.top_bars_visible && |
+ instant_support == rhs.instant_support; |
+} |
+ |
SearchModel::SearchModel() { |
} |
@@ -77,6 +95,24 @@ void SearchModel::SetTopBarsVisible(bool visible) { |
ModelChanged(old_state, state_)); |
} |
+void SearchModel::SetSupportsInstant(bool supports_instant) { |
samarth
2013/05/10 01:32:38
Can we follow Jered's lead in InstantPage and add
kmadhusu
2013/05/13 17:13:24
Done.
|
+ DCHECK(chrome::IsInstantExtendedAPIEnabled()) |
+ << "Please do not try to set the SearchModel mode without first " |
+ << "checking if Search is enabled."; |
+ |
+ InstantSupportState new_instant_support = supports_instant ? |
+ INSTANT_SUPPORT_YES : INSTANT_SUPPORT_NO; |
+ |
+ if (state_.instant_support == new_instant_support) |
+ return; |
+ |
+ const State old_state = state_; |
+ state_.instant_support = new_instant_support; |
+ |
+ FOR_EACH_OBSERVER(SearchModelObserver, observers_, |
+ ModelChanged(old_state, state_)); |
+} |
+ |
void SearchModel::AddObserver(SearchModelObserver* observer) { |
observers_.AddObserver(observer); |
} |