summaryrefslogtreecommitdiffstats
path: root/chrome/browser/instant
diff options
context:
space:
mode:
authordominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 03:19:33 +0000
committerdominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 03:19:33 +0000
commit65d68da4806e736a53cf263cbeba8fcae6c06b87 (patch)
tree0d2ef27d05e305ed7fb8ba95d9695cfc27c2e7fd /chrome/browser/instant
parentd25dd3cbcb3002055eeb48ae2e198cb1a83a37d2 (diff)
downloadchromium_src-65d68da4806e736a53cf263cbeba8fcae6c06b87.zip
chromium_src-65d68da4806e736a53cf263cbeba8fcae6c06b87.tar.gz
chromium_src-65d68da4806e736a53cf263cbeba8fcae6c06b87.tar.bz2
Fix prerender-from-omnibox/Instant issues.
When we attempt to show an Instant preview tab we return a boolean to indicate success. We then only try to prerender if this returns false and if the prerender-from-omnibox flag is set. BUG=94423 TEST=Manual: Tested combinations of no flags, --prerender-from-omnibox, and --restrict-instant-to-search. Review URL: http://codereview.chromium.org/7828057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r--chrome/browser/instant/instant_controller.cc21
-rw-r--r--chrome/browser/instant/instant_controller.h5
2 files changed, 8 insertions, 18 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index c7dd79b..832a2d7 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/instant/promo_counter.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
@@ -176,7 +175,7 @@ bool InstantController::CommitIfCurrent(InstantController* controller) {
return false;
}
-void InstantController::Update(TabContentsWrapper* tab_contents,
+bool InstantController::Update(TabContentsWrapper* tab_contents,
const AutocompleteMatch& match,
const string16& user_text,
bool verbatim,
@@ -195,26 +194,15 @@ void InstantController::Update(TabContentsWrapper* tab_contents,
if (url.is_empty() || !url.is_valid()) {
// Assume we were invoked with GURL() and should destroy all.
DestroyPreviewContents();
- return;
+ return false;
}
PreviewCondition preview_condition = GetPreviewConditionFor(match,
&template_url);
- if (preview_condition == PREVIEW_CONDITION_SUCCESS) {
- // Do nothing if we should show it.
- } else if (preview_condition == PREVIEW_CONDITION_INSTANT_SEARCH_ONLY) {
- // Start Prerender of this page instead.
- prerender::PrerenderManager* prerender_manager =
- tab_contents_->profile()->GetPrerenderManager();
- if (prerender_manager)
- prerender_manager->AddPrerenderFromOmnibox(match.destination_url);
-
- DestroyPreviewContentsAndLeaveActive();
- return;
- } else {
+ if (preview_condition != PREVIEW_CONDITION_SUCCESS) {
// Just destroy the preview and cancel the update.
DestroyPreviewContentsAndLeaveActive();
- return;
+ return false;
}
if (!loader_manager_.get())
@@ -240,6 +228,7 @@ void InstantController::Update(TabContentsWrapper* tab_contents,
chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED,
Source<InstantController>(this),
NotificationService::NoDetails());
+ return true;
}
void InstantController::SetOmniboxBounds(const gfx::Rect& bounds) {
diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h
index 591d0f3..36ab76f 100644
--- a/chrome/browser/instant/instant_controller.h
+++ b/chrome/browser/instant/instant_controller.h
@@ -78,8 +78,9 @@ class InstantController : public InstantLoaderDelegate {
// created. If |verbatim| is true search results are shown for |user_text|
// rather than the best guess as to what the search thought the user meant.
// |verbatim| only matters if the AutocompleteMatch is for a search engine
- // that supports instant.
- void Update(TabContentsWrapper* tab_contents,
+ // that supports instant. Returns true if the attempt to update does not
+ // result in the preview TabContents being destroyed.
+ bool Update(TabContentsWrapper* tab_contents,
const AutocompleteMatch& match,
const string16& user_text,
bool verbatim,