summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 18:38:48 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 18:38:48 +0000
commit39bc266141e4892922cf06ca995308db0fe86053 (patch)
tree244de6933100943d2aee4dc6d46520b5c051ed70 /chrome/browser/instant
parent67df047cd552d944f52f28fcb3fd7889e8030f66 (diff)
downloadchromium_src-39bc266141e4892922cf06ca995308db0fe86053.zip
chromium_src-39bc266141e4892922cf06ca995308db0fe86053.tar.gz
chromium_src-39bc266141e4892922cf06ca995308db0fe86053.tar.bz2
Changes heuristics for when the page is told the bounds of the
omnibox. If the height grows, the page is told immediately, otherwise we delay a second. This helps avoid having results obscured, as well as having the page dance around if the omnibox is changing. BUG=65596 TEST=none Review URL: http://codereview.chromium.org/5898002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69282 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r--chrome/browser/instant/instant_loader.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 328299f..2210677 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -41,9 +41,10 @@
namespace {
-// Number of ms to delay before updating the omnibox bounds. This is a bit long
-// as updating the bounds ends up being quite expensive.
-const int kUpdateBoundsDelayMS = 500;
+// Number of ms to delay before updating the omnibox bounds. This is only used
+// when the bounds of the omnibox shrinks. If the bounds grows, we update
+// immediately.
+const int kUpdateBoundsDelayMS = 1000;
// If this status code is seen instant is disabled for the specified host.
const int kHostBlacklistStatusCode = 403;
@@ -583,12 +584,16 @@ void InstantLoader::SetOmniboxBounds(const gfx::Rect& bounds) {
!is_waiting_for_load()) {
// Updating the bounds is rather expensive, and because of the async nature
// of the omnibox the bounds can dance around a bit. Delay the update in
- // hopes of things settling down.
- if (update_bounds_timer_.IsRunning())
- update_bounds_timer_.Stop();
- update_bounds_timer_.Start(
- base::TimeDelta::FromMilliseconds(kUpdateBoundsDelayMS),
- this, &InstantLoader::ProcessBoundsChange);
+ // hopes of things settling down. To avoid hiding results we grow
+ // immediately, but delay shrinking.
+ update_bounds_timer_.Stop();
+ if (omnibox_bounds_.height() > last_omnibox_bounds_.height()) {
+ SendBoundsToPage(false);
+ } else {
+ update_bounds_timer_.Start(
+ base::TimeDelta::FromMilliseconds(kUpdateBoundsDelayMS),
+ this, &InstantLoader::ProcessBoundsChange);
+ }
}
}