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

Side by Side 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: Minor fixes. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 TabContents* InstantController::GetPreviewContents() const { 291 TabContents* InstantController::GetPreviewContents() const {
292 return loader_.get() ? loader_->preview_contents() : NULL; 292 return loader_.get() ? loader_->preview_contents() : NULL;
293 } 293 }
294 294
295 void InstantController::Hide() { 295 void InstantController::Hide() {
296 last_active_tab_ = NULL; 296 last_active_tab_ = NULL;
297 if (is_showing_) { 297 if (is_showing_) {
298 is_showing_ = false; 298 is_showing_ = false;
299 delegate_->HideInstant(); 299 delegate_->HideInstant();
300 // In extended mode, the Instant page may have resized the preview. Reset
301 // its height to full here so that it starts that way on each invocation.
sreeram 2012/09/17 17:26:12 "on each invocation" -> "on the next Update()"?
Jered 2012/09/18 22:12:00 Removed, this lives in the view now (as it was in
302 if (mode_ == EXTENDED)
303 delegate_->SetInstantPreviewHeight(100, INSTANT_SIZE_PERCENT);
300 } 304 }
301 } 305 }
302 306
303 bool InstantController::IsCurrent() const { 307 bool InstantController::IsCurrent() const {
304 DCHECK(IsOutOfDate() || GetPreviewContents()); 308 DCHECK(IsOutOfDate() || GetPreviewContents());
305 return !IsOutOfDate() && GetPreviewContents() && 309 return !IsOutOfDate() && GetPreviewContents() &&
306 loader_->supports_instant() && last_match_was_search_; 310 loader_->supports_instant() && last_match_was_search_;
307 } 311 }
308 312
309 TabContents* InstantController::CommitCurrentPreview(InstantCommitType type) { 313 TabContents* InstantController::CommitCurrentPreview(InstantCommitType type) {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 504
501 void InstantController::CommitInstantLoader(InstantLoader* loader) { 505 void InstantController::CommitInstantLoader(InstantLoader* loader) {
502 DCHECK_EQ(loader_.get(), loader); 506 DCHECK_EQ(loader_.get(), loader);
503 DCHECK(is_showing_ && !IsOutOfDate()) << is_showing_; 507 DCHECK(is_showing_ && !IsOutOfDate()) << is_showing_;
504 if (loader_ != loader || !is_showing_ || IsOutOfDate()) 508 if (loader_ != loader || !is_showing_ || IsOutOfDate())
505 return; 509 return;
506 510
507 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST); 511 CommitCurrentPreview(INSTANT_COMMIT_FOCUS_LOST);
508 } 512 }
509 513
514 void InstantController::SetInstantPreviewHeight(InstantLoader* loader,
515 int height,
516 InstantSizeUnits units) {
517 DCHECK_EQ(loader_.get(), loader);
518 if (mode_ == EXTENDED)
519 delegate_->SetInstantPreviewHeight(height, units);
520 }
521
510 void InstantController::InstantLoaderPreviewLoaded(InstantLoader* loader) { 522 void InstantController::InstantLoaderPreviewLoaded(InstantLoader* loader) {
511 DCHECK_EQ(loader_.get(), loader); 523 DCHECK_EQ(loader_.get(), loader);
512 AddPreviewUsageForHistogram(mode_, PREVIEW_LOADED); 524 AddPreviewUsageForHistogram(mode_, PREVIEW_LOADED);
513 } 525 }
514 526
515 void InstantController::InstantSupportDetermined(InstantLoader* loader, 527 void InstantController::InstantSupportDetermined(InstantLoader* loader,
516 bool supports_instant) { 528 bool supports_instant) {
517 DCHECK_EQ(loader_.get(), loader); 529 DCHECK_EQ(loader_.get(), loader);
518 if (supports_instant) { 530 if (supports_instant) {
519 blacklisted_urls_.erase(loader->instant_url()); 531 blacklisted_urls_.erase(loader->instant_url());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 iter->second > kMaxInstantSupportFailures) 729 iter->second > kMaxInstantSupportFailures)
718 return false; 730 return false;
719 731
720 return true; 732 return true;
721 } 733 }
722 734
723 bool InstantController::IsOutOfDate() const { 735 bool InstantController::IsOutOfDate() const {
724 return !last_active_tab_ || 736 return !last_active_tab_ ||
725 last_active_tab_ != delegate_->GetActiveTabContents(); 737 last_active_tab_ != delegate_->GetActiveTabContents();
726 } 738 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698