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

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

Issue 12631008: alternate ntp: implement Show/HideBars API to reduce jank when showing/hiding bars (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert obsolete changes in search.h/cc Created 7 years, 9 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
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_;

Powered by Google App Engine
This is Rietveld 408576698