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

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: Move hidden notification, too. 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
« no previous file with comments | « chrome/browser/instant/instant_controller.h ('k') | chrome/browser/instant/instant_controller_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c9a94d7232bf78472a5f9ec53a3e884b8f4c073e 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;
}
@@ -297,6 +297,11 @@ void InstantController::Hide() {
if (is_showing_) {
is_showing_ = false;
delegate_->HideInstant();
+
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_INSTANT_CONTROLLER_HIDDEN,
+ content::Source<InstantController>(this),
+ content::NotificationService::NoDetails());
}
if (GetPreviewContents() && !last_full_text_.empty()) {
// Send a blank query to ask the preview to clear out old results.
@@ -495,7 +500,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 +512,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 +554,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 +648,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());
}
}
« no previous file with comments | « chrome/browser/instant/instant_controller.h ('k') | chrome/browser/instant/instant_controller_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698