Index: chrome/browser/ui/search/search_model.h |
diff --git a/chrome/browser/ui/search/search_model.h b/chrome/browser/ui/search/search_model.h |
index 3f77b87c17383018f30bb64433abb9607f5d3ed1..07c26efe2ed6d549a9279675a3ba2012c5ecb261 100644 |
--- a/chrome/browser/ui/search/search_model.h |
+++ b/chrome/browser/ui/search/search_model.h |
@@ -11,25 +11,36 @@ |
class SearchModelObserver; |
+// Represents whether a page supports Instant. |
+enum InstantSupportState { |
+ INSTANT_SUPPORT_NO, |
+ INSTANT_SUPPORT_YES, |
+ INSTANT_SUPPORT_UNKNOWN, |
+}; |
+ |
// An observable model for UI components that care about search model state |
// changes. |
class SearchModel { |
public: |
struct State { |
- State() : top_bars_visible(true) {} |
- State(const SearchMode& mode, bool top_bars_visible) |
- : mode(mode), |
- top_bars_visible(top_bars_visible) {} |
+ State(); |
+ State(const SearchMode& mode, |
+ bool top_bars_visible, |
+ InstantSupportState instant_support); |
- bool operator==(const State& rhs) const { |
- return mode == rhs.mode && top_bars_visible == rhs.top_bars_visible; |
- } |
+ bool operator==(const State& rhs) const; |
// The display mode of UI elements such as the toolbar, the tab strip, etc. |
SearchMode mode; |
// The visibility of top bars such as bookmark and info bars. |
bool top_bars_visible; |
+ |
+ // Does the current page support Instant? |
+ // |
+ // TODO(kmadhusu): Use bool instead of a tri-state variable. Refer to |
+ // crbug.com/246323 for more details. |
+ InstantSupportState instant_support; |
}; |
SearchModel(); |
@@ -58,6 +69,15 @@ class SearchModel { |
// Get the visibility of top bars. |
bool top_bars_visible() const { return state_.top_bars_visible; } |
+ // Set whether the page supports Instant. Change notifications are sent to |
+ // observers. |
+ void SetSupportsInstant(bool supports_instant); |
+ |
+ // Get whether the page supports Instant. |
+ InstantSupportState instant_support() const { |
+ return state_.instant_support; |
+ } |
+ |
// Add and remove observers. |
void AddObserver(SearchModelObserver* observer); |
void RemoveObserver(SearchModelObserver* observer); |