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

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

Issue 14911005: Move instant support to SearchTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android_dbg test failures Created 7 years, 6 months 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/instant_test_utils.cc ('k') | chrome/browser/ui/search/search_model.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.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);
« no previous file with comments | « chrome/browser/ui/search/instant_test_utils.cc ('k') | chrome/browser/ui/search/search_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698