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

Unified Diff: chrome/browser/instant/instant_controller.cc

Issue 10915217: Hook up SetInstantPreviewHeight for ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't cache height in InstantController. Created 8 years, 3 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/instant/instant_controller.cc
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 869c0293123248bbdc986880c17051b1d6508f90..b797e164c5b0de8f002091a1da7e65219a804800 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -222,7 +222,7 @@ bool InstantController::Update(const AutocompleteMatch& match,
// still Q, so we don't Update() the loader, but we do need to Show().
if (loader_processed_last_update_ &&
(mode_ == INSTANT || mode_ == EXTENDED))
- Show();
+ Show(100, INSTANT_SIZE_PERCENT);
return true;
}
@@ -495,7 +495,7 @@ void InstantController::SetSuggestions(
delegate_->SetSuggestedText(suggestion.text, suggestion.behavior);
if (mode_ != SUGGEST)
- Show();
+ Show(100, INSTANT_SIZE_PERCENT);
}
void InstantController::CommitInstantLoader(InstantLoader* loader) {
@@ -507,6 +507,16 @@ void InstantController::CommitInstantLoader(InstantLoader* loader) {
CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST);
}
+void InstantController::SetInstantPreviewHeight(InstantLoader* loader,
+ int height,
+ InstantSizeUnits units) {
+ DCHECK_EQ(loader_.get(), loader);
+ if (loader_ != loader || mode_ != EXTENDED)
+ return;
+
+ Show(height, units);
+}
+
void InstantController::InstantLoaderPreviewLoaded(InstantLoader* loader) {
DCHECK_EQ(loader_.get(), loader);
AddPreviewUsageForHistogram(mode_, PREVIEW_LOADED);
@@ -539,7 +549,7 @@ void InstantController::InstantSupportDetermined(InstantLoader* loader,
void InstantController::SwappedTabContents(InstantLoader* loader) {
DCHECK_EQ(loader_.get(), loader);
if (loader_ == loader && is_showing_)
- delegate_->ShowInstant();
+ delegate_->ShowInstant(100, INSTANT_SIZE_PERCENT);
}
void InstantController::InstantLoaderContentsFocused(InstantLoader* loader) {
@@ -633,11 +643,17 @@ void InstantController::DeleteLoader() {
loader_.reset();
}
-void InstantController::Show() {
+void InstantController::Show(int height, InstantSizeUnits units) {
+ // Call even if showing in case height changed.
+ delegate_->ShowInstant(height, units);
if (!is_showing_) {
is_showing_ = true;
- delegate_->ShowInstant();
AddPreviewUsageForHistogram(mode_, PREVIEW_SHOWED);
+
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN,
+ content::Source<InstantController>(this),
+ content::NotificationService::NoDetails());
}
}

Powered by Google App Engine
This is Rietveld 408576698