diff options
author | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 11:23:05 +0000 |
---|---|---|
committer | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-19 11:23:05 +0000 |
commit | 5ee671febc6bc846bc3127932e9d3e6c26cb9ed9 (patch) | |
tree | 9b3d5b5a34cec2e0db431596085a955c947011b1 /chrome/browser/ui/browser_instant_controller.cc | |
parent | 02e44ae8d2d94044c1dd317d5dcab61923822cd4 (diff) | |
download | chromium_src-5ee671febc6bc846bc3127932e9d3e6c26cb9ed9.zip chromium_src-5ee671febc6bc846bc3127932e9d3e6c26cb9ed9.tar.gz chromium_src-5ee671febc6bc846bc3127932e9d3e6c26cb9ed9.tar.bz2 |
alternate ntp: implement Show/HideBars SearchBox API to reduce jank when showing/hiding bars
this is the chrome side combining melevin@'s renderer parts with my browser parts; gws side is implemented by melevin@.
- when suggestions show/hide, bookmark and info bars hide/show respectively; this causes contents to shift up/down respectively, resulting in jank.
- to reduce jank, these APIs synchronize the showing/hiding of suggestions in gws with the showing/hiding of bookmark and info bars in browser.
- gws sends HideBars() whenever suggestions show, and ShowBars() whenever they close.
- browser only obliges when bookmark and/or info bars are enabled and only on NTP and SERP pages, but always fires onbarshidden event for every HideBars() call, so that gws can proceed to show suggestions.
BUG=176146,178550,175776
TEST=verify as per bug rpts
Review URL: https://chromiumcodereview.appspot.com/12631008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188994 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_instant_controller.cc')
-rw-r--r-- | chrome/browser/ui/browser_instant_controller.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index ca47c0f..068aa504 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -236,8 +236,14 @@ void BrowserInstantController::ResetInstant(const std::string& pref_name) { //////////////////////////////////////////////////////////////////////////////// // BrowserInstantController, search::SearchModelObserver implementation: -void BrowserInstantController::ModeChanged(const search::Mode& old_mode, - const search::Mode& new_mode) { +void BrowserInstantController::ModelChanged( + const search::SearchModel::State& old_state, + const search::SearchModel::State& new_state) { + if (old_state.mode == new_state.mode) + return; + + const search::Mode& new_mode = new_state.mode; + if (search::IsInstantExtendedAPIEnabled()) { // Record some actions corresponding to the mode change. Note that to get // the full story, it's necessary to look at other UMA actions as well, @@ -252,7 +258,7 @@ void BrowserInstantController::ModeChanged(const search::Mode& old_mode, if (new_mode.is_ntp()) UpdateThemeInfo(); - instant_.SearchModeChanged(old_mode, new_mode); + instant_.SearchModeChanged(old_state.mode, new_mode); } //////////////////////////////////////////////////////////////////////////////// |