Chromium Code Reviews| 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 6a7f1f138742d451a740290f5e5cc7a4c82b295a..450f91c06e5315a608b0f50eeddf435004c5d2a2 100644 |
| --- a/chrome/browser/ui/search/search_model.h |
| +++ b/chrome/browser/ui/search/search_model.h |
| @@ -18,23 +18,53 @@ class SearchModelObserver; |
| // changes. |
| class SearchModel { |
| public: |
| + struct State { |
| + State() : top_bars_visible(true) {} |
| + |
| + bool operator==(const State& rhs) const { |
| + return mode == rhs.mode && top_bars_visible == rhs.top_bars_visible; |
| + } |
| + |
| + // The display mode of UI elements such as the toolbar, the tab strip, etc. |
| + Mode mode; |
| + // The visibility of top bars (bookmark and info bars). |
|
dhollowa
2013/03/14 00:30:58
nit: Match comment style: "The visibility of top b
kuan
2013/03/14 00:44:18
Done.
|
| + bool top_bars_visible; |
| + }; |
| + |
| SearchModel(); |
| ~SearchModel(); |
| - // Change the mode. Change notifications are sent to observers. An animated |
| - // transition may be requested. |
| + // Change the state. Change notifications are sent to observers. |
| + void SetState(const State& state); |
| + |
| + // Get the current state. |
| + const State& state() const { return state_; } |
| + |
| + // Change the mode. Change notifications are sent to observers. |
| void SetMode(const Mode& mode); |
| // Get the active mode. |
| - const Mode& mode() const { return mode_; } |
| + const Mode& mode() const { return state_.mode; } |
| + |
| + // Set visibility of top bars (bookmark and info bars). Notifications are |
|
dhollowa
2013/03/14 00:30:58
You can remove the "(bookmark and info bars)" bit
kuan
2013/03/14 00:44:18
Done.
|
| + // sent to observers. |
| + void SetTopBarsVisible(bool visible); |
| + |
| + // Get the visibility of top bars (bookmark and info bars). |
|
dhollowa
2013/03/14 00:30:58
You can remove the "(bookmark and info bars)" bit
kuan
2013/03/14 00:44:18
Done.
|
| + bool top_bars_visible() const { return state_.top_bars_visible; } |
| // Add and remove observers. |
| void AddObserver(SearchModelObserver* observer); |
| void RemoveObserver(SearchModelObserver* observer); |
| + // Returns true if visibility in top bars should be changed based on |
| + // |old_mode| and |new_mode|. |
|
dhollowa
2013/03/14 00:30:58
old_state, new_state
kuan
2013/03/14 00:44:18
Done.
|
| + static bool ShouldChangeTopBarsVisibility(const State& old_state, |
|
dhollowa
2013/03/14 00:30:58
Public static methods go to top of class.
kuan
2013/03/14 00:44:18
Done.
|
| + const State& new_state); |
| + |
| private: |
| - // The display mode of UI elements such as the toolbar, the tab strip, etc. |
| - Mode mode_; |
| + // Current state of model. |
| + State state_; |
| // Observers. |
| ObserverList<SearchModelObserver> observers_; |