summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-21 19:11:39 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-21 19:11:39 +0000
commiteac60f73ccc4dec42784ee6237f73ec4fa69ed7a (patch)
treefc530b579733cdc737fa9b6d3b3b76ae686358f2
parentfde4f5840faa877d5489b28e45f6058620336c7d (diff)
downloadchromium_src-eac60f73ccc4dec42784ee6237f73ec4fa69ed7a.zip
chromium_src-eac60f73ccc4dec42784ee6237f73ec4fa69ed7a.tar.gz
chromium_src-eac60f73ccc4dec42784ee6237f73ec4fa69ed7a.tar.bz2
Makes RLZ listen for changes to instant so that it can update at the
right time. BUG=56259 TEST=none Review URL: http://codereview.chromium.org/3969004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63393 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/instant/instant_controller.cc6
-rw-r--r--chrome/browser/rlz/rlz.cc4
-rw-r--r--chrome/common/notification_type.h3
3 files changed, 13 insertions, 0 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 24c70f8..d534cef 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -84,6 +85,11 @@ void InstantController::Update(TabContents* tab_contents,
} else {
ScheduleUpdate(match.destination_url);
}
+
+ NotificationService::current()->Notify(
+ NotificationType::INSTANT_CONTROLLER_UPDATED,
+ Source<InstantController>(this),
+ NotificationService::NoDetails());
}
void InstantController::SetOmniboxBounds(const gfx::Rect& bounds) {
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 840ce60..2ba1ed0 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -66,6 +66,10 @@ class OmniBoxUsageObserver : public NotificationObserver {
OmniBoxUsageObserver() {
registrar_.Add(this, NotificationType::OMNIBOX_OPENED_URL,
NotificationService::AllSources());
+ // If instant is enabled we'll start searching as soon as the user starts
+ // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED).
+ registrar_.Add(this, NotificationType::INSTANT_CONTROLLER_UPDATED,
+ NotificationService::AllSources());
omnibox_used_ = false;
DCHECK(!instance_);
instance_ = this;
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index 735de96..4fa44f2 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -1209,6 +1209,9 @@ class NotificationType {
// This is only sent from ChromeOS's TabCloseableStateWatcher.
TAB_CLOSEABLE_STATE_CHANGED,
+ // Sent each time the InstantController is updated.
+ INSTANT_CONTROLLER_UPDATED,
+
// Password Store ----------------------------------------------------------
// This notification is sent whenenever login entries stored in the password
// store are changed. The detail of this notification is a list of changes